public override void Draw(GameTime gameTime, SpriteBatch spriteBatch, Color color) { if (!spawned) { return; } if (!spawnFinished) { SpawnEffectSprite.Draw(spriteBatch, pos - new Vector2(draw_width / 2, draw_height / 2)); return; } base.Draw(gameTime, spriteBatch, Color.White); //if (!dead) base.Draw(gameTime, spriteBatch, Color.Red); var offset = Vector2.Zero; if (enemyType == EnemyType.Cyborg) { offset = new Vector2(0, 0); } else if (enemyType == EnemyType.CaveBorg) { offset = new Vector2(0, 13); } if (AnimExplosionDuration > 0) { ExplosionSprite?.Draw(spriteBatch, pos + offset); } }
public void Draw(SpriteBatch spriteBatch) { _animatedSprite.Draw(spriteBatch, Position); }
public void Draw(SpriteBatch spriteBatch) { _sprite.Draw(spriteBatch, Location, new Rectangle(_sprite.Frame * 24, Direction * 32, 24, 32), 1f); }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch) { sprite.Draw(gameTime, spriteBatch, camera); }
public void Draw(SpriteBatch spriteBatch, GameTime gameTime) { sprite.Draw(spriteBatch, gameTime); }
public override void Draw(CustomSpriteBatch g) { g.Draw(sprMyWeaponsBackground, new Vector2(358, 84), Color.White); foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Draw(g); } float DrawY = 117; for (int C = WeaponInventoryStartIndex; C < PlayerInventory.ListWeapon.Count && C < WeaponShopStartIndex + 9; ++C) { g.Draw(PlayerInventory.ListWeapon[C].sprIcon, new Vector2(384, DrawY), Color.White); Rectangle PlayerInfoCollisionBox = new Rectangle(384, (int)DrawY, (int)PlayerInventory.ListWeapon[C].sprIcon.Width, (int)PlayerInventory.ListWeapon[C].sprIcon.Height); if (PlayerInfoCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y)) { MyWeaponOutline.Draw(g, new Vector2(384 + PlayerInventory.ListWeapon[C].sprIcon.Width / 2, DrawY + PlayerInventory.ListWeapon[C].sprIcon.Height / 2), Color.White); } DrawY += 50; } DrawY = 128; for (int C = WeaponShopStartIndex; C < ListShopEquipment.Count && C < WeaponShopStartIndex + 6; ++C) { MenuEquipment EquipmentToBuy = GetShopWeaponUnderMouse(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y); if (EquipmentToBuy == ListShopEquipment[C]) { BuyWeaponIcon.SetFrame(2); } else { BuyWeaponIcon.SetFrame(0); } BuyWeaponIcon.Draw(g, new Vector2(172, DrawY + 24), Color.White); g.Draw(ListShopEquipment[C].sprText, new Vector2(43, DrawY), Color.White); g.Draw(ListShopEquipment[C].sprIcon, new Vector2(39, DrawY + 11), Color.White); g.DrawStringRightAligned(fntText, ListShopEquipment[C].Category, new Vector2(297, DrawY + 3), Color.White); g.DrawStringRightAligned(fntText, "Lv." + ListShopEquipment[C].MinLevel.ToString(), new Vector2(210, DrawY + 27), Color.White); g.DrawStringRightAligned(fntText, ListShopEquipment[C].Price + " CR", new Vector2(297, DrawY + 27), Color.White); DrawY += 60; } if (PlayerInventory.ArrayEquipedPrimaryWeapon[0] != null) { g.Draw(PlayerInventory.ArrayEquipedPrimaryWeapon[0].sprIcon, new Vector2(637, 122), Color.White); } if (PlayerInventory.ArrayEquipedPrimaryWeapon[1] != null) { g.Draw(PlayerInventory.ArrayEquipedPrimaryWeapon[1].sprIcon, new Vector2(637, 182), Color.White); } if (DragAndDropEquipment != null) { g.Draw(DragAndDropEquipment.sprIcon, new Vector2(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y), Color.White); } DrawDragDropOverlay(g); }
public virtual void Render(Vector2 topLeft, Vector2 bottomRight) { UpdateSlaves(); //Render slaves beneath IEnumerable <IRenderableComponent> renderablesBeneath = from IRenderableComponent c in slaves //FIXTHIS orderby c.DrawDepth ascending where c.DrawDepth < DrawDepth select c; foreach (IRenderableComponent component in renderablesBeneath.ToList()) { component.Render(topLeft, bottomRight); } //Render this sprite if (!visible) { return; } if (sprite == null) { return; } var ownerPos = Owner.GetComponent <ITransformComponent>().Position; Vector2 renderPos = CluwneLib.WorldToScreen(ownerPos); SetSpriteCenter(renderPos); var bounds = sprite.AABB; if (ownerPos.X + bounds.Left + bounds.Width < topLeft.X || ownerPos.X > bottomRight.X || ownerPos.Y + bounds.Top + bounds.Height < topLeft.Y || ownerPos.Y > bottomRight.Y) { return; } sprite.HorizontalFlip = HorizontalFlip; sprite.Draw(Color); //Render slaves above IEnumerable <IRenderableComponent> renderablesAbove = from IRenderableComponent c in slaves //FIXTHIS orderby c.DrawDepth ascending where c.DrawDepth >= DrawDepth select c; foreach (IRenderableComponent component in renderablesAbove.ToList()) { component.Render(topLeft, bottomRight); } //Draw AABB var aabb = AABB; if (_speechBubble != null) { _speechBubble.Draw(CluwneLib.WorldToScreen(Owner.GetComponent <ITransformComponent>().Position), new Vector2(), aabb); } }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); sprite.Draw(gameTime, gameRef.SpriteBatch); }
private void DrawMyCharactersAndEquipment(CustomSpriteBatch g) { g.Draw(sprMyCharactersBackground, new Vector2(358, 84), Color.White); g.Draw(sprMyEquipmentBackground, new Vector2(358, 350), Color.White); for (int C = 0; C < PlayerInventory.ListCharacter.Count; ++C) { MyCharacterButton.Draw(g, new Vector2(680, 133 + C * 55), Color.White); g.DrawString(fntText, PlayerInventory.ListCharacter[C].Name, new Vector2(663, 113 + C * 55), Color.White); g.DrawString(fntText, "5", new Vector2(678, 135 + C * 55), Color.White); g.DrawString(fntText, "6", new Vector2(710, 135 + C * 55), Color.White); g.DrawString(fntText, "4", new Vector2(742, 135 + C * 55), Color.White); Rectangle PlayerInfoCollisionBox = new Rectangle(680 - (int)MyCharacterButton.Origin.X, 133 - (int)MyCharacterButton.Origin.Y + C * 55, MyCharacterButton.SpriteWidth, MyCharacterButton.SpriteHeight); if (PlayerInfoCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y)) { MyCharacterOutline.Draw(g, new Vector2(680, 133 + C * 55), Color.White); } } for (int E = 0; E < PlayerInventory.ListEquipment.Count; ++E) { int X = 584 + (E % 4) * 49; int Y = 382 + (E / 4) * 47; g.Draw(PlayerInventory.ListEquipment[E].sprIcon, new Vector2(X, Y), Color.White); Rectangle PlayerInfoCollisionBox = new Rectangle(X, Y, PlayerInventory.ListEquipment[E].sprIcon.Width, PlayerInventory.ListEquipment[E].sprIcon.Height); if (PlayerInfoCollisionBox.Contains(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y)) { MyItemOutline.Draw(g, new Vector2(X + PlayerInventory.ListEquipment[E].sprIcon.Width / 2, Y + PlayerInventory.ListEquipment[E].sprIcon.Height / 2), Color.White); } } if (PlayerInventory.EquipedEtc != null) { g.Draw(PlayerInventory.EquipedEtc.sprIcon, new Vector2(366, 359), Color.White); } if (PlayerInventory.EquipedHead != null) { g.Draw(PlayerInventory.EquipedHead.sprIcon, new Vector2(446, 355), Color.White); } if (PlayerInventory.EquipedArmor != null) { g.Draw(PlayerInventory.EquipedArmor.sprIcon, new Vector2(452, 396), Color.White); } if (PlayerInventory.EquipedWeaponOption != null) { g.Draw(PlayerInventory.EquipedWeaponOption.sprIcon, new Vector2(383, 434), Color.White); } if (PlayerInventory.EquipedBooster != null) { g.Draw(PlayerInventory.EquipedBooster.sprIcon, new Vector2(481, 462), Color.White); } if (PlayerInventory.EquipedShoes != null) { g.Draw(PlayerInventory.EquipedShoes.sprIcon, new Vector2(389, 521), Color.White); } DrawDragDropOverlay(g); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); _spriteBatch.Begin(); switch (currentState) { case DevStates.TextureAtlasTesting1: manager.DrawFullAtlas(_spriteBatch, 0, GraphicsDevice.Viewport.Bounds, Color.White); break; case DevStates.TextureAtlasTesting2: _spriteBatch.Draw(manager, "image0", new Vector2(50, 50), Color.White); _spriteBatch.Draw(manager, "image1", new Vector2(100, 100), Color.White); break; case DevStates.TextureAtlasTesting3: manager.DrawFullAtlas(_spriteBatch, 0, GraphicsDevice.Viewport.Bounds, Color.White); _spriteBatch.Draw(manager, "image0", new Vector2(50, 50), Color.White); _spriteBatch.Draw(manager, "image1", new Vector2(100, 100), Color.White); break; case DevStates.AnimatedSpriteTesting: animatedSprite1.Draw(_spriteBatch); break; case DevStates.AnimatedMovingSpriteTesting: animatedSprite2.Draw(_spriteBatch); break; case DevStates.SimpleSpriteTesting: sprite1.Draw(_spriteBatch); break; case DevStates.SimpleMovingSpriteTesting: sprite2.Draw(_spriteBatch); break; case DevStates.CompositeSpriteTesting: compositeSprite1.Draw(_spriteBatch); break; case DevStates.CompositeMovingSpriteTesting: compositeSprite2.Draw(_spriteBatch); break; case DevStates.CompositeAnimatedSpriteTesting: compositeAnimatedSprite1.Draw(_spriteBatch); break; case DevStates.CompositeMovingAnimatedSpriteTesting: compositeAnimatedSprite2.Draw(_spriteBatch); break; } _spriteBatch.DrawString(font, currentState.ToString(), new Vector2(0, Window.ClientBounds.Height - 40), Color.Black); _spriteBatch.DrawString(font2, $"Atlas Re-balancing enabled: {manager.AutoTextureAtlasBalancingEnabled}", new Vector2(525, Window.ClientBounds.Height - 60), Color.Black); if (manager.AutoTextureAtlasBalancingEnabled) { _spriteBatch.DrawString(font2, $"Next Re-Balance: {Math.Round(manager.TimeInMillisecondsUntilLastReBalance / 1000f, 1)}s", new Vector2(525, Window.ClientBounds.Height - 40), Color.Black); _spriteBatch.DrawString(font2, $"Atlas Count: {manager.AtlasCount}", new Vector2(525, Window.ClientBounds.Height - 20), Color.Black); } _spriteBatch.End(); // TODO: Add your drawing code here base.Draw(gameTime); }
public override void Draw(SpriteBatch spriteBatch) { _animSprite.Draw(spriteBatch); }
public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch) { sprite.Draw(gameTime, spriteBatch); }
public override void Draw(SpriteBatch spriteBatch, ViewportAdapter viewportAdapter) { base.Draw(spriteBatch, viewportAdapter); var screenSize = SceneManager.Instance.VirtualSize; var gameFont = SceneManager.Instance.GameFont; spriteBatch.Begin(samplerState: SamplerState.PointClamp, transformMatrix: viewportAdapter.GetScaleMatrix()); // Background spriteBatch.Draw(_backgroundTexture, _backgroundTexture.Bounds, Color.White); // Title var titleString = _titleStrings[SceneManager.Instance.TypeOfSceneSaves]; var titleX = (SceneManager.Instance.VirtualSize.X - SceneManager.Instance.GameFontBig.MeasureString(titleString).X) / 2; spriteBatch.DrawTextWithShadow(SceneManager.Instance.GameFontBig, titleString, new Vector2(titleX, 10), Color.White); // Slots for (var i = 0; i < 3; i++) { var slotPosition = _slotsPosition[i].Location.ToVector2(); // Check if the slot isn't empty if (SavesManager.Instance.GetCompletedStages(_gameSaves[i].StagesCompleted) > 0) { // Pete Head if (_slotIndex == i) { _peteAnimatedSprite.Position = slotPosition + _peteHeadPosition; _peteAnimatedSprite.Draw(spriteBatch); } else { spriteBatch.Draw(_peteSpritesheet, slotPosition + _peteHeadPosition, _peteDefaultFrame, Color.White); } // Save Name spriteBatch.DrawString(gameFont, GetSaveName(i), slotPosition + _namePosition, _fontColor); // Stages var divisorPosition = Vector2.Zero; var stagesCompleted = SavesManager.Instance.GetCompletedStages(_gameSaves[i].StagesCompleted); for (var j = 0; j < stagesCompleted; j++) { var markPosition = slotPosition + _stagesPosition + ((_stagePeteMarkFrame.Width + 4) * j * Vector2.UnitX); if (_gameSaves[i].StagesCompleted[j].RankS) { spriteBatch.Draw(_stageSpritesheet, markPosition, _sStageMarkFrames[_sStageIndex], Color.White); } else { spriteBatch.Draw(_stageSpritesheet, markPosition, _stagePeteMarkFrame, Color.White); } if (j < SceneManager.MaxLevels - 1) { divisorPosition = markPosition + (_stagePeteMarkFrame.Width + 1) * Vector2.UnitX + (9 * Vector2.UnitY); spriteBatch.Draw(_stageSpritesheet, divisorPosition, _stageDivisorFrame, Color.White); } } if (SavesManager.Instance.GetCompletedStages(_gameSaves[i].StagesCompleted) < SceneManager.MaxLevels) { var nextMarkPos = (divisorPosition == Vector2.Zero) ? (slotPosition + _stagesPosition) : (divisorPosition - (9 * Vector2.UnitY) + (3 * Vector2.UnitX)); if (_slotIndex == i) { _nextStageMarkAnimatedSprite.Position = nextMarkPos; _nextStageMarkAnimatedSprite.Draw(spriteBatch); } else { spriteBatch.Draw(_stageSpritesheet, nextMarkPos, _stageNextMarkFrame, Color.White); } } // Lives var lives = _gameSaves[i].Lives; var livesWidth = (lives * _lifeFrame.Width) + (lives - 1); var livesPosition = slotPosition + (_slotsPosition[i].Width - livesWidth - _livesPosition.X) * Vector2.UnitX + _livesPosition.Y * Vector2.UnitY; for (var j = 0; j < lives; j++) { var lifePosition = livesPosition + ((_lifeFrame.Width + 1) * j * Vector2.UnitX); spriteBatch.Draw(_iconsSpritesheet, lifePosition, _lifeFrame, Color.White); } // Hearts var hearts = _gameSaves[i].Hearts; var heartsWidth = (hearts * _heartFrame.Width) + (hearts - 1) * 5; var heartsPosition = slotPosition + (_slotsPosition[i].Width - heartsWidth - _heartsPosition.X) * Vector2.UnitX + _heartsPosition.Y * Vector2.UnitY; for (var j = 0; j < hearts; j++) { var heartPosition = heartsPosition + ((_heartFrame.Width + 5) * j * Vector2.UnitX); spriteBatch.Draw(_iconsSpritesheet, heartPosition, _heartFrame, Color.White); } // Ammo spriteBatch.Draw(_iconsSpritesheet, slotPosition + _ammoPosition, _ammoFrame, Color.White); spriteBatch.DrawString(gameFont, _gameSaves[i].Ammo.ToString(), slotPosition + _ammoTextPosition, _fontColor); // Coins spriteBatch.Draw(_iconsSpritesheet, slotPosition + _coinsPosition, _coinFrame, Color.White); spriteBatch.DrawString(gameFont, _gameSaves[i].Coins.ToString(), slotPosition + _coinsTextPosition, _fontColor); } else { // Empty slot text var emptySlotTextSize = gameFont.MeasureString(EmptySlotText); var emptyPosition = new Vector2(slotPosition.X + (_slotsPosition[i].Width - emptySlotTextSize.X) / 2, slotPosition.Y + (_slotsPosition[i].Height - emptySlotTextSize.Y) / 2); spriteBatch.DrawString(gameFont, EmptySlotText, emptyPosition, _fontColor); } } IconsManager.Instance.DrawRightArrow(spriteBatch, _arrowPosition + _arrowPositionInc * Vector2.UnitY, false); var xOffset = SceneManager.Instance.GameFontSmall.MeasureString(ConfirmButtonLabel).X + 30; IconsManager.Instance.DrawAButton(spriteBatch, new Vector2(5, screenSize.Y - 18), false, ConfirmButtonLabel, 1.0f, true); IconsManager.Instance.DrawBButton(spriteBatch, new Vector2(xOffset, screenSize.Y - 18), false, CancelButtonLabel, 1.0f, true); if (_loadingVisible) { spriteBatch.Draw(_loadingBackgroundTexture, new Rectangle(0, 0, (int)screenSize.X, (int)screenSize.Y), Color.White * 0.5f); _loadingAnimatedSprite.Draw(spriteBatch); } spriteBatch.End(); }
public override void Draw(CustomSpriteBatch g, bool IsInEditMode) { if (ListCurrentChainSplinePoints.Count == 0) { return; } Vector2 LastPos = PositionOld; for (int L = 0; L < CurrentChainLengthInPixel; ++L) { float ProgressionValue = L / (float)CurrentChainLengthInPixel; float t = ProgressionValue; float x0 = Position.X; float x2 = ListCurrentChainSplinePoints[ListCurrentChainSplinePoints.Count - 1].X; float y0 = Position.Y; float y2 = ListCurrentChainSplinePoints[ListCurrentChainSplinePoints.Count - 1].Y; int n = ListCurrentChainSplinePoints.Count + 1; double ResultX = Math.Pow(1 - t, n) * x0; double ResultY = Math.Pow(1 - t, n) * y0; int nFac = 1; for (int k = 1; k <= n; k++) { nFac *= k; } for (int C = 0; C < ListCurrentChainSplinePoints.Count; C++) { int i = C + 1; int niFac = 1; int iFac = 1; for (int k = 1; k <= n - i; k++) { niFac *= k; } for (int k = 1; k <= i; k++) { iFac *= k; } int nChoosek = nFac / (niFac * iFac); //n! / ((n-i)!*i!) * ((1 - t)^(n-1)) * (t ^ i) * Point[i] ResultX += nChoosek * Math.Pow(1 - t, n - i) * Math.Pow(t, i) * ListCurrentChainSplinePoints[C].X; ResultY += nChoosek * Math.Pow(1 - t, n - i) * Math.Pow(t, i) * ListCurrentChainSplinePoints[C].Y; } ResultX += Math.Pow(t, n) * x2; ResultY += Math.Pow(t, n) * y2; Vector2 DrawPosition = new Vector2((float)ResultX, (float)ResultY); float ChainAngle = (float)Math.Atan2(DrawPosition.Y - LastPos.Y, DrawPosition.X - LastPos.X); if (L == 0 && ChainStart != null) { ChainStart.Draw(g, DrawPosition, Color.White, ChainAngle, 0f, new Vector2(1, 1), SpriteEffects.None); } else if (L == CurrentChainLengthInPixel - 1 && ChainEnd != null) { ChainEnd.Draw(g, DrawPosition, Color.White, ChainAngle, 0f, new Vector2(1, 1), SpriteEffects.None); } else if (ChainLink != null) { ChainLink.Draw(g, DrawPosition, Color.White, ChainAngle, 0f, new Vector2(1, 1), SpriteEffects.None); } LastPos = DrawPosition; } }
public virtual void Render(Vector2D topLeft, Vector2D bottomRight) { //Render slaves beneath IEnumerable <IRenderableComponent> renderablesBeneath = from IRenderableComponent c in slaves //FIXTHIS orderby c.DrawDepth ascending where c.DrawDepth < DrawDepth select c; foreach (IRenderableComponent component in renderablesBeneath.ToList()) { component.Render(topLeft, bottomRight); } //Render this sprite if (!visible) { return; } if (sprite == null) { return; } Vector2D renderPos = ClientWindowData.WorldToScreen( Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position); SetSpriteCenter(renderPos); if (Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.X + sprite.AABB.Right < topLeft.X || Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.X > bottomRight.X || Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.Y + sprite.AABB.Bottom < topLeft.Y || Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.Y > bottomRight.Y) { return; } sprite.HorizontalFlip = flip; sprite.Draw(); sprite.HorizontalFlip = false; //Render slaves above IEnumerable <IRenderableComponent> renderablesAbove = from IRenderableComponent c in slaves //FIXTHIS orderby c.DrawDepth ascending where c.DrawDepth >= DrawDepth select c; foreach (IRenderableComponent component in renderablesAbove.ToList()) { component.Render(topLeft, bottomRight); } //Draw AABB var aabb = AABB; //Gorgon.CurrentRenderTarget.Rectangle(renderPos.X - aabb.Width/2, renderPos.Y - aabb.Height / 2, aabb.Width, aabb.Height, Color.Lime); if (_speechBubble != null) { _speechBubble.Draw(Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position, ClientWindowData.Singleton.ScreenOrigin, aabb); } }
public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch) { spriteBatch.Begin(); animatedSprite.Draw(gameTime, spriteBatch); spriteBatch.End(); }