Esempio n. 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);
        }
Esempio n. 2
0
        public void Draw(gfx.Shader shader)
        {
            shader.LoadFloat((float)Math.Atan2(Velocity.Y, Velocity.X), "rotation");
            shader.LoadVector2(Position, "translation");

            sprite.Draw(shader);
        }
Esempio n. 3
0
        public void DrawTraps(gfx.Shader shader)
        {
            shader.Bind();

            foreach (TrapDescriptor trap in TrapList)
            {
                if (trap.active)
                {
                    shader.LoadVector2(trap.position, "translation");
                    shader.LoadFloat((float)Math.PI, "rotation");
                    trap.sprite.Draw(shader);
                }
            }

            shader.Unbind();
        }
Esempio n. 4
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);
        }