//MAPFUNC /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Viewport = viewport; GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, cam.Transform); switch (ps) { case PlayState.PLAYING: if (player.isInMap()) { float SCALE = (float)2.8; Vector2 topLeft = new Vector2(player.getPos().X - SCREEN_WIDTH * (float)1.5 + SCREEN_WIDTH * (3 - SCALE) / 2, player.getPos().Y - SCREEN_HEIGHT * (float)1.5 + SCREEN_HEIGHT * (3 - SCALE) / 2); Vector2 mousePos = new Vector2(topLeft.X - 18 + Mouse.GetState().Position.X *(float)2.851, topLeft.Y - 18 + Mouse.GetState().Position.Y *(float)2.851); foreach (Object o in objects) { if (o.getType() == ObjectType.STAR) { Vector2 pos = new Vector2(topLeft.X + o.getPos().X *SCREEN_WIDTH *SCALE / MAP_WIDTH, topLeft.Y + o.getPos().Y *SCREEN_HEIGHT *SCALE / MAP_HEIGHT); spriteBatch.Draw(minimap_star, new Rectangle((int)pos.X, (int)pos.Y, minimap_star.Width, minimap_star.Height), null, Color.White, 0, new Vector2(minimap_star.Width / 2, minimap_star.Height / 2), SpriteEffects.None, 0); if (Math2.inRadius(mousePos, pos, 16)) { spriteBatch.DrawString(bigFont, "ID: " + o.getID().ToString(), new Vector2(topLeft.X + SCREEN_WIDTH * (float)1.4, topLeft.Y + 16), Color.White); spriteBatch.DrawString(bigFont, "OWNER: \"" + o.getOwner() + "\"", new Vector2(topLeft.X + SCREEN_WIDTH * (float)1.4, topLeft.Y + 48), Color.White); } } } foreach (AI o in ships) { Vector2 pos = new Vector2(topLeft.X + o.getPos().X *SCREEN_WIDTH *SCALE / MAP_WIDTH, topLeft.Y + o.getPos().Y *SCREEN_HEIGHT *SCALE / MAP_HEIGHT); spriteBatch.Draw(minimap_star, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), null, Color.White, 0, new Vector2(minimap_star.Width / 2, minimap_star.Height / 2), SpriteEffects.None, 0); } Vector2 shipPos = new Vector2(topLeft.X + player.getPos().X *SCREEN_WIDTH *SCALE / MAP_WIDTH, topLeft.Y + player.getPos().Y *SCREEN_HEIGHT *SCALE / MAP_HEIGHT); spriteBatch.Draw(minimap_ship, new Rectangle((int)shipPos.X, (int)shipPos.Y, minimap_ship.Width, minimap_ship.Height), null, Color.White, 0, new Vector2(minimap_ship.Width / 2, minimap_ship.Height / 2), SpriteEffects.None, 0); spriteBatch.Draw(minimap_ship, new Rectangle((int)mousePos.X, (int)mousePos.Y, minimap_ship.Width, minimap_ship.Height), null, Color.White, 0, new Vector2(minimap_ship.Width / 2, minimap_ship.Height / 2), SpriteEffects.None, 0); } else { int i = 0; foreach (Object o in objects) { bool draw = Math2.inRadius(player.getPos(), o.getPos(), RENDER_RADIUS); ObjectType type = o.getType(); if ((type == ObjectType.STAR || type == ObjectType.MINING_PLANET || type == ObjectType.ASTEROID) && draw) { spriteBatch.Draw(o.getTexture(), new Rectangle((int)o.getPos().X, (int)o.getPos().Y, o.getTexture().Width, o.getTexture().Height), null, Color.White, o.getAngle() + Math2.QUARTER_CIRCLE, new Vector2(o.getTexture().Width / 2, o.getTexture().Height / 2), SpriteEffects.None, 0); if (o.getType() == ObjectType.STAR) { spriteBatch.DrawString(font, "Star ID: " + ((Star)o).getID().ToString(), new Vector2(o.getPos().X, o.getPos().Y + 200), Color.White); } } } foreach (PlayerShip o in players) { spriteBatch.Draw(o.getTexture(), new Rectangle((int)o.getPos().X, (int)o.getPos().Y, o.getTexture().Width, o.getTexture().Height), null, Color.White, o.getAngle() + Math2.QUARTER_CIRCLE, new Vector2(o.getTexture().Width / 2, o.getTexture().Height / 2), SpriteEffects.None, 0); } foreach (Asteroid o in asteroids) { if (Math2.inRadius(player.getPos(), o.getPos(), RENDER_RADIUS)) { spriteBatch.Draw(o.getTexture(), new Rectangle((int)o.getPos().X, (int)o.getPos().Y, o.getTexture().Width, o.getTexture().Height), null, Color.White, o.getAngle() + Math2.QUARTER_CIRCLE, new Vector2(o.getTexture().Width / 2, o.getTexture().Height / 2), SpriteEffects.None, 0); } } foreach (AI o in ships) { if (Math2.inRadius(player.getPos(), o.getPos(), RENDER_RADIUS)) { spriteBatch.Draw(o.getTexture(), new Rectangle((int)o.getPos().X, (int)o.getPos().Y, o.getTexture().Width, o.getTexture().Height), null, Color.White, o.getAngle() + Math2.QUARTER_CIRCLE, new Vector2(o.getTexture().Width / 2, o.getTexture().Height / 2), SpriteEffects.None, 0); spriteBatch.DrawString(font, o.getTask() + "\n" + o.getOwner() + "\n" + o.getID(), new Vector2(o.getPos().X, o.getPos().Y + 200), Color.White); } } foreach (Projectile o in projectiles) { if (Math2.inRadius(player.getPos(), o.getPos(), RENDER_RADIUS)) { spriteBatch.Draw(o.getTexture(), new Rectangle((int)o.getPos().X, (int)o.getPos().Y, o.getTexture().Width, o.getTexture().Height), null, Color.White, o.getAngle() + Math2.QUARTER_CIRCLE, new Vector2(o.getTexture().Width / 2, o.getTexture().Height / 2), SpriteEffects.None, 0); } } spriteBatch.DrawString(font, "Speed: " + Math.Round((decimal)player.getSpeed()).ToString(), new Vector2(player.getPos().X, player.getPos().Y + 80), Color.White); spriteBatch.DrawString(font, "Iron: " + Math.Round((decimal)player.getIron()).ToString(), new Vector2(player.getPos().X, player.getPos().Y + 96), Color.White); spriteBatch.DrawString(font, "Gems: " + Math.Round((decimal)player.getGems()).ToString(), new Vector2(player.getPos().X, player.getPos().Y + 112), Color.White); spriteBatch.DrawString(font, "Cap: " + Math.Round((decimal)player.getCapacity()).ToString(), new Vector2(player.getPos().X, player.getPos().Y + 128), Color.White); } break; case PlayState.MENU: spriteBatch.DrawString(font, "yolo", new Vector2(player.getPos().X - (SCREEN_WIDTH / 2) + 20, player.getPos().Y), Color.White); foreach (Button b in buttonList) { spriteBatch.Draw(b.tex, b.bounds, Color.White); System.Diagnostics.Debug.WriteLine("Yolo"); } break; default: break; } spriteBatch.End(); base.Draw(gameTime); }