public ChainRenderer(float aspect, MusicStream audioPlayer) { chain1 = new UserInterfaceWidget($"{ContentDirectory}chain1.png", new Vector2(0.1f / aspect, 0.1f), Vector2.Zero); chain2 = new UserInterfaceWidget($"{ContentDirectory}chain2.png", new Vector2(0.1f / aspect, 0.1f), Vector2.Zero); skull1 = new UserInterfaceWidget($"{ContentDirectory}skull1.png", new Vector2(0.65f / aspect, 0.65f), new Vector2(-0.8f, 0.7f)); skull2 = new UserInterfaceWidget($"{ContentDirectory}skull2.png", new Vector2(0.65f / aspect, 0.65f), new Vector2(0.8f, 0.7f)); ruby = new UserInterfaceWidget($"{ContentDirectory}ruby.png", new Vector2(0.2f / aspect, 0.2f), new Vector2(0.0f, 0.85f)); stencilQuad = gfx.VertexBufferFactory.CreateQuad(1.5f, 0.5f); this.aspect = aspect; this.audioPlayer = audioPlayer; }
public Game(int windowWidth, int windowHeight) : base(windowWidth, windowHeight) { Title = "Infernal Selection"; RenderFrame += eRenderFrame; KeyDown += Game_KeyDown; KeyUp += Game_KeyUp; Closing += Game_Closing; aspect = (float)Width / Height; audioPlayer = new MusicStream(); gameState = GameState.Menu; GL.ClearColor(0.1f, 0.1f, 0.1f, 1.0f); shdFloor = gfx.ShaderFactory.CreateFloorShader(); shdTexture = gfx.ShaderFactory.CreateTextureShader(); shdBackground = gfx.ShaderFactory.CreateBackgroundShader(); shdFinalpass = gfx.ShaderFactory.CreateFinalpassShader(); shdUserInterface = gfx.ShaderFactory.CreateUserInterfaceShader(); shdBloodyScreen = gfx.ShaderFactory.CreateBloodyScreenShader(); Matrix4 ortho = Matrix4.CreateOrthographic(20f * aspect, 20f, -1.0f, 1.0f); shdTexture.LoadMatrix4(ortho, "projection"); shdFloor.LoadMatrix4(ortho, "projection"); offscreen = new gfx.RenderTarget(Width, Height); screenQuad = gfx.VertexBufferFactory.CreateQuad(2.0f, 2.0f); texScratch = new gfx.Texture2D($"{ContentDirectory}scratch.png"); arena = new Arena(15.0f); playButton = new UserInterfaceWidget($"{ContentDirectory}playbtn.png", new Vector2(0.2f * 200f / 75f, 0.2f), new Vector2(0.0f, 0.4f)); exitButton = new UserInterfaceWidget($"{ContentDirectory}quitbtn.png", new Vector2(0.2f * 200f / 75f, 0.2f), new Vector2(0.0f, 0.0f)); fplayButton = new UserInterfaceWidget($"{ContentDirectory}fplaybtn.png", new Vector2(0.2f * 200f / 75f, 0.2f), new Vector2(0.0f, 0.4f)); fexitButton = new UserInterfaceWidget($"{ContentDirectory}fquitbtn.png", new Vector2(0.2f * 200f / 75f, 0.2f), new Vector2(0.0f, 0.0f)); ggjIcon = new UserInterfaceWidget($"{ContentDirectory}ggj.png", new Vector2(0.3f / aspect, 0.3f), new Vector2(0.7f, -0.7f)); chainRenderer = new ChainRenderer(aspect, audioPlayer); GL.Enable(EnableCap.StencilTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); audioPlayer.Play($"{ContentDirectory}e1m1.ogg", true); audioPlayer.Play($"{ContentDirectory}background_sound.ogg", true, 0.5f); }