/// <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) { // to start, clear the graphics device of the last frame GraphicsDevice.Clear(Color.Black); // draw the GUI gui.Draw(); if (stateMachine.CurrentState.Name == overworld.Name) { spriteBatch.Begin(); foreach (var item in starNodeDraws) { item.Update(gameTime); item.Draw(spriteBatch); } overworldCursorDraw.Draw(spriteBatch); spriteBatch.End(); } // if we're in the battle state, or paused in the battle state if (stateMachine.CurrentState.Name == battle.Name || stateMachine.CurrentState.Name == pauseState.Name && stateMachine.PreviousState.Name == battle.Name) { spriteBatch.Begin(); Ship playerShip = (Ship)ShipManager.RetrieveEntity(playerShipUID); playerShip.Draw(spriteBatch); // draw different stuff based on the current gamestate switch (gameStateUID) { case 0: //this is battle one Ship enemyShip1 = (Ship)ShipManager.RetrieveEntity(enemyShipUID1); enemyShip1.Draw(spriteBatch); break; case 1: //this is narrative one break; case 2: //this is battle two Ship enemyShip2 = (Ship)ShipManager.RetrieveEntity(enemyShipUID2); enemyShip2.Draw(spriteBatch); break; case 3: //this is narrative two break; default: break; } GridManager.Draw(spriteBatch); RoomManager.Draw(spriteBatch); //System.Diagnostics.Debug.WriteLine("before crew draw"); CrewManager.Draw(spriteBatch); //System.Diagnostics.Debug.WriteLine("after crew draw"); WeaponManager.Draw(spriteBatch); if (multiSelecting == true) { //System.Diagnostics.Debug.WriteLine("multiselecting"); // create a rectangle out of the points Point startPoint = new Point(); // for both x and y if the end point is "less" than the start point, use the end point's coord as the starting point for the rect // otherwise, use the startpoint's coord if (selectRectStart.X > selectRectEnd.X) { startPoint.X = selectRectEnd.X; } else { startPoint.X = selectRectStart.X; } if (selectRectStart.Y > selectRectEnd.Y) { startPoint.Y = selectRectEnd.Y; } else { startPoint.Y = selectRectStart.Y; } Rectangle drawRect = new Rectangle(startPoint.X, startPoint.Y, Math.Abs(selectRectEnd.X - selectRectStart.X), Math.Abs(selectRectEnd.Y - selectRectStart.Y)); // draw the rectangle using pixel lines // top, bottom, left, right spriteBatch.Draw(pixel, new Rectangle(drawRect.X, drawRect.Y, drawRect.Width, 5), Color.Green); spriteBatch.Draw(pixel, new Rectangle(drawRect.X, drawRect.Y + drawRect.Height - 5, drawRect.Width, 5), Color.Green); spriteBatch.Draw(pixel, new Rectangle(drawRect.X, drawRect.Y, 5, drawRect.Height), Color.Green); spriteBatch.Draw(pixel, new Rectangle((drawRect.X + drawRect.Width - 5), drawRect.Y, 5, drawRect.Height), Color.Green); } spriteBatch.End(); } base.Draw(gameTime); }