public void Render(FrameEventArgs e) { GL.Viewport(0, 0, sceneManager.Width, sceneManager.Height); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); projectionMatrix = Matrix4.CreateOrthographicOffCenter(0, sceneManager.Width, 0, sceneManager.Height, -1.0f, +1.0f); ball.Render(projectionMatrix); paddlePlayer.Render(projectionMatrix); paddleAI.Render(projectionMatrix); speedPowerUp.Render(projectionMatrix); lengthPowerUp.Render(projectionMatrix); float width = sceneManager.Width, height = sceneManager.Height, fontSize = Math.Min(width, height) / 10f; if (GamerOver == false) { GUI.Label(new Rectangle(0, (int)(fontSize / 5f), (int)width, (int)(fontSize * 1f)), ("Time: " + clock + "." + Timer), (int)fontSize / 2, StringAlignment.Center); } else { GUI.Label(new Rectangle(0, (int)(fontSize / 5), (int)width, (int)(fontSize * 10f)), ("Game Over"), (int)fontSize * 2, StringAlignment.Center); } GUI.Label(new Rectangle(0, (int)(fontSize / 5f), (int)width, (int)(fontSize * 1f)), ("" + scorePlayer), (int)fontSize / 2, StringAlignment.Near); GUI.Label(new Rectangle(0, (int)(fontSize / 5f), (int)width, (int)(fontSize * 1f)), (scoreAI + ""), (int)fontSize / 2, StringAlignment.Far); //GUI.Label(new Rectangle(0, (int)(fontSize / 16f), (int)width, (int)(fontSize * 4f)), ("Player " + scorePlayer + " AI: " + scoreAI), (int)fontSize, StringAlignment.Center); //GUI.Label(new Rectangle(0, (int)(fontSize / 16f), (int)width, (int)(fontSize * 4f)), ("X " + ball.Velocity.X + " Y: " + ball.Velocity.Y), (int)fontSize, StringAlignment.Center); GUI.Render(); }
public void Render(FrameEventArgs e) { GL.Viewport(0, 0, sceneManager.Width, sceneManager.Height); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); projectionMatrix = Matrix4.CreateOrthographicOffCenter(0, sceneManager.Width, 0, sceneManager.Height, -1.0f, +1.0f); ball.Render(projectionMatrix); paddlePlayer.Render(projectionMatrix); paddleAI.Render(projectionMatrix); }