Exemple #1
0
        public override void Render(FrameEventArgs e)
        {
            GL.Viewport(0, 0, sceneManager.Width, sceneManager.Height);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            systemManager.ActionSystem(entityManager);
            GUI.clearColour = Color.Transparent;

            //Depending on inputNum the game shows what to input for the player
            if (InputNum == 0)
            {
                Angle = Input;
            }
            else
            if (InputNum == 1)
            {
                Power = Input;
            }

            float width    = sceneManager.Width,
                  height   = sceneManager.Height,
                  fontSize = Math.Min(width, height) / 20f;
            int middleX    = (int)(width / 2),
                middleY    = (int)(height / 2);

            //Draws Scoreboard and the Player's chosen names.
            GUI.Label(new Rectangle(0, 0 - (int)(fontSize / 4.0f), (int)width, (int)(fontSize * 2f)), Score1 + " > Score < " + Score2, (int)(fontSize * 0.4f), StringAlignment.Center);
            GUI.Label(new Rectangle(-middleX + (Player1.Length * 10) + (int)(width * 0.01f), 0 - (int)(fontSize / 4.0f), (int)width, (int)(fontSize * 2f)), Player1, (int)(fontSize * 0.5f), StringAlignment.Center);
            GUI.Label(new Rectangle(middleX - (Player2.Length * 10) - (int)(width * 0.01f), 0 - (int)(fontSize / 4.0f), (int)width, (int)(fontSize * 2f)), Player2, (int)(fontSize * 0.5f), StringAlignment.Center);

            //Draws Player1 UI
            if (isPlayer1)
            {
                GUI.Label(new Rectangle(-middleX + (Player1.Length * 10) + (int)(width * 0.01f), 0 + (int)(fontSize / 1.5f), (int)width, (int)(fontSize * 2f)), "Angle: " + Angle, (int)(fontSize * 0.5f), StringAlignment.Center);
                if (InputNum >= 1)
                {
                    GUI.Label(new Rectangle(-middleX + (Player1.Length * 10) + (int)(width * 0.01f), 0 + (int)(fontSize * 1.5f), (int)width, (int)(fontSize * 2f)), "Power: " + Power, (int)(fontSize * 0.5f), StringAlignment.Center);
                }
            }

            // Draws Player2 UI
            if (!isPlayer1)
            {
                GUI.Label(new Rectangle(middleX - (Player2.Length * 10) - (int)(width * 0.01f), 0 + (int)(fontSize / 1.5f), (int)width, (int)(fontSize * 2f)), "Angle: " + Angle, (int)(fontSize * 0.5f), StringAlignment.Center);
                if (InputNum >= 1)
                {
                    GUI.Label(new Rectangle(middleX - (Player2.Length * 10) - (int)(width * 0.01f), 0 + (int)(fontSize * 1.5f), (int)width, (int)(fontSize * 2f)), "Power: " + Power, (int)(fontSize * 0.5f), StringAlignment.Center);
                }
            }

            GUI.Render();
        }