public MainWindow() { InitializeComponent(); //Set the sky colour this.BackColor = Color.SkyBlue; //create the renderer and the scene mRenderer = new SimpleRenderer(); mScene = new Scene(); //Set the graphics timer to update every 10ms mDrawTimer = new Timer(); mDrawTimer.Interval = 10; mDrawTimer.Tick += new EventHandler(TickGraphics); mDrawTimer.Enabled = true; //Set the Physics timer to update ever 5ms mPhysTimer = new Timer(); mPhysTimer.Interval = 5; mPhysTimer.Tick += new EventHandler(TickPhysics); mPhysTimer.Enabled = true; //create the debug display dbgDisp = new DebugDisplay(mScene.thePlayer, mScene.theAIManager, mRenderer); //Use timer to keep track of time between physics updates timer = new System.Diagnostics.Stopwatch(); timer.Start(); }
public DebugDisplay(Physics.Player thePlayer, AI.AIManager aManager, SimpleRenderer aRender) { //get references to the useful game classes playerCharacter = thePlayer; mAImanager = aManager; physEng = Physics.PhysicsEngine.GetPhysicsEngine(); AIgraph = AI.WorldGraph.GetWorldGraph(); mRenderer = aRender; //initialise the bools showCurrentPlayerJump = false; showNodes = false; showPath = false; showJumpRange = false; showFallRange = false; showJumpBoxCollisions = false; showFallBoxCollisions = false; showCollisionNormals = false; showLocalNodes = -1; jumpDestination = null; }
//draw all the UI information public void DrawUI(SimpleRenderer aRenderer, Graphics g) { aRenderer.Draw(message, messageLocation, g, messageColour); aRenderer.Draw("Time: " + ((int)timeRunning).ToString(), timerLocation, g); aRenderer.Draw("Lives: " + livesLeft.ToString(), livesLocation, g); }