Пример #1
0
        public void OnRenderFrame(FrameEventArgs e)
        {
            GL.PushMatrix();

            camera.LoadView();

            map.Draw();

            foreach (var ent in entities)
            {
                ent.Draw();
            }

            player.Draw();

            GL.PopMatrix();

            GL.MatrixMode(MatrixMode.Projection);
            GL.PushMatrix();
            var projection = Matrix4.CreateOrthographicOffCenter(-512, 512, 384, -384, 0, 1);

            GL.LoadMatrix(ref projection);
            GL.MatrixMode(MatrixMode.Modelview);

            if (lastCollidedWith != null && !string.IsNullOrEmpty(lastCollidedWith.helpText))
            {
                GL.PushMatrix();
                GL.Translate(-500, -360, 0);
                helpFont.Print(lastCollidedWith.helpText);
                GL.PopMatrix();
            }

            GL.PushMatrix();
            GL.Translate(-500, 340, 0);
            helpFont.Print("Health: " + player.health);
            GL.PopMatrix();
            GL.Color4(1f, 1f, 1f, 1f);
            GL.MatrixMode(MatrixMode.Projection);
            GL.PopMatrix();
            GL.MatrixMode(MatrixMode.Modelview);

            if (fadingIn || fadingOut)
            {
                GL.Color4(0f, 0f, 0f, fadePercent);
                fadeIn.Draw();
                GL.Color4(1f, 1f, 1f, 1f);
            }
        }