Example #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (IsActive)
            {
                // Drawing for non-player dialog box.
                _container.Draw(spriteBatch);
                spriteBatch.DrawString(_smallFont, _partialText,
                                       new Vector2(_container.GetPosition().X + BOX_PADDING, _container.GetPosition().Y + BOX_PADDING),
                                       new Color(51, 51, 51));
                FontHelper.DrawWithOutline(spriteBatch, _bigFont, _characterName, _container.GetPosition() + new Vector2(20, -_bigFont.MeasureString(_characterName).Y), 2, Color.White, Color.Black);

                //if (!IsWritingText())
                //{
                //    // Displays options to choose from when the whole text has been displayed.
                //    //spriteBatch.Draw(GameWorld.UiSpriteSheet, _playerDialogBox, _dialogBoxSourceRectangle, Color.White);
                //    if (_dialogOptions.Count > 0)
                //    {
                //        _optionsContainer.Draw(spriteBatch);
                //        _dialogOptions.Draw(spriteBatch, _font, (int)_optionsContainer.GetPosition().X + (int)_optionsContainer.Size.X / 2, (int)_optionsContainer.GetPosition().Y + 30);
                //    }
                //    else
                //    {
                //        // Displays default text to continue if there are no options.
                //        string text = "Press space to continue";
                //        spriteBatch.DrawString(_font, text,
                //            new Vector2((int)_dialogueContainer.GetPosition().X + (int)_dialogueContainer.Size.X - _font.MeasureString(text).X - 5, (int)_dialogueContainer.GetPosition().Y + (int)_dialogueContainer.Size.Y - 30),
                //            new Color(51, 51, 51));
                //    }
                //}
            }
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(ContentHelper.LoadTexture("Tiles/white"), new Rectangle(0, 0, TMBAW_Game.UserResWidth, TMBAW_Game.UserResHeight), Color.Black * .7f);
            spriteBatch.Draw(GameWorld.UiSpriteSheet, _boundsDrawRectangle, _boundsSourceRectangle, Color.White);

            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, GraphicsRenderer.DefaultDepthStencil, GraphicsRenderer.ScissorRectRasterizer);
            // Sets the scrolling levels to disappear if they are not inside of this bounding box.
            Rectangle originalScissorRectangle = spriteBatch.GraphicsDevice.ScissorRectangle;

            spriteBatch.GraphicsDevice.ScissorRectangle = _scissorRectangle;

            foreach (LevelInfo level in _levelInfos)
            {
                level.Draw(spriteBatch);
            }

            // Returns the scissor rectangle to original.
            spriteBatch.End();
            spriteBatch.GraphicsDevice.ScissorRectangle = originalScissorRectangle;
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, GraphicsRenderer.DefaultDepthStencil, GraphicsRenderer.ScissorRectRasterizer);

            // Draw buttons.
            foreach (IconButton b in _buttons)
            {
                b.Draw(spriteBatch);
            }
            foreach (IconButton b in _buttons)
            {
                b.DrawTooltip(spriteBatch);
            }

            // Draw header text.
            FontHelper.DrawWithOutline(spriteBatch, _headerFont, _headerText, _headerPos, 2, Color.White, Color.Black);
        }
Example #3
0
 public static void Draw(SpriteBatch spriteBatch)
 {
     if (_isActive)
     {
         spriteBatch.Draw(_texture, _drawRectangle, _sourceRectangle, Color.White, 0, new Vector2(0, 0), SpriteEffects.None, 0);
         FontHelper.DrawWithOutline(spriteBatch, FontHelper.Fonts[1], _displayCharacter, new Vector2(_drawRectangle.Center.X - FontHelper.Fonts[1].MeasureString(_displayCharacter).X / 2, _drawRectangle.Y + 8), 1, Color.Black, Color.DarkGray);
     }
 }
Example #4
0
            public static void Draw(SpriteBatch spriteBatch)
            {
                animation.Draw(spriteBatch, position);
                float x = position.X + 80;
                float y = position.Y + 20;

                FontHelper.DrawWithOutline(spriteBatch, fontBig, score.ToString(), new Vector2(x, y), 1, Color.White, Color.Black);
            }
Example #5
0
 public virtual void Draw(SpriteBatch spriteBatch)
 {
     if (IsText && Text != null)
     {
         FontHelper.DrawWithOutline(spriteBatch, FontHelper.Fonts[2], Text, Position, 1, Color, Color.Black);
     }
     else if (_texture != null)
     {
         spriteBatch.Draw(_texture, new Rectangle((int)Position.X, (int)Position.Y, (int)(Width * Scale), (int)(Height * Scale)), SourceRectangle, Color * Opacity);
     }
 }
Example #6
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            //spriteBatch.DrawString(Font, Text, new Vector2(CollRectangle.Center.X, CollRectangle.Center.Y),
            // TextColor, 0, Font.MeasureString(Text) / 2, (float)(.5 / Main.HeightRatio), SpriteEffects.None, 0);

            float x = CollRectangle.Center.X - Font.MeasureString(Text).X / 2;
            float y = CollRectangle.Center.Y - Font.MeasureString(Text).Y / 2;

            FontHelper.DrawWithOutline(spriteBatch, Font, Text,
                                       new Vector2(x, y), 1, TextColor, Color.Black);
        }
Example #7
0
            public static void Draw(SpriteBatch spriteBatch)
            {
                animation.Draw(spriteBatch, position);
                float x = position.X + 80;
                float y = position.Y + 15;

                FontHelper.DrawWithOutline(spriteBatch, fontBig, health.ToString(), new Vector2(x, y), 1, Color.White, Color.Black);

                float widthHealth = fontBig.MeasureString(health.ToString()).X;

                FontHelper.DrawWithOutline(spriteBatch, fontSmall, "/" + maxHealth.ToString(), new Vector2(x + widthHealth + 5, y + 20), 1, Color.White, Color.Black);
            }
Example #8
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            foreach (var button in _buttons)
            {
                button.Draw(spriteBatch);
            }

            string text = "Number of players in lobby: " + UserCount;

            FontHelper.DrawWithOutline(spriteBatch, FontHelper.Fonts[1], text, new Vector2(TMBAW_Game.DefaultUiWidth / 2 - FontHelper.Fonts[1].MeasureString(text).X / 2, 0), 1, Color.White, Color.Black);

            for (int i = 0; i < _playerNames.Count; i++)
            {
                FontHelper.DrawWithOutline(spriteBatch, FontHelper.Fonts[1], _playerNames[i], new Vector2(20, 300 + i * 20), 1, Color.White, Color.Black);
            }
        }
Example #9
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            //spriteBatch.Draw(background, new Rectangle(0, 0, AdamGame.UserResWidth, AdamGame.UserResHeight), Color.White);

            FontHelper.DrawWithOutline(spriteBatch, _font8, TMBAW_Game.Producers, new Vector2(5, 5), 3, Color.White, Color.Black);
            FontHelper.DrawWithOutline(spriteBatch, _font8, TMBAW_Game.Version, new Vector2(5, 20), 3, Color.White, Color.Black);


            string title = "There Must Be Another Way";

            FontHelper.DrawWithOutline(spriteBatch, FontHelper.Fonts[2], title, new Vector2(TMBAW_Game.UserResWidth / 2 - FontHelper.Fonts[2].MeasureString(title).X / 2, 120), 1, Color.White, Color.DarkGray);

            switch (CurrentMenuState)
            {
            case MenuState.Main:
                _chooseLevel.Draw(spriteBatch);
                _quit.Draw(spriteBatch);
                _options.Draw(spriteBatch);
                _multiplayer.Draw(spriteBatch);
                _storyModeButton.Draw(spriteBatch);
                break;

            case MenuState.StoryMode:
                SaveSelector.Draw(spriteBatch);
                break;

            case MenuState.LevelSelector:
                _levelSelection.Draw(spriteBatch);
                break;

            case MenuState.Options:
                if (!OptionsMenu.IsActive)
                {
                    CurrentMenuState = MenuState.Main;
                }
                break;

            case MenuState.MultiplayerLobby:
                Lobby.Draw(spriteBatch);
                break;

            case MenuState.MultiplayerSession:
                _startMultiplayerGame.Draw(spriteBatch);
                _backButton.Draw(spriteBatch);
                break;
            }
        }
Example #10
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            if (OptionsMenu.IsActive)
            {
                return;
            }

            if (IsActive)
            {
                string pauseText = "Game Paused";
                FontHelper.DrawWithOutline(spriteBatch, FontHelper.Fonts[3], pauseText, new Vector2(TMBAW_Game.UserResWidth / 2 - FontHelper.Fonts[3].MeasureString(pauseText).X / 2, 75), 1, Color.White, Color.DarkGray);
                foreach (var button in _buttons)
                {
                    button.Draw(spriteBatch);
                }
            }
        }
Example #11
0
        /// <summary>
        /// Draws the debug information to the screen if debug is on.
        /// </summary>
        /// <param name="spriteBatch"></param>
        public static void Draw(SpriteBatch spriteBatch)
        {
            if (IsDebugOn)
            {
                SettingsFile settings = DataFolder.GetSettingsFile();

                _infos = new List <string>
                {
                    "There Must Be Another Way - Version " + TMBAW_Game.Version,
                    "FPS: " + TMBAW_Game.FPS + " Resolution: " + settings.ResolutionWidth + "x" + settings.ResolutionHeight,
                    "Gamestate: " + TMBAW_Game.CurrentGameState,
                    "Gamemode: " + TMBAW_Game.CurrentGameMode,
                    "Camera Position: " + TMBAW_Game.Camera.GetPosition().X + "," + TMBAW_Game.Camera.GetPosition().Y,
                    "Mouse (Game): " + InputSystem.GetMouseRectGameWorld().X + "," + InputSystem.GetMouseRectGameWorld().Y,
                    "Index of mouse: " + LevelEditor.IndexOfMouse,
                    "Tile Type: " + GameWorld.GetTile(LevelEditor.IndexOfMouse)?.Id.ToString(),
                    "Particles in use: " + ParticleSystem.GetInUseParticleCount(),
                    "Is Sprinting: " + GameWorld.GetPlayers()[0].IsRunningFast,
                    "Steam Name: " + TMBAW_Game.UserName + " ID: " + TMBAW_Game.SteamID.m_SteamID,
                    "Particle update time: " + ParticleSystem.UpdateTime + " " + String.Format("{0:0.00}", ParticleSystem.UpdateTime * 100 / GameWorld.TotalUpdateTimer.GetAverage()) + "% of update time",
                    "Particle draw time: " + ParticleSystem.DrawTime + " " + String.Format("{0:0.00}", ParticleSystem.DrawTime * 100 / GameWorld.TotalDrawTimer.GetAverage()) + "% of draw time",
                    "Tile draw time: " + GraphicsRenderer.TileDrawTimer.GetAverage() + " " + String.Format("{0:0.00}", GraphicsRenderer.TileDrawTimer.GetAverage() * 100 / GameWorld.TotalDrawTimer.GetAverage()) + "% of draw time",
                    "UI draw time: " + GraphicsRenderer.UserInterfaceDrawTimer.GetAverage() + " " + String.Format("{0:0.00}", GraphicsRenderer.UserInterfaceDrawTimer.GetAverage() * 100 / GameWorld.TotalDrawTimer.GetAverage()) + "% of draw time",
                    "Light draw time: " + GraphicsRenderer.LightDrawTimer.GetAverage() + " " + String.Format("{0:0.00}", GraphicsRenderer.LightDrawTimer.GetAverage() * 100 / GameWorld.TotalDrawTimer.GetAverage()) + "% of draw time",
                    "Total update time: " + GameWorld.TotalUpdateTimer.GetAverage(),
                    "Total draw time: " + GameWorld.TotalDrawTimer.GetAverage(),
                    "Visible tiles: " + GameWorld.ChunkManager?.GetVisibleIndexes()?.Length,
                    "Ambient Color: " + GameWorld.WorldData.SunLightColor,
                };
                spriteBatch.Draw(GameWorld.SpriteSheet, new Rectangle(0, 0, TMBAW_Game.UserResWidth, (_infos.Count) * _font.LineSpacing), new Rectangle(304, 224, 8, 8), Color.White * .6f);

                for (int i = 0; i < _infos.Count; i++)
                {
                    Point pos = new Point(0, i * _font.LineSpacing);
                    FontHelper.DrawWithOutline(spriteBatch, _font, _infos[i], pos.ToVector2(), 1, new Color(220, 220, 220), Color.Black);
                }
            }

            if (IsTyping)
            {
                spriteBatch.Draw(GameWorld.SpriteSheet, new Rectangle(0, TMBAW_Game.UserResHeight - 30, TMBAW_Game.UserResWidth, 30), new Rectangle(304, 224, 8, 8), Color.White * .6f);
                chatBox.Draw(spriteBatch);
            }
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            // Change color if it is selected.
            Color color;

            if (IsSelected)
            {
                color = Color.LightPink;
            }
            else
            {
                color = Color.White;
            }

            spriteBatch.Draw(GameWorld.UiSpriteSheet, _drawRectangle, _sourceRectangle, color);

            Vector2 namePos = new Vector2(_drawRectangle.X + _spacing, _drawRectangle.Y + _drawRectangle.Height / 2 - _nameFont.LineSpacing / 2);

            FontHelper.DrawWithOutline(spriteBatch, _nameFont, Name, namePos, 2, Color.LightGray, Color.Black);
            spriteBatch.DrawString(_infoFont, GetDate(LastModifiedDate), new Vector2(_drawRectangle.X + _drawRectangle.Width - 20 - _infoFont.MeasureString(GetDate(LastModifiedDate)).X, _drawRectangle.Y + _drawRectangle.Height / 2 - _infoFont.LineSpacing / 2), Color.Black);
        }
Example #13
0
        //public void ChooseText()
        //{
        //    switch (_randGen.Next(0, 36))
        //    {
        //        case 0:
        //            _randomText = "Hello there.";
        //            break;
        //        case 1:
        //            _randomText = "Walnuts are yummy.";
        //            break;
        //        case 2:
        //            _randomText = "Stephen smells like roses.";
        //            break;
        //        case 3:
        //            _randomText = "Salmon is a good source of protein.";
        //            break;
        //        case 4:
        //            _randomText = "Indeeeeeeeeeed.";
        //            break;
        //        case 5:
        //            _randomText = "Loading the loading screen.";
        //            break;
        //        case 6:
        //            _randomText = "Reticulating spines.";
        //            break;
        //        case 7:
        //            _randomText = "Error 404: Level not found.";
        //            break;
        //        case 8:
        //            _randomText = "You are beautiful.";
        //            break;
        //        case 9:
        //            _randomText = "Trying to find lost keys.";
        //            break;
        //        case 10:
        //            _randomText = "Deleting system memory.";
        //            break;
        //        case 11:
        //            _randomText = "Windows update incoming.";
        //            break;
        //        case 12:
        //            _randomText = "You have lost connection to the internet.";
        //            break;
        //        case 13:
        //            _randomText = "Lighting the darkness.";
        //            break;
        //        case 14:
        //            _randomText = "Moving immovable objects.";
        //            break;
        //        case 15:
        //            _randomText = "Stopping unstoppable force.";
        //            break;
        //        case 16:
        //            _randomText = "Nerfing Irelia.";
        //            break;
        //        case 17:
        //            _randomText = "Meow.";
        //            break;
        //        case 18:
        //            _randomText = "Upgrading antiviruses.";
        //            break;
        //        case 19:
        //            _randomText = "Opening Internet Explorer.";
        //            break;
        //        case 20:
        //            _randomText = "Putting out the firewall.";
        //            break;
        //        case 21:
        //            _randomText = "Giving Satan a massage.";
        //            break;
        //        case 22:
        //            _randomText = "Doing Satan's pedicure.";
        //            break;
        //        case 23:
        //            _randomText = "Far Lands or Bust!";
        //            break;
        //        case 24:
        //            _randomText = "Shaving bears.";
        //            break;
        //        case 25:
        //            _randomText = "Drinking tea.";
        //            break;
        //        case 26:
        //            _randomText = "Starting pillow fight.";
        //            break;
        //        case 27:
        //            _randomText = "Reloading the unloadable.";
        //            break;
        //        case 28:
        //            _randomText = "Checking out pictures folder.";
        //            break;
        //        case 29:
        //            _randomText = "Taking a break.";
        //            break;
        //        case 30:
        //            _randomText = "Loading assets.";
        //            break;
        //        case 31:
        //            _randomText = "Googling for solution.";
        //            break;
        //        case 32:
        //            _randomText = "Oh oh, we might blue screen!";
        //            break;
        //        case 33:
        //            _randomText = "Deleting user files.";
        //            break;
        //        case 34:
        //            _randomText = "Drinking water.";
        //            break;
        //        case 35:
        //            _randomText = "Pretending to load.";
        //            break;
        //    }
        //    _textChosen = true;
        //}


        public static void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(_background, new Rectangle(0, 0, TMBAW_Game.UserResWidth, TMBAW_Game.UserResHeight), Color.White);
            FontHelper.DrawWithOutline(spriteBatch, _fontBig, _loadingDots, new Vector2(50, TMBAW_Game.UserResHeight - 100), 3, Color.White, Color.DarkGray);
            FontHelper.DrawWithOutline(spriteBatch, _fontSmall, LoadingText, new Vector2(50, TMBAW_Game.UserResHeight - 50), 3, Color.White, Color.DarkGray);
        }