public void Draw() { SpriteRender.ResetView(800, 600); SpriteRender.DrawRect(10, 10, 0.0f, healthBarWidth, 15, Color4.DarkRed); SpriteRender.DrawRect(10, 10, 0.0f, (health / 100) * healthBarWidth, 15, Color4.Red); if (score != 0) { TextRender.Draw(350f, 10f, 0.0f, score.ToString(), Fonts.Standard, Color4.White, 2f); } TextRender.Draw(500f, 10f, 0.0f, lives + "", Fonts.Standard, Color4.Yellow, 2f); TextRender.Draw(550f, 10f, 0.0f, tokens + "", Fonts.Standard, Color4.Yellow, 2f); if ((int)(inventory & InventoryItem.Key1) > 0) { SpriteRender.Draw(170, 5, 0, 20, 20, Textures.Key); } if ((int)(inventory & InventoryItem.Key2) > 0) { SpriteRender.Draw(200, 5, 0, 20, 20, Textures.Key); } if ((int)(inventory & InventoryItem.Key3) > 0) { SpriteRender.Draw(230, 5, 0, 20, 20, Textures.Key); } if ((int)(inventory & InventoryItem.Key4) > 0) { SpriteRender.Draw(260, 5, 0, 20, 20, Textures.Key); } }
public void Draw(SpriteRender spriteRender) { foreach (IItem item in this.Items.Values) { spriteRender.Draw(item.ItemFrame, item.Position); } }
public virtual void Draw(GameTime gameTime) { foreach (MapTile tile in DrawnMap) { MapRender.Draw( MapSpriteSheet.Sprite(CharToTile[tile.ModelChar]), tile.Position, 0.1f, Color.White, 0, 1, SpriteEffects.None); } foreach (MapTile tile in DrawnMap) { if (tile.IsCollidable) { if (DebugConstants.ShowBoundingBoxes) { BoundingBoxHelper.DrawRectangle(tile.BoundingBox, GlobalAssets.BBoxOutline, Color.White, MapBatch, false, 1); } if ((tile.IsBeingCollided || tile.IsBeingStoodOn) && DebugConstants.ShowCollisionOverlays) { BoundingBoxHelper.DrawRectangle(tile.BoundingBox, GlobalAssets.CollisionOverlay, Color.White, MapBatch, true, 1); } } } }
public void Draw(GameTime gameTime, Entity entity) { var currentFrame = Animation.GetCurrentFrame(); _spriteRender.Draw( currentFrame.SpriteFrame, Position); }
public override void Draw() { if (this.Dead || this.Texture == null) { return; } SpriteRender.Draw(this.X, this.Y, this.Z, this.Width, this.Height, this.Texture, Color, 1.0, false, false); }
public static void DrawMainMenu(SpriteRender spriteRender, List <Button> menu) { foreach (Button button in menu) { if (button.SpriteFrame != null) { spriteRender.Draw(button.SpriteFrame, button.Pos); } } }
public static void DrawMenu(SpriteRender spriteRender, List <Button> menu, SpriteBatch spriteBatch, Actions mouseAction) { foreach (UIElement ui in uiElements) { if (ui != null) { if (ui.Type == UIElement.ElementType.Resources) { spriteRender.Draw(ui.SpriteFrame, ui.Pos); spriteBatch.DrawString(font, ui.TextTop, new Vector2(ui.Pos.X + (ui.Resource1 != UIElement.Resource.Population && ui.Resource1 != UIElement.Resource.Workers ? 33 : 0), ui.Pos.Y + 4), Color.White); spriteBatch.DrawString(font, ui.TextBottom, new Vector2(ui.Pos.X + (ui.Resource1 != UIElement.Resource.Population && ui.Resource1 != UIElement.Resource.Workers ? 33 : 0), ui.Pos.Y + 29), Color.White); } if (ui.Type == UIElement.ElementType.MenuSelection) { // Draw infos for menu selection if (mouseAction != Actions.Nothing) { spriteRender.Draw(ui.SpriteFrame, ui.Pos); spriteBatch.DrawString(font, ui.TextTop, new Vector2(ui.Pos.X + (ui.Resource1 != UIElement.Resource.Population && ui.Resource1 != UIElement.Resource.Workers ? 33 : 0), ui.Pos.Y + 4), Color.White); spriteBatch.DrawString(font, ui.TextBottom, new Vector2(ui.Pos.X + (ui.Resource1 != UIElement.Resource.Population && ui.Resource1 != UIElement.Resource.Workers ? 33 : 0), ui.Pos.Y + 29), Color.White); } } if (ui.Type == UIElement.ElementType.GameSelection) { // Draw infos for selection int menuYPosition = graphics.GraphicsDevice.Viewport.Height - 300; if (selectedBuilding != null) { spriteRender.Draw(ui.SpriteFrame, ui.Pos); spriteBatch.DrawString(font, selectedBuilding.Name, new Vector2(ui.Pos.X + 10, ui.Pos.Y + 8), Color.White); spriteBatch.DrawString(font, selectedBuilding.Description, new Vector2(ui.Pos.X + 10, ui.Pos.Y + 24), Color.White); } } } } foreach (Button button in menu) { if (button.SpriteFrame != null) { spriteRender.Draw(button.SpriteFrame, button.Pos); } } }
public static void DrawRoads(SpriteRender spriteRender, Road[,] roads) { foreach (Road road in roads) { if (road != null) { spriteRender.Draw(road.SpriteFrame, road.Coords); } } }
public override void Draw(SpriteRender spriteRender) { if (IsActive && this.barberPoleAnimationManager.CurrentSprite != null) { spriteRender.Draw( this.barberPoleAnimationManager.CurrentSprite, this.barberPoleAnimationManager.CurrentPosition, Color.White, 0, 1, this.barberPoleAnimationManager.CurrentSpriteEffects); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); // Draw the background spriteRender.Draw(backgroundSprite, centreScreen); // Draw character on screen spriteRender.Draw( characterAnimationManager.CurrentSprite, characterAnimationManager.CurrentPosition, Color.White, 0, 1, characterAnimationManager.CurrentSpriteEffects); spriteBatch.End(); base.Draw(gameTime); }
public void Draw(GameTime deltaTime, Entity entity) { var currentFrame = _currentAnimation.GetCurrentFrame(); _spriteRender.Draw(currentFrame.SpriteFrame, new Vector2(entity.Position.X, entity.Position.Y), layerDepth: 0.5f, color: Color.White, rotation: 0, scale: entity.Scale, spriteEffects: currentFrame.SpriteEffect); }
public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { int originY = Sprite.TILE_TEXTURE_HEIGHT * 2 + 48; string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = depth; spriteRender.Draw(sprite, gameObject.position, new Vector2(0, originY)); }
public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); // gameObject.state as first param Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = depth; spriteRender.Draw(sprite, gameObject.position, gameObject.Color); }
public static void DrawBuildings(SpriteRender spriteRender, List <Building> buildings) { foreach (Building building in buildings) { int offset = 0; if (building.SpriteFrame != buildingTileSheet.Sprite(TexturePackerMonoGameDefinitions.buildingAtlas.SmallSelect) && building.SpriteFrame != buildingTileSheet.Sprite(TexturePackerMonoGameDefinitions.buildingAtlas.LargeSelect)) { offset = tileSize / 4; } spriteRender.Draw(building.SpriteFrame, new Vector2(building.Position.X, building.Position.Y - offset)); } }
public void Draw(GameTime gameTime, SpriteRender spriteRender, Vector2 position, float scale) { if (!ended) { spriteRender.Draw( spriteSheet.Sprite(frames[curFrame]), position, Color.White, 0, scale, SpriteEffects.None ); } }
public override void Draw() { if (IsExit) { SpriteRender.Draw( this.X - this.NegativeTextureOffset.X, this.Y - this.NegativeTextureOffset.Y - 10, this.Z, this.Width + this.PositiveTextureOffset.X, (this.Height + this.PositiveTextureOffset.Y) / 2, Textures.ExitDoor); } base.Draw(); }
public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); // gameObject.state as first param Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = 0.6f; //based on arrow facing rotate the sprite sprite.Size = new Vector2(0.3f, 0.3f); spriteRender.Draw(sprite, gameObject.position); }
public void DrawMoja(SpriteRender spriteRender, SpriteSheet spriteSheet) { List <String> lista1 = PlayerAnimationLists.getTestList(); List <String> list = new List <String>(); //list.Add(TexturePackerMonoGameDefinitions.mainMenu.MainMenu1); //list.Add(TexturePackerMonoGameDefinitions.mainMenu.MainMenu2); //lista1.Add(TexturePackerMonoGameDefinitions.CapGuyDemo.Capguy_turn_0002); //lista1.Add(TexturePackerMonoGameDefinitions.CapGuyDemo.Capguy_turn_0003); //lista1.Add(TexturePackerMonoGameDefinitions.CapGuyDemo.Capguy_turn_0004); //lista1.Add(TexturePackerMonoGameDefinitions.CapGuyDemo.Capguy_turn_0005); spriteRender.Draw( spriteSheet.Sprite(lista1[currentFrame]), new Vector2(200, 200)); }
public static void DrawTerrain(SpriteRender spriteRender) { int startCol, endCol, startRow, endRow; GetRenderableTilesAndCenterTile(out startCol, out endCol, out startRow, out endRow); for (int x = startCol; x < endCol && x < tileMap.GetUpperBound(0); x++) { for (int y = startRow; y < endRow && y < tileMap.GetUpperBound(1); y++) { // Render coords are tile coords times tilesize int yPos = tileMap[x, y].Type != TexturePackerMonoGameDefinitions.texturePackerSpriteAtlas.Stone1 ? y * tileSize : y * tileSize - tileSize; int xPos = x * tileSize; spriteRender.Draw(mapTileSheet.Sprite(tileMap[x, y].Type), new Vector2(xPos, yPos)); } } }
public void Draw(GameTime deltaTime, Entity entity) { var currentFrame = _currentAnimation.GetCurrentFrame(); _spriteRender.Draw(currentFrame.SpriteFrame, new Vector2(entity.Position.X, entity.Position.Y), .5f, Color.White, rotation: 0, scale: entity.Scale, spriteEffects: currentFrame.SpriteEffect); if (DebugConstants.ShowBoundingBoxes) { BoundingBoxHelper.DrawRectangle(entity.BoundingBox, GlobalAssets.BBoxOutline, Color.White, _spriteBatch, false, 1); } }
internal static void DrawPeople(SpriteRender spriteRender, List <Citizen> citizens) { GetRenderableTilesAndCenterTile(out int startCol, out int endCol, out int startRow, out int endRow); if (citizens != null) { foreach (Citizen citizen in citizens) { if (citizen.Pos.X / tileSize > startCol && citizen.Pos.X / tileSize < endCol && citizen.Pos.Y / tileSize > startRow && citizen.Pos.Y / tileSize < endRow) { spriteRender.Draw(citizen.SpriteFrame, citizen.Pos); } } } }
public override void Draw() { if (this.Dead || this.Texture == null) { return; } SpriteRender.Draw( this.X - this.NegativeTextureOffset.X, this.Y - this.NegativeTextureOffset.Y, this.Z, this.Width + this.PositiveTextureOffset.X, this.Height + this.PositiveTextureOffset.Y, this.Texture, this.IsPlayers ? Color4.Red : Color4.Yellow, 1.0f, false); }
public override void Draw() { if (this.Dead || this.Texture == null) { return; } SpriteRender.Draw( this.X - this.NegativeTextureOffset.X, this.Y - this.NegativeTextureOffset.Y, this.Z, this.Width + this.PositiveTextureOffset.X, this.Height + this.PositiveTextureOffset.Y, currentTexture, Color4.White, //jumping ? (jumpingSecond ? Color4.Red : Color4.Green) : Color4.White, 1.0f, PlayerDirection == 1); DrawMessages(); }
public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); gameObject.Color = gameObject.Damaged ? Color.Red : Color.White; // gameObject.state as first param Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = depth; gameObject.Color = Color.White; if (gameObject.GameObjectStateContainer.GetPrevious() is StateWaving) { gameObject.Color = Color.Red; } spriteRender.Draw(sprite, gameObject.position, gameObject.Color); }
public void Draw() { timeElapsed += (float)GameTime.ElapsedGameTime.TotalSeconds; if (timeElapsed > Speed && IsRunning) { timeElapsed -= Speed; if (SpriteIndex < Sprites.Count - 1) { SpriteIndex++; } else if (IsLooping) { SpriteIndex = 0; isFinished = true; } } SpriteRender.Draw(Sprites[SpriteIndex], Position); }
public void DrawAmmo(SpriteRender spriteRender) { if (_activeGear.Weapon != null) { // draw ammo spriteRender.spriteBatch.DrawString( spriteFont: this._fontBig, text: MagCount, position: AmmoPosition + new Vector2(3, 3), color: Color.Black ); spriteRender.spriteBatch.DrawString( spriteFont: this._fontBig, text: MagCount, position: AmmoPosition, color: Color.White ); spriteRender.spriteBatch.DrawString( spriteFont: this._font, text: ReserveCount, position: AmmoPosition + new Vector2(3, 3 + this._fontBig.LineSpacing), color: Color.Black ); spriteRender.spriteBatch.DrawString( spriteFont: this._font, text: ReserveCount, position: AmmoPosition + new Vector2(0, this._fontBig.LineSpacing), color: Color.White ); // draw weapon // TODO: fix references to _ammoX _ammoY Utilities.DrawRectangle(new Rectangle((int)_ammoX - 5, (int)_ammoY - 5, 1, _font.LineSpacing + _fontBig.LineSpacing + 10), Color.Black, spriteRender.spriteBatch); spriteRender.Draw(_activeGear.Weapon.PopupFrame, WeaponPosition, Color.White, 0, 0.25f); } }
public void Draw(SpriteRender spriteRender, SceneManager sceneManager) { int[,] matrix = sceneManager.Scene.GetTerrainMatrix(); float depth = 0.3f; for (int row = 0; row < matrix.GetLength(0); row++) { int offset_x = 0; if (IsOdd(row)) { offset_x = Tile.WIDTH / 2; } for (int column = 0; column < matrix.GetLength(1); column++) { int terrainId = matrix[row, column]; Tile tile = TerrainFactory.Get(terrainId); int positionX = column * Tile.WIDTH + offset_x; int positionY = row * Tile.HEIGHT / 2; var texture = ContentManager.Load <Texture2D>(tile.SpriteSheetName); depth += 0.001f; Sprite sprite = new Sprite( texture, new Rectangle(tile.SpriteSheetContainerMappingX, tile.SpriteSheetContainerMappingY, Tile.WIDTH, Tile.HEIGHT), // 0, 0 draw from upper left corner new Vector2(1, 1), // normal size draw depth ); spriteRender.Draw(sprite, new Vector2(positionX, positionY)); } } }
/// <summary> /// Allows the game component to draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { //GraphicsDevice.Clear(Color.Black); //fSpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied); //fSpriteBatch.Draw(fBackground, new Rectangle(0, 0, fGraphics.PreferredBackBufferWidth, fGraphics.PreferredBackBufferHeight),Color.FromNonPremultiplied(255, 255, 255, 160)); //fSpriteBatch.End(); fParticlesSideEffect.Draw(fSpriteBatch, fTexture); fParticlesMouse.Draw(fSpriteBatch, fTexture); fParticlesSeconds.Draw(fSpriteBatch, fTexture); fParticlesCounter.Draw(fSpriteBatch, fTexture); fParticlesEva.Draw(fSpriteBatch, fTexture); fSpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied); fSpriteRender.Draw( fSpriteSheet.Sprite(TexturePackerMonoGameDefinitions.Flowers.Flowers_10), new Vector2(Mouse.GetState().X, Mouse.GetState().Y)); fSpriteBatch.End(); base.Draw(gameTime); }
internal static void DrawInteractives(SpriteRender spriteRender, List <Interactive> interactives) { if (interactives != null) { GetRenderableTilesAndCenterTile(out int startCol, out int endCol, out int startRow, out int endRow); foreach (Interactive interactive in interactives) { // Only draw if its visible if (interactive.Coords.X / tileSize > startCol && interactive.Coords.X / tileSize < endCol && interactive.Coords.Y / tileSize > startRow && interactive.Coords.Y / tileSize < endRow) { // Only draw interactives with health bigger than 0 - it is harvested if health is <= 0 if (interactive.Health > 0) { spriteRender.Draw(interactive.SpriteFrame, interactive.Coords); } } } } }
public virtual void Draw() { if (this.Dead || this.Texture == null) { return; } SpriteRender.Draw( this.X - this.NegativeTextureOffset.X, this.Y - this.NegativeTextureOffset.Y, this.Z, this.Width + this.PositiveTextureOffset.X, this.Height + this.PositiveTextureOffset.Y, this.Texture); //UIElement element = new UIElement(); //if (Texture != null) //{ // element = new Image(); // (element as Image).Source = Texture; // (element as Image).RenderTransform = Transform; //} //else //{ // element = new Rectangle(); // (element as Rectangle).StrokeThickness = 2; // (element as Rectangle).Width = this.Width; // (element as Rectangle).Height = this.Height; // (element as Rectangle).Stroke = Brush; //} //Canvas.SetLeft(element, this.X); //Canvas.SetTop(element, this.Y); //canvas.Children.Add(element); }