예제 #1
0
        private void stateMenu(float dt)
        {
            gfx.RenderTarget.Backbuffer.Clear();

            shdBackground.Bind();
            shdBackground.LoadVector2(new Vector2(Width, Height), "resolution");
            shdBackground.LoadFloat(timeAcc, "time");
            screenQuad.Bind();
            GL.DrawArrays(PrimitiveType.TriangleFan, 0, screenQuad.VertexCount);
            screenQuad.Unbind();
            shdBackground.Unbind();

            if (keyboard[(int)Key.Enter])
            {
                switch (selectedOption)
                {
                case 0:
                    resetGame();
                    gameState = GameState.Playing;
                    break;

                default:
                    Exit();
                    break;
                }
            }

            if ((keyboard[(int)Key.W] || keyboard[(int)Key.Up]) && (selectedOption == 1))
            {
                --selectedOption;
            }
            if ((keyboard[(int)Key.S] || keyboard[(int)Key.Down]) && (selectedOption == 0))
            {
                ++selectedOption;
            }

            if (selectedOption == 0)
            {
                fplayButton.Draw(shdUserInterface);
                exitButton.Draw(shdUserInterface);
            }
            else
            {
                playButton.Draw(shdUserInterface);
                fexitButton.Draw(shdUserInterface);
            }
            ggjIcon.Draw(shdUserInterface);
        }
 public void Draw(gfx.Shader shader)
 {
     shader.Bind();
     texture.Bind(0);
     quad.Bind();
     shader.LoadVector2(Position, "translation");
     GL.DrawArrays(PrimitiveType.TriangleFan, 0, quad.VertexCount);
     quad.Unbind();
     texture.Unbind(0);
     shader.Unbind();
 }
예제 #3
0
        public void Draw(gfx.Shader shader)
        {
            Vector2 min_uv = new Vector2(offset * CurrentFrame, 0.0f);
            Vector2 max_uv = new Vector2(offset * CurrentFrame + offset, 1.0f);

            shader.LoadVector2(max_uv, "max_uv");
            shader.LoadVector2(min_uv, "min_uv");

            shader.LoadFloat(scale, "scale");

            texture.Bind(0);

            vbo.Bind();
            GL.DrawArrays(PrimitiveType.TriangleFan, 0, vbo.VertexCount);
            vbo.Unbind();

            texture.Unbind(0);
        }
예제 #4
0
        public void DrawMap(gfx.Shader shader)
        {
            shader.Bind();

            vbo.Bind();

            mapTexture.Bind(0);
            GL.DrawArrays(PrimitiveType.TriangleFan, 0, vbo.VertexCount);
            mapTexture.Unbind(0);

            GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);

            glowmapTexture.Bind(0);
            GL.DrawArrays(PrimitiveType.TriangleFan, 0, vbo.VertexCount);
            glowmapTexture.Unbind(0);

            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            vbo.Unbind();
            shader.Unbind();
        }
예제 #5
0
        public void Draw(gfx.Shader shader)
        {
            float o = currentOffset % (0.1f / aspect);

            GL.ColorMask(false, false, false, false);
            GL.StencilMask(0xFF);
            GL.StencilFunc(StencilFunction.Always, 1, 0xFF);
            GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Replace);
            stencilQuad.Bind();
            shader.LoadVector2(new Vector2(0.0f, 0.6f), "translation");
            GL.DrawArrays(PrimitiveType.TriangleFan, 0, stencilQuad.VertexCount);
            GL.StencilFunc(StencilFunction.Equal, 1, 0xFF);
            stencilQuad.Unbind();
            GL.StencilMask(0x00);
            GL.ColorMask(true, true, true, true);

            for (float x = -0.9f; x <= 0.9f; x += (0.1f / aspect))
            {
                chain1.Position = new Vector2(x + o, 0.58f);
                chain1.Draw(shader);
            }

            ruby.Position = new Vector2(currentOffset, 0.58f);
            ruby.Draw(shader);

            GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
            ruby.Draw(shader);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            for (float x = -0.9f; x <= 0.9f; x += (0.1f / aspect))
            {
                chain1.Position = new Vector2(x - o, 0.54f);
                chain1.Draw(shader);
            }

            GL.StencilFunc(StencilFunction.Always, 1, 0xFF);

            skull1.Draw(shader);
            skull2.Draw(shader);
        }