Beispiel #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            // Place messages in the bottom left of the screen, raising the start of the draw for each message in the list
            Vector2 firstPosition = new Vector2(4, SettingsManager.getResolutionHeight() - messageList.Count * 16);

            for (int i = 0; i < messageList.Count; i++)
            {
                // Draw messages while dropping the position of teh draw 16 pixels each time, resulting in a list of messages if there are more than one
                spriteBatch.DrawString(ContentStore.generic, messageList[i].Item1, firstPosition + (new Vector2(0, 16) * i), messageList[i].Item2);
            }
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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;
                }
            }
        }