public void Draw(SpriteBatch spriteBatch) { // Draw background background.Draw(spriteBatch); // Draw buttons foreach (Button button in menuButtons) { button.Draw(spriteBatch); } // Draw fields foreach (Field field in menuFields) { switch (field.id) { case 0: field.Draw(spriteBatch, SettingsManager.getUsername()); break; case 1: field.Draw(spriteBatch, SettingsManager.getVerboseDifficulty()); break; case 2: field.Draw(spriteBatch, SettingsManager.getResolutionWidth() + "x" + SettingsManager.getResolutionHeight()); break; case 8: field.Draw(spriteBatch, SettingsManager.getShowDebug().ToString()); break; case 9: field.Draw(spriteBatch, SettingsManager.getShowBounds().ToString()); break; case 10: field.Draw(spriteBatch, SettingsManager.getShowDepths().ToString()); break; default: field.Draw(spriteBatch, "No value"); break; } } }
protected override void Initialize() { // Initialise viewport variables ScreenManager.screenCenter = new Vector2(SettingsManager.getResolutionWidth() / 2, SettingsManager.getResolutionHeight() / 2); // Set the state of the game and the cursor to their initial values ScreenManager.gameState = GameState.MainMenu; ScreenManager.cursorState = CursorState.Pointer; // Pass the messageList to ScreenManager so that it can be added to elsewhere ScreenManager.messageList = msgList; base.Initialize(); }
public Game1() { graphics = new GraphicsDeviceManager(this); IsMouseVisible = false; //Hide system cursor Content.RootDirectory = "Content"; // Set root content directory Window.Title = "MOBO"; // Set window title // Load in settings from file SettingsManager.Initialize(); // Set resolution to that specified by settings graphics.PreferredBackBufferWidth = SettingsManager.getResolutionWidth(); graphics.PreferredBackBufferHeight = SettingsManager.getResolutionHeight(); }
public void Draw(SpriteBatch staticSpriteBatch, SpriteBatch cameraSpriteBatch) { // If the Network is starting display some basic connecting text if (firstRun) { Vector2 textOrigin = MoboUtils.textOrigin("Connecting...", ContentStore.generic); staticSpriteBatch.DrawString(ContentStore.generic, "Connecting...", ScreenManager.screenCenter, Color.White, 0.0f, textOrigin, 1f, SpriteEffects.None, 0.0f); } else { //Draw background background.Draw(cameraSpriteBatch); int i = 0; foreach (Player player in players.Values) { foreach (Projectile projectile in player.projectiles.Values) { if (projectile != null) { projectile.Draw(cameraSpriteBatch); } } player.Draw(staticSpriteBatch, cameraSpriteBatch); // Print players for HUD string name = player.name + " (" + player.score + ")"; int rightAlign2 = (int)ContentStore.generic.MeasureString(name).X; staticSpriteBatch.DrawString(ContentStore.generic, name, new Vector2(SettingsManager.getResolutionWidth() - rightAlign2 - 4, (i + 1) * 16), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); i++; } // Draw station spawner.Draw(cameraSpriteBatch); // Draw all players in the top right string str = "Players"; int rightAlign = (int)ContentStore.generic.MeasureString(str).X; staticSpriteBatch.DrawString(ContentStore.generic, str, new Vector2(SettingsManager.getResolutionWidth() - rightAlign - 4, 0), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); // Draw minimap minimap.Draw(staticSpriteBatch); } }
public Minimap(bool online, ConcurrentDictionary <long, Player> players, ConcurrentDictionary <int, Station> stations) { this.players = players; this.stations = stations; // Used to draw the map in the top center of the screen map = new Rectangle(SettingsManager.getResolutionWidth() / 2 - width / 2, 0, width, height); // Select the write player whether offline or online for comparing distances if (online) { local = Online.localPlayer; } else { local = Offline.localPlayer; } }