/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); //So game won't be drawn at Initialization if (m_game.m_state != ModelClasses.Game.GameState.Main) { //to fix z-buffer issue, caused by spriteBatch.Begin() GraphicsDevice.DepthStencilState = DepthStencilState.Default; //camera view sätts här m_gameView.Draw(spriteBatch, m_gameAssets, m_game, graphics.GraphicsDevice, m_debugView, m_save, m_elapsedTime); if (m_debugMode) { DebugActions(); } } //Draws Menu default is Main Menu m_menu.Draw(spriteBatch, m_gameAssets, m_game, m_debugView, m_save); //Can only happen during a game if (m_game.m_state == ModelClasses.Game.GameState.Game) { m_menu.m_menuState = ViewClasses.Menu.Menu.MenuState.None; //This is here to draw the grid, and show the grid no matter how the depth is. So it's before the z-buffer issue is fixed if (m_game.m_player.m_tryingToBuild && m_game.m_player.m_focusedTarget != null) { Vector3?f_point = m_inputController.m_input.GetWorldPosition(graphics.GraphicsDevice, m_game.m_groundPlane, m_game.m_map, m_gameView.m_camera, m_inputController.m_input.m_mouse.m_mouseState.X, m_inputController.m_input.m_mouse.m_mouseState.Y); if (f_point.HasValue) { if (m_game.m_player.m_focusedTarget.m_buildBehavior != null) { //DRAW TRYING TO BUILD .. draws ze grid! m_gameView.DrawTryingToBuild(graphics.GraphicsDevice, f_point.Value, m_game.m_map, m_gameView.m_HUD.m_visibleBuildingSize, m_gameView.m_HUD.m_buildingNeedsWO); } } } } //my function checks bools and performs different things GameCheck(); //So u can click on the screen ^_^ m_inputController.DoInputControl(graphics.GraphicsDevice, ref m_game, ref m_gameView, m_debugView, m_menu, m_gameAssets); //MIN FUNKTION - Ze Tiger TigerRawrAttack(); }