public void Draw(SpriteBatch spriteBatch) { Game1.Self.GraphicsDevice.SetRenderTarget(backRender); Game1.Self.GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); fundoGame.Draw(spriteBatch); heart.Draw(spriteBatch); spriteBatch.End(); if (decisaoDesenhada) { spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive); spriteBatch.Draw(Game1.Self.Content.Load <Texture2D>("filtro vermelho"), Vector2.Zero, Color.White * 0.5f); spriteBatch.End(); spriteBatch.Begin(); avisoFollow.Draw(spriteBatch); spriteBatch.DrawString(fontDecisao, caixaTexto.WrapText(fontDecisao, Save.textoDecisao, 700), new Vector2(130, 330), new Color(131, 255, 207) * 0.7f); spriteBatch.End(); } else { spriteBatch.Begin(); avisoReading.Draw(spriteBatch); spriteBatch.End(); } Game1.Self.GraphicsDevice.SetRenderTarget(null); Game1.Self.GraphicsDevice.Clear(Color.Black); line.Draw(spriteBatch, backRender); caixaTexto.Draw(spriteBatch); }
void InitStuff() { Items.Start(); Jobs.Start(); Dialogue.Start(); World.Start(); // Create the quest marker questMarker = Instantiate(questMarker) as GameObject; // Create the textbox textbox = Instantiate(textbox, new Vector3(4.5f, 0.5f, 0f), Quaternion.identity) as GameObject; textManager = textbox.GetComponent <Textbox>(); textManager.Draw(); // Create the inventory box inventory = Instantiate(inventory, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject; inventoryManager = inventory.GetComponent <Inventory>(); inventoryManager.Setup(); // Create the info box GameObject textContainer = new GameObject(); textContainer = Instantiate(textContainer, new Vector3(6f, 9.5f, -1f), Quaternion.identity) as GameObject; textContainer.AddComponent <TextMesh>(); Vector3 oldScale = textContainer.transform.localScale; Vector3 newScale = new Vector3(oldScale.x * .25f, oldScale.y * .25f, oldScale.z * .25f); textContainer.transform.localScale = newScale; textMesh = textContainer.GetComponent <TextMesh>(); textMesh.alignment = TextAlignment.Left; textMesh.color = Color.white; textMesh.fontSize = 20; }
internal static void Draw(SpriteBatchHolder spriteBatches) { if (enabled && visible) { //Draw the background and textbox spriteBatches[DrawModes.Gui].Draw(Assets.DummyTexture, backRect, null, Color.Black * 0.6f, 0, Vector2.Zero, SpriteEffects.None, float.Epsilon); inputBox.Draw(spriteBatches); //Draw the log for (int i = log.Count - 1; i >= 0; i--) { //Calculate the text position Vector2 linePos = new Vector2(5, inputBox.ClickRectangle.Top - inputBox.Font.LineSpacing * (log.Count - i)); //Check if the text position is above the screen if (linePos.Y < 0) { break; } //Draw the text spriteBatches[DrawModes.Gui].DrawString(inputBox.Font, log[i].Item1, linePos, log[i].Item2, 0, Vector2.Zero, 1, SpriteEffects.None, 0); } } }
internal override void Draw(GameTime gameTime) { Controller.GraphicsDevice.ResetFull(); Controller.GraphicsDevice.ClearFull(GetClearColor()); _shader.Prepare(_camera); World.Draw(_shader); _batch.Begin(samplerState: SamplerState.PointClamp); if (World.FadeAlpha > 0f) { _batch.DrawRectangle(Controller.ClientRectangle, new Color(0, 0, 0, (int)(255 * World.FadeAlpha))); } _locationSign.Draw(_batch); Textbox.Draw(_batch, Color.White); StartMenu.Draw(_batch); _encounterAnimation?.Draw(gameTime); #if DEBUG var playerPosition = World.PlayerEntity.Position; playerPosition -= World.ActiveMap.Offset; _batch.DrawText(_fontRenderer, $"X:{Math.Round(playerPosition.X, 0)}, Y:{Math.Round(playerPosition.Y, 2)}, Z:{Math.Round(playerPosition.Z, 0)}; {World.ActiveMap.MapFile}", Vector2.Zero, Color.White); #endif _batch.End(); }
private void DrawInfoPage(int startX, int unit, int width) { // switch button var switchButtonX = (int)(startX + width - _switchButton.Width * Border.SCALE); _batch.Draw(_switchButton, new Rectangle( switchButtonX, 0, (int)(_switchButton.Width * Border.SCALE), (int)(_switchButton.Height * Border.SCALE)), Color.White); _fontRenderer.DrawText(_batch, "SWITCH>", new Vector2(switchButtonX + unit, unit), Color.Black, Border.SCALE); // time/date info _batch.Draw(_timeBox, new Rectangle( startX + unit * 2, unit * 4, (int)(_timeBox.Width * Border.SCALE), (int)(_timeBox.Height * Border.SCALE)), Color.White); var dateTime = DateTime.Now; var time = DateHelper.GetAmPmTime(dateTime); if (time.StartsWith("0")) { time = " " + time.Remove(0, 1); } _fontRenderer.DrawText(_batch, DateHelper.GetDisplayDayOfWeek(dateTime).ToUpper() + Environment.NewLine + time, new Vector2(startX + unit * 6, unit * 6), Color.Black, Border.SCALE); _exitTextbox.Draw(_batch, TINTED_WHITE); }
// Initializes the game void InitGame() { Items.Start(); Jobs.Start(); Dialogue.Start(); // Draw the textbox textbox = Instantiate(textbox, new Vector3(4.5f, 0.5f, 0f), Quaternion.identity) as GameObject; textManager = textbox.GetComponent<Textbox>(); textManager.Draw(); // Create the map map = Instantiate(map, new Vector3(5.5f, 5.5f, 0), Quaternion.identity) as GameObject; mapManager = map.GetComponent<MapManager>(); mapManager.textbox = textManager; mapManager.SetupScene(); // Where are we on the map? int mapX = Random.Range(0, 10); int mapY = Random.Range(0, 10); Vector3 tile = mapManager.map[mapX][mapY].EmptyLocation(); while (tile.x == -1) tile = mapManager.map[mapX][mapY].EmptyLocation(); // Create the player player = Instantiate(player, new Vector3(tile.x, tile.y, 10f), Quaternion.identity) as GameObject; playerManager = player.GetComponent<Player>(); playerManager.map = mapManager; playerManager.textbox = textManager; playerManager.PlaceAt(mapX, mapY, (int)tile.x, (int)tile.y, (int)(10 - tile.y)); // Draw our area on the map mapManager.player = playerManager; mapManager.Draw(playerManager.mapX, playerManager.mapY); }
public void DrawTextbox(SpriteBatch sbatch) { box.DrawC(sbatch, Color.White); Save.Draw(sbatch); Back.Draw(sbatch); Textbox.Draw(sbatch); sbatch.DrawString(Font, Name, namePos, Color.Black); }
private void DrawPhonePage(int startX, int unit, int width) { // background _batch.Draw(_phoneBackground, new Rectangle( startX, 0, (int)(_phoneBackground.Width * Border.SCALE), (int)(_phoneBackground.Height * Border.SCALE)), Color.White); // reception // TODO: get reception from map file var hasReception = true; _batch.Draw(_reception, new Rectangle( startX + width - unit * 3, unit, (int)(16 * Border.SCALE), (int)(16 * Border.SCALE)), new Rectangle(hasReception ? 0 : 16, 0, 16, 16), Color.White); // contacts var visibleContacts = new Contact[CONTACTS_VISIBLE]; var contacts = Controller.ActivePlayer.Contacts; for (var i = 0; i < visibleContacts.Length; i++) { var index = i + _phoneScroll; if (contacts.Length > index) { visibleContacts[i] = _phonebook.GetContact(contacts[index]); } else { visibleContacts[i] = _emptyContact; } } var contactsText = string.Join(Environment.NewLine, visibleContacts.Select((c, i) => { var selector = ">"; if (_phoneOptionsBox.Visible || _deleteNumberOptionsBox.Visible) { selector = "^>>"; } return ((_phoneIndex == i ? selector : " ") + c.name + ":" + Environment.NewLine + " " + c.title); })); _contactsFontRenderer.DrawText(_batch, contactsText, new Vector2(startX + unit, unit * 4), Color.Black, Border.SCALE); _phoneOptionsBox.Draw(_batch, TINTED_WHITE); _deleteNumberOptionsBox.Draw(_batch, TINTED_WHITE); _phoneTextbox.Draw(_batch, TINTED_WHITE); }
public void Render() { BaseGame.Device.Clear(Color.LightSkyBlue); spriteBatch = (SpriteBatch)BaseGame.SpriteMgr.alphaSprite; spriteBatch.Draw(bgTexture, Vector2.Zero, bgRect, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, LayerDepth.BackGround); spriteBatch.Draw(npTexture, new Vector2(230, 401), new Rectangle(0, 0, 88, 46), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f); namebox.Draw(BaseGame.SpriteMgr.alphaSprite, 1); passbox.Draw(BaseGame.SpriteMgr.alphaSprite, 1); btnLogin.Draw(BaseGame.SpriteMgr.alphaSprite, 1); btnClear.Draw(BaseGame.SpriteMgr.alphaSprite, 1); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); _textbox.Draw(_batch, Border.DefaultWhite); _optionsBox.Draw(_batch, Border.DefaultWhite); _confirmationBox.Draw(_batch, Border.DefaultWhite); _batch.End(); }
internal override void Draw(GameTime gameTime) { _batch.Begin(samplerState: SamplerState.PointClamp); var backgroundColor = (int)(Border.DefaultWhite.R * _brightness); _batch.DrawRectangle(Controller.ClientRectangle, new Color(backgroundColor, backgroundColor, backgroundColor)); _textbox.Draw(_batch, Border.DefaultWhite); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); var startY = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2; if (_oakStage >= 0 && _oakStage < OAK_TOTAL_STAGES) { var oakWidth = (int)(40 * Border.SCALE); var oakHeight = (int)(56 * Border.SCALE); _batch.Draw(_oak, new Rectangle(Controller.ClientRectangle.Width / 2 - oakWidth / 2, startY + unit * 4, oakWidth, oakHeight), new Rectangle(_oakStage * 40, 0, 40, 56), Color.White); } if (_playerStage >= 0 && _playerStage < PLAYER_TOTAL_STAGES) { var playerWidth = (int)(40 * Border.SCALE); var playerHeight = (int)(56 * Border.SCALE); _batch.Draw(_player, new Rectangle(Controller.ClientRectangle.Width / 2 - playerWidth / 2 + (int)(_playerOffset * Border.SCALE), startY + unit * 4, playerWidth, playerHeight), new Rectangle(_playerStage * 40, 0, 40, 56), Color.White); } if (_pokemonVisible && _pokemonAppearDelay == 0) { var texture = _previewPokemon.GetFrontSprite(); var pokemonWidth = (int)(texture.Width * Border.SCALE); var pokemonHeight = (int)(texture.Height * Border.SCALE); var alpha = (int)(255 * _pokemonAlpha); _batch.Draw(texture, new Rectangle(Controller.ClientRectangle.Width / 2 - pokemonWidth / 2, startY + unit * 4, pokemonWidth, pokemonHeight), null, new Color(255, 255, 255, alpha), 0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f); } _nameSelection.Draw(_batch, Border.DefaultWhite); if (_nameSelection.Visible) { Border.DrawCenter(_batch, _nameSelection.OffsetX + unit * 2, startY, 4, 1, Border.SCALE); _fontRenderer.DrawText(_batch, "NAME", new Vector2(_nameSelection.OffsetX + unit * 2, startY), Color.Black, Border.SCALE); } _batch.End(); }
public override void draw(SpriteBatch spriteBatch) { Game1.Self.GraphicsDevice.SetRenderTarget(backRender); Game1.Self.GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); fundo.Draw(spriteBatch); if (coracaoDesenhado) { heart.Draw(spriteBatch); } spriteBatch.DrawString(font, "Press Space to Skip", new Vector2(694, 666), new Color(131, 255, 207) * 0.5f); if (fraseAtual == 9) { if (heart.decayFactor == 1) { spriteBatch.DrawString(fontDecisao, caixaTexto.WrapText(fontDecisao, "Do you understand that?", 800), new Vector2(130, 320), new Color(131, 255, 207) * 0.7f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive); spriteBatch.Draw(Game1.Self.Content.Load <Texture2D>("filtro vermelho"), Vector2.Zero, Color.White * 0.5f); spriteBatch.End(); spriteBatch.Begin(); } if (textoLido == false) { avisoReading.Draw(spriteBatch); } else { avisoFollow.Draw(spriteBatch); } } spriteBatch.End(); Game1.Self.GraphicsDevice.SetRenderTarget(null); Game1.Self.GraphicsDevice.Clear(Color.Black); line.Draw(spriteBatch, backRender); caixaTexto.Draw(spriteBatch); }
public void Draw(SpriteBatch spriteBatch) { _mainMenuBackground.Draw(spriteBatch); _play.Draw(spriteBatch); _exit.Draw(spriteBatch); _userName.Draw(spriteBatch); _password.Draw(spriteBatch); _server.Draw(spriteBatch); _logo.Draw(spriteBatch); _zoom += 0.03f; spriteBatch.DrawString(_normalFont, "Not finished yet!", new Vector2(950, 250), Color.Yellow, -0.3f, new Vector2(100, 30), 1.5f + (float)Math.Abs(Math.Sin(_zoom)) / 2, SpriteEffects.None, 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 override void Draw(SharpDL.GameTime gameTime, Renderer renderer) { base.Draw(gameTime, renderer); for (int x = 0; x <= MainGame.SCREEN_WIDTH_LOGICAL / textureBackgroundTile.Width; x++) { for (int y = 0; y <= MainGame.SCREEN_HEIGHT_LOGICAL / textureBackgroundTile.Height; y++) { textureBackgroundTile.Draw(x * textureBackgroundTile.Width, y * textureBackgroundTile.Height); } } if (CurrentSelectState == ScenarioSelectState.FirstScreen) { iconFrame.Draw(gameTime, renderer); if (iconActiveOverview != null) { iconActiveOverview.Draw(gameTime, renderer); } if (labelActiveOverview != null) { labelActiveOverview.Draw(gameTime, renderer); } foreach (var scenarioItem in GetScenarioItemsOnPage(currentPageNumber)) { scenarioItem.Draw(gameTime, renderer); } } else if (CurrentSelectState == ScenarioSelectState.SecondScreen) { iconFrameInputNames.Draw(gameTime, renderer); textboxInputCompanyName.Draw(gameTime, renderer); textboxInputPlayerName.Draw(gameTime, renderer); labelInputCompanyName.Draw(gameTime, renderer); labelInputPlayerName.Draw(gameTime, renderer); } labelTitle.Draw(gameTime, renderer); buttonSelect.Draw(gameTime, renderer); buttonBack.Draw(gameTime, renderer); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); // draw stats var unit = (int)(Border.UNIT * Border.SCALE); var startX = (int)(Controller.ClientRectangle.Width / 2f + (-Border.SCREEN_WIDTH / 2f + 4) * unit); Border.Draw(_batch, startX, 0, 16, 10, Border.SCALE); _fontRenderer.DrawText(_batch, _infoText, new Vector2(startX + unit, unit * 2), Color.Black, Border.SCALE); _textbox.Draw(_batch, Border.DefaultWhite); _optionsBox.Draw(_batch, Border.DefaultWhite); _batch.End(); }
// Initializes the game void InitGame() { Items.Start(); Jobs.Start(); Dialogue.Start(); // Draw the textbox textbox = Instantiate(textbox, new Vector3(4.5f, 0.5f, 0f), Quaternion.identity) as GameObject; textManager = textbox.GetComponent <Textbox>(); textManager.Draw(); // Create the map map = Instantiate(map, new Vector3(5.5f, 5.5f, 0), Quaternion.identity) as GameObject; mapManager = map.GetComponent <MapManager>(); mapManager.textbox = textManager; mapManager.SetupScene(); // Where are we on the map? int mapX = Random.Range(0, 10); int mapY = Random.Range(0, 10); Vector3 tile = mapManager.map[mapX][mapY].EmptyLocation(); while (tile.x == -1) { tile = mapManager.map[mapX][mapY].EmptyLocation(); } // Create the player player = Instantiate(player, new Vector3(tile.x, tile.y, 10f), Quaternion.identity) as GameObject; playerManager = player.GetComponent <Player>(); playerManager.map = mapManager; playerManager.textbox = textManager; playerManager.PlaceAt(mapX, mapY, (int)tile.x, (int)tile.y, (int)(10 - tile.y)); // Draw our area on the map mapManager.player = playerManager; mapManager.Draw(playerManager.mapX, playerManager.mapY); }
internal override void Draw(GameTime gameTime) { // clear backbuffer Controller.GraphicsDevice.Clear(BACKGROUND_COLOR); var previousTargets = Controller.GraphicsDevice.GetRenderTargets(); RenderTargetManager.BeginRenderToTarget(_sceneTarget); Controller.GraphicsDevice.Clear(BACKGROUND_COLOR); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // draw empty box at bottom of the screen Border.Draw(_batch, startX, StartY + unit * 12, Border.SCREEN_WIDTH, 6, Border.SCALE); DrawScreen(gameTime); // status _enemyPokemonStatus.Draw(_batch); _playerPokemonStatus.Draw(_batch); _playerStatus.Draw(_batch); _pokemonStats.Draw(_batch); // battle messages _battleTextbox.Draw(_batch, Border.DefaultWhite); // main menu if (_menuState == BattleMenuState.Main) { Border.Draw(_batch, startX + unit * 8, StartY + unit * 12, 12, 6, Border.SCALE); var menuStr = ""; for (var i = 0; i < MENU_OPTIONS.Length; i++) { if (i == _mainMenuIndex) { menuStr += ">"; } else { menuStr += " "; } menuStr += MENU_OPTIONS[i].PadRight(5); if (i == 1) { menuStr += "\n"; } } _fontRenderer.LineGap = 1; _fontRenderer.DrawText(_batch, menuStr, new Vector2(startX + unit * 9, StartY + unit * 14), Color.Black, Border.SCALE); } else if (_menuState == BattleMenuState.Fight) { Border.Draw(_batch, startX + unit * 4, StartY + unit * 12, 16, 6, Border.SCALE); // move list var pokemon = Battle.ActiveBattle.PlayerPokemon.Pokemon; var moveListStr = ""; for (var i = 0; i < Pokemon.MAX_MOVES; i++) { if (i == _moveMenuIndex) { moveListStr += ">"; } else { moveListStr += " "; } if (pokemon.Moves.Length > i) { moveListStr += pokemon.Moves[i].name; } else { moveListStr += "-"; } moveListStr += "\n"; } _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, moveListStr, new Vector2(startX + unit * 5, StartY + unit * 13), Color.Black, Border.SCALE); // move info Border.Draw(_batch, startX, StartY + unit * 8, 11, 5, Border.SCALE); var selectedMove = pokemon.Moves[_moveMenuIndex]; // disabled? if (Battle.ActiveBattle.PlayerPokemon.DisabledMove == selectedMove && Battle.ActiveBattle.PlayerPokemon.DisabledTurns > 0) { _fontRenderer.DrawText(_batch, "Disabled!", new Vector2(startX + unit, StartY + unit * 10), Color.Black, Border.SCALE); } else { _fontRenderer.DrawText(_batch, "TYPE/\n" + " " + selectedMove.GetMove().Type.ToString().ToUpper() + "\n" + new string(' ', 4) + selectedMove.pp.ToString().PadLeft(2) + "/" + selectedMove.maxPP.ToString().PadLeft(2), new Vector2(startX + unit, StartY + unit * 9), Color.Black, Border.SCALE); } } // animations lock (_animations) { foreach (var animation in _animations) { if (!animation.IsFinished) { animation.Draw(_batch); } } } _batch.End(); Controller.GraphicsDevice.SetRenderTargets(previousTargets); if (_invertColors) { _batch.Begin(samplerState: SamplerState.PointClamp, blendState: INVERT_COLORS_BLENDSTATE, effect: _screenEffect); } else { _batch.Begin(samplerState: SamplerState.PointClamp, effect: _screenEffect); } var color = Color.White; if (_fadeOut) { color = new Color(255, 255, 255, (int)(255 * (1f - _fadeOutProgress))); } _batch.Draw(_sceneTarget, _screenOffset, color); _batch.End(); }
protected override void DrawScreen(GameTime gameTime) { var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // wild pokemon if (_enemyPokemonVisible && _enemyPokemonSize > 0f) { var characterAlpha = (int)((_introProgress * 2) * 255); if (characterAlpha > 255) { characterAlpha = 255; } var pokemon = Battle.ActiveBattle.EnemyPokemon.Pokemon; Texture2D sprite; if (_introProgress < 1f) { sprite = PokemonTextureManager.GetFront(pokemon.Id, WILD_POKEMON_INTRO_PALETTE, pokemon.UnownLetter); } else { if (_enemyPokemonPalette == null) { sprite = pokemon.GetFrontSprite(); } else { sprite = pokemon.GetFrontSprite(_enemyPokemonPalette); } } var pokemonTargetX = startX + unit * 12; var pokemonStartX = -width - unit * 4; var pokemonX = (int)(pokemonTargetX + (pokemonStartX * (1f - _introProgress))); var offset = _enemyPokemonOffset; var spriteX = (int)(pokemonX + offset.X * Border.SCALE); var spriteY = (int)(StartY + offset.Y * Border.SCALE); var spriteRectangle = sprite.Bounds; var spriteHeight = (int)(sprite.Height * Border.SCALE); if (offset.Y > 0) { spriteRectangle.Height -= (int)offset.Y; spriteHeight -= (int)(offset.Y * Border.SCALE); } _batch.Draw(sprite, new Rectangle(spriteX, spriteY, (int)(sprite.Width * Border.SCALE), spriteHeight), spriteRectangle, new Color(_enemyPokemonColor.R, _enemyPokemonColor.G, _enemyPokemonColor.B, characterAlpha)); } // player intro/outro if (_playerOutroProgress < 1f) { int characterAlpha; int playerX; if (_playerOutroStarted) { var playerTargetX = unit * 10; var playerStartX = startX + unit; playerX = (int)(playerStartX - (playerTargetX * _playerOutroProgress)); characterAlpha = (int)(((1f - _playerOutroProgress) * 2) * 255); } else { var playerTargetX = startX + unit; var playerStartX = width + unit * 4; playerX = (int)(playerTargetX + (playerStartX * (1f - _introProgress))); characterAlpha = (int)((_introProgress * 2) * 255); } if (characterAlpha > 255) { characterAlpha = 255; } var playerTextureX = _introProgress < 1f ? 1 : 0; _batch.Draw(_player, new Rectangle(playerX, StartY + unit * 5, (int)(_player.Width / 2f * Border.SCALE), (int)(_player.Height * Border.SCALE)), new Rectangle(playerTextureX * 56, 0, 56, 56), new Color(255, 255, 255, characterAlpha)); } // player pokemon if (_playerPokemonVisible && _playerPokemonSize > 0f) { Texture2D sprite; if (_playerPokemonPalette == null) { sprite = Battle.ActiveBattle.PlayerPokemon.Pokemon.GetBackSprite(); } else { sprite = Battle.ActiveBattle.PlayerPokemon.Pokemon.GetBackSprite(_playerPokemonPalette); } var spriteWidth = (int)((int)(sprite.Width * _playerPokemonSize) * Border.SCALE); var spriteHeight = spriteWidth; var spriteColor = new Color(_playerPokemonColor.R, (int)(_playerPokemonColor.G * _playerPokemonSize), (int)(_playerPokemonColor.B * _playerPokemonSize)); var offset = _playerPokemonOffset; var spriteX = (int)(startX + unit * 2 + sprite.Width * Border.SCALE / 2f - spriteWidth / 2f + offset.X); var spriteY = (int)(StartY + unit * 5 + (sprite.Height * Border.SCALE - spriteHeight) + offset.Y * Border.SCALE); var spriteRectangle = sprite.Bounds; if (offset.Y > 0) { spriteRectangle.Height -= (int)offset.Y; spriteHeight -= (int)(offset.Y * Border.SCALE); } _batch.Draw(sprite, new Rectangle(spriteX, spriteY, spriteWidth, spriteHeight), spriteRectangle, spriteColor); } _textbox.Draw(_batch, Border.DefaultWhite); }
public void Draw(SpriteBatch spriteBatch) { //spriteBatch.Draw(ContentChest.Instance.whitePixel, rect, Color.White); textBox.Draw(spriteBatch); }
protected override void Draw(GameTime gameTime) { Color clrFluttershy = Color.FromNonPremultiplied(248, 247, 152, 255); GraphicsDevice.Clear(Color.White);//248,247,152 Color clrPink = Color.FromNonPremultiplied(248, 185, 206, 255); Color clrButterscotch = Color.FromNonPremultiplied(226, 187, 50, 255); spriteBatch.Begin(); // Console output Primitives.DrawAndFillRectangle(rectConsoleTop, clrFluttershy, Color.Black, 2); for (int i = 0; i < ConsoleMaxLines; i++) { int lineID = i + ConsoleOutputCurrentLine; if (lineID >= Session.ConsoleTotalLines) { break; } Primitives.DrawSingleLineText(Session.ConsoleOutput[lineID], new Vector2(rectConsoleTopInner.X, rectConsoleTopInner.Y + Library.FontConsoleNormal.LineSpacing * i), lineID < GreyOutputUntil ? Color.Black.Alpha(50) : Color.Black, null, 1); } // Inputbox Primitives.DrawAndFillRectangle(rectInputLine, clrFluttershy, Color.Black, 2); InputTextBox.Draw(); // Suggestions Primitives.DrawAndFillRectangle(rectSuggestions, clrFluttershy, Color.Black, 2); List <Command> suggestions = CurrentSuggestions; int lnSpacing = Library.FontConsoleNormal.LineSpacing + 2; maxsuggestioncount = rectSuggestions.Height / lnSpacing; if (ChosenSuggestion < 0) { ChosenSuggestion = maxsuggestioncount - 1; } if (ChosenSuggestion > maxsuggestioncount - 1) { ChosenSuggestion = 0; } for (int i = 0; i < maxsuggestioncount; i++) { if (suggestions.Count <= i) { break; } Command c = suggestions[i]; Rectangle rectSuggestion = new Rectangle(rectSuggestions.X + 3, rectSuggestions.Y + 2 + i * lnSpacing, rectSuggestions.Width - 6, lnSpacing); Primitives.DrawSingleLineText(c.TotalString, new Vector2(rectSuggestion.X + 5, rectSuggestion.Y + 1), Color.Black); if (ChosenSuggestion == i) { Primitives.FillRectangle(rectSuggestion, clrPink); Primitives.DrawSingleLineText(c.TotalString, new Vector2(rectSuggestion.X + 5, rectSuggestion.Y + 1), Color.Black); } } if (maxsuggestioncount < suggestions.Count) { Primitives.DrawSingleLineText((suggestions.Count - maxsuggestioncount) + " more suggestions are hidden", new Vector2(rectSuggestions.X + rectSuggestions.Width - 8 - Library.FontConsoleNormal.MeasureString((suggestions.Count - maxsuggestioncount) + " more suggestions are hidden").X, rectSuggestions.Y + rectSuggestions.Height - lnSpacing), Color.Black); } // Fluttershy Primitives.DrawAndFillRectangle(rectRecommendedCommands, clrFluttershy, Color.Black, 2); Primitives.DrawImage(ImageFluttershy, new Rectangle(rectRecommendedCommands.X + 5, rectRecommendedCommands.Y + 5, rectRecommendedCommands.Width - 10, rectRecommendedCommands.Height - 10), Color.White, true, true, Color.Transparent); Root.Draw(gameTime); spriteBatch.End(); base.Draw(gameTime); }
public override void Draw() { base.Draw(); _txtInput.Draw(); }
public void Draw(SpriteBatch spriteBatch, GameTime gameTime) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Resolution.ScaleMatrix); menuBackground.Draw(spriteBatch); //spriteBatch.Draw(ContentChest.Instance.menuMars, new Rectangle(Resolution.GameWidth / 2, // Resolution.GameHeight / 2, ContentChest.Instance.menuMars.Width, ContentChest.Instance.menuMars.Height), null, Color.White, rotation, new Vector2(ContentChest.Instance.menuMars.Width / 2, ContentChest.Instance.menuMars.Height / 2), SpriteEffects.None, 0); if (currentMenu == MenuTag.MAIN) { spriteBatch.DrawString(ContentChest.Instance.menuTitleFont, menuTitle, new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuTitleFont.MeasureString(menuTitle).X / 2, Resolution.GameHeight / 2 - ContentChest.Instance.menuTitleFont.MeasureString(menuTitle).Y / 2 - 100), Color.White); spriteBatch.DrawString(ContentChest.Instance.menuMottoFont, menuMotto, new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuMottoFont.MeasureString(menuMotto).X / 2, Resolution.GameHeight / 2 - 55), Color.White); foreach (Button button in menuButtons) { button.Draw(spriteBatch); } } else if (currentMenu == MenuTag.OPTIONS) { spriteBatch.DrawString(ContentChest.Instance.menuFont, "Music Volume", new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuFont.MeasureString("Music Volume").X / 2, Resolution.GameHeight / 2 - ContentChest.Instance.menuFont.MeasureString("Music Volume").Y / 2 - 200), optionsButtons[0].GetColor()); spriteBatch.DrawString(ContentChest.Instance.menuFont, "" + Convert.ToInt32(game.gameOptions.MUSIC_VOLUME * 100), new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuFont.MeasureString("" + Convert.ToInt32(game.gameOptions.MUSIC_VOLUME * 100)).X / 2, optionsButtons[1].GetBounds().Y), optionsButtons[0].GetColor()); spriteBatch.DrawString(ContentChest.Instance.menuFont, "Effect Volume", new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuFont.MeasureString("Effect Volume").X / 2, Resolution.GameHeight / 2 - ContentChest.Instance.menuFont.MeasureString("Effect Volume").Y / 2 - 100), optionsButtons[0].GetColor()); spriteBatch.DrawString(ContentChest.Instance.menuFont, "" + Convert.ToInt32(game.gameOptions.EFFECT_VOLUME * 100), new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuFont.MeasureString("" + Convert.ToInt32(game.gameOptions.EFFECT_VOLUME * 100)).X / 2, optionsButtons[3].GetBounds().Y), optionsButtons[0].GetColor()); spriteBatch.DrawString(ContentChest.Instance.menuFont, "Resolution", new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuFont.MeasureString("Resolution").X / 2, Resolution.GameHeight / 2 - ContentChest.Instance.menuFont.MeasureString("Resolution").Y / 2), optionsButtons[0].GetColor()); spriteBatch.DrawString(ContentChest.Instance.menuFont, currentResolution, new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuFont.MeasureString(currentResolution).X / 2, optionsButtons[5].GetBounds().Y), optionsButtons[0].GetColor()); foreach (Button button in optionsButtons) { button.Draw(spriteBatch); } } else if (currentMenu == MenuTag.LOGIN) { spriteBatch.DrawString(ContentChest.Instance.menuTitleFont, menuTitle, new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuTitleFont.MeasureString(menuTitle).X / 2, Resolution.GameHeight / 2 - ContentChest.Instance.menuTitleFont.MeasureString(menuTitle).Y / 2 - 100), Color.White); userNameBox.Draw(spriteBatch); passWordBox.Draw(spriteBatch); foreach (Button button in loginMenu) { button.Draw(spriteBatch); } spriteBatch.DrawString(ContentChest.Instance.tinyFont, errorText, new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.tinyFont.MeasureString(errorText).X / 2, Resolution.GameHeight - ContentChest.Instance.tinyFont.MeasureString(errorText).Y - 80), Color.Red); } else if (currentMenu == MenuTag.SERVERBROWSER) { serverBrowser.Draw(spriteBatch); foreach (Button button in serverBrowserButtons) { button.Draw(spriteBatch); } } else if (currentMenu == MenuTag.CHARACTERCREATION) { foreach (Button button in characterCreationButtons) { button.Draw(spriteBatch); } Rectangle screenCenter = new Rectangle(Resolution.GameWidth / 2 - 64, Resolution.GameHeight / 2 - 64, 128, 128); Vector2 textPos = new Vector2(); Rectangle spritePos = new Rectangle(); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, null, null, null, Resolution.ScaleMatrix); textArea.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Resolution.ScaleMatrix); textPos = new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.menuTitleFont.MeasureString(selectedClass).X / 2, screenCenter.Y - 256); spritePos = new Rectangle((int)(Resolution.GameWidth / 2 - GameConstants.PLAYER_WIDTH / 2), screenCenter.Y - GameConstants.PLAYER_HEIGHT / 2, GameConstants.PLAYER_WIDTH, GameConstants.PLAYER_HEIGHT); spriteBatch.DrawString(ContentChest.Instance.menuTitleFont, selectedClass, textPos, Color.White); anim = ContentChest.Instance.characterAnimations[selectedClass + "walkDown"]; anim.Draw(spriteBatch, new Vector2(spritePos.X, spritePos.Y)); } spriteBatch.DrawString(ContentChest.Instance.tinyFont, companyName, new Vector2(Resolution.GameWidth / 2 - ContentChest.Instance.tinyFont.MeasureString(companyName).X / 2, Resolution.GameHeight - ContentChest.Instance.tinyFont.MeasureString(companyName).Y - 10), Color.White); spriteBatch.End(); }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // item box Border.Draw(_batch, startX, 0, Border.SCREEN_WIDTH, 12, Border.SCALE); // item list var visibleItems = _items .Skip(_scrollIndex) .Take(ITEMS_VISIBLE) .Select(i => { if (i is MachineItem machine) { return(machine.MachineItemName); } else { return(i.Name); } }).ToList(); if (visibleItems.Count < ITEMS_VISIBLE) { visibleItems.Add("CANCEL"); } var itemListText = ""; for (var i = 0; i < visibleItems.Count; i++) { if (i == _index) { if (DialogVisible) { itemListText += "^>>"; } else { itemListText += ">"; } } else { itemListText += " "; } var itemIndex = i + _scrollIndex; if (_items.Length <= itemIndex || !_items[itemIndex].IsQuantifyable) { itemListText += visibleItems[i] + NewLine; } else { var item = _items[itemIndex]; itemListText += visibleItems[i] + NewLine + new string(' ', 10) + "*" + item.Amount.ToString().PadLeft(2); } itemListText += NewLine; } _fontRenderer.LineGap = 0; _fontRenderer.DrawText(_batch, itemListText, new Vector2(startX + unit * 4, unit * 2), Color.Black, Border.SCALE); // up/down arrows if (_scrollIndex > 0) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit, unit, unit), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f); } if (_scrollIndex < _items.Length - ITEMS_VISIBLE + 1) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit * 10, unit, unit), Color.White); } // item description Border.Draw(_batch, startX, unit * 12, Border.SCREEN_WIDTH, 6, Border.SCALE); if (_items.Length > _index + _scrollIndex) { var description = _items[_index + _scrollIndex].Description; _fontRenderer.LineGap = 1; _fontRenderer.DrawText(_batch, description, new Vector2(startX + unit, unit * 14), Color.Black, Border.SCALE); } _textbox.Draw(_batch, Border.DefaultWhite); _optionsBox.Draw(_batch, Border.DefaultWhite); _amountSelector.Draw(_batch, Border.DefaultWhite); _batch.End(); }
void InitStuff() { Items.Start(); Jobs.Start(); Dialogue.Start(); World.Start(); // Create the quest marker questMarker = Instantiate(questMarker) as GameObject; // Create the textbox textbox = Instantiate(textbox, new Vector3(4.5f, 0.5f, 0f), Quaternion.identity) as GameObject; textManager = textbox.GetComponent<Textbox>(); textManager.Draw(); // Create the inventory box inventory = Instantiate(inventory, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject; inventoryManager = inventory.GetComponent<Inventory>(); inventoryManager.Setup(); // Create the info box GameObject textContainer = new GameObject(); textContainer = Instantiate(textContainer, new Vector3(6f, 9.5f, -1f), Quaternion.identity) as GameObject; textContainer.AddComponent<TextMesh>(); Vector3 oldScale = textContainer.transform.localScale; Vector3 newScale = new Vector3(oldScale.x * .25f, oldScale.y * .25f, oldScale.z * .25f); textContainer.transform.localScale = newScale; textMesh = textContainer.GetComponent<TextMesh>(); textMesh.alignment = TextAlignment.Left; textMesh.color = Color.white; textMesh.fontSize = 20; }
internal override void Draw(GameTime gameTime) { _preScreen.Draw(gameTime); _batch.Begin(samplerState: SamplerState.PointClamp); var(unit, startX, width, height) = Border.GetDefaultScreenValues(); // border Border.Draw(_batch, startX + unit * 7, 0, 13, 12, Border.SCALE); // mail list var visibleMails = _mails .Skip(_scrollIndex) .Take(MAILS_VISIBLE) .Select(m => m.Author) .ToList(); if (visibleMails.Count < MAILS_VISIBLE) { visibleMails.Add("CANCEL"); } var listText = ""; for (var i = 0; i < visibleMails.Count; i++) { if (i == _index) { if (DialogVisible) { listText += "^>>"; } else { listText += ">"; } } else { listText += " "; } listText += visibleMails[i] + NewLine; } _fontRenderer.DrawText(_batch, listText, new Vector2(startX + unit * 8, unit * 2), Color.Black, Border.SCALE); // up/down arrows if (_scrollIndex > 0) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit, unit, unit), null, Color.White, 0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f); } if (_scrollIndex < _mails.Length - MAILS_VISIBLE + 1) { _batch.Draw(_arrow, new Rectangle(startX + unit * 18, unit * 10, unit, unit), Color.White); } _textbox.Draw(_batch, Border.DefaultWhite); _optionsBox.Draw(_batch, Border.DefaultWhite); _confirmationBox.Draw(_batch, Border.DefaultWhite); _batch.End(); }
public override void Draw(CompactGraphics g) { frame.Draw(g); text.Draw(g); }
public override void Draw(SpriteBatch spritebatch) { name.Draw(spritebatch); base.Draw(spritebatch); }