public override void Draw(CustomSpriteBatch g) { int SquadRemaining = 0; foreach (Squad ActiveSquad in Map.ListPlayer[Map.ActivePlayerIndex].ListSquad) { if (ActiveSquad.CurrentLeader != null && ActiveSquad.CanMove) { ++SquadRemaining; } } if (ConfirmMenuChoice == 0) { g.Draw(sprCursorConfirmEndYes, new Vector2((Constants.Width - sprCursorConfirmEndYes.Width) / 2, (Constants.Height - sprCursorConfirmEndYes.Height) / 2), Color.White); } else { g.Draw(sprCursorConfirmEndNo, new Vector2((Constants.Width - sprCursorConfirmEndNo.Width) / 2, (Constants.Height - sprCursorConfirmEndNo.Height) / 2), Color.White); } TextHelper.DrawText(g, SquadRemaining.ToString(), new Vector2((Constants.Width - sprCursorConfirmEndYes.Width) / 2 + 123, (Constants.Height - sprCursorConfirmEndNo.Height) / 2 + 26), Color.White); }
public void DrawMenuUnit(CustomSpriteBatch g, int ItemIndex, int X, int Y) { Unit ActiveUnit = SelectedUnit; g.Draw(ActiveUnit.SpriteMap, new Vector2(X, Y), Color.White); g.DrawString(fntFinlanderFont, ActiveUnit.RelativePath, new Vector2(X + 40, Y), Color.White); TextHelper.DrawTextRightAligned(g, ActiveUnit.MaxHP.ToString(), new Vector2(300, Y), Color.White); TextHelper.DrawTextRightAligned(g, ActiveUnit.MaxEN.ToString(), new Vector2(400, Y), Color.White); if (ActiveUnit.Pilot != null) { g.DrawString(fntFinlanderFont, ActiveUnit.PilotName, new Vector2(440, Y), Color.White); g.DrawStringRightAligned(fntFinlanderFont, ActiveUnit.PilotLevel.ToString(), new Vector2(620, Y), Color.White); } }
public static void DrawLine(CustomSpriteBatch g, Vector2 StartPos, Vector2 EndPos, Color ActiveColor, int width = 1) { Vector2 Axis = StartPos - EndPos; Rectangle LineSize = new Rectangle((int)StartPos.X, (int)StartPos.Y, (int)Axis.Length() + width, width); Axis.Normalize(); float Angle = (float)Math.Acos(Vector2.Dot(Axis, -Vector2.UnitX)); if (StartPos.Y > EndPos.Y) { Angle = MathHelper.TwoPi - Angle; } g.Draw(sprPixel, LineSize, null, ActiveColor, Angle, Vector2.Zero, SpriteEffects.None, 0); }
public override void Draw(CustomSpriteBatch g) { GameScreen.DrawBox(g, new Vector2(SpellBoxX, 30), 200, MenuMaxVisibleHeight, Color.White); for (int i = MenuOffset * 2, j = 0; i < ListAllMagicElementChoice.Count && j < MaxNumberVisibleElement; ++i, ++j) { int VisibleElementIndex = (i / 2) - MenuOffset; int X = SpellBoxX + 10 + (i % 2) * ElementSize; int Y = 40 + VisibleElementIndex * ElementSize; MagicElement ActiveElement = ListAllMagicElementChoice[i]; g.Draw(Editor.sprMagicCircle, new Rectangle(X, Y, ElementSize, ElementSize), Color.White); TextHelper.DrawTextMiddleAligned(g, ActiveElement.ToString(), new Vector2(X + 38, Y + ElementSize), Color.White); } }
public void Draw(CustomSpriteBatch g) { BlendState blendState = new BlendState(); blendState.AlphaDestinationBlend = Blend.SourceAlpha; blendState.ColorDestinationBlend = Blend.SourceColor; blendState.AlphaSourceBlend = Blend.Zero; blendState.ColorSourceBlend = Blend.Zero; g.End(); g.Begin(SpriteSortMode.Deferred, blendState); g.Draw(renderTarget, Vector2.Zero, Color.White); g.End(); g.Begin(); }
private void DrawLine(CustomSpriteBatch spriteBatch, Vector2 StartPos, Vector2 EndPos, Color color, int width = 1) { Vector2 v = StartPos - EndPos; //Define a line of the length of each small section of the final line. Rectangle LineSize = new Rectangle((int)StartPos.X, (int)StartPos.Y, (int)v.Length() + width, width); v.Normalize(); //Get line angle. float angle = (float)Math.Acos(Vector2.Dot(v, -Vector2.UnitX)); if (StartPos.Y > EndPos.Y) { angle = MathHelper.TwoPi - angle; } spriteBatch.Draw(sprPixel, LineSize, null, color, angle, Vector2.Zero, SpriteEffects.None, 0); }
/// <summary> /// Draws the control. /// </summary> protected override void Draw() { // Clear to the default control background color. Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B); GraphicsDevice.Clear(backColor); g.Begin(); if (Bitmap != null) { g.Draw(Bitmap, Vector2.Zero, Color.White); } g.End(); }
public override void Draw(CustomSpriteBatch g) { GraphicsDevice.Clear(Color.CornflowerBlue); int X = Constants.Width / 2 - 60; int Y = Constants.Height / 2 - fntArial12.LineSpacing / 2; int BaseY = Constants.Height / 2 - fntArial12.LineSpacing / 2; if (SubMenu != -1) { Y -= fntArial12.LineSpacing * (SubMenu + 1); } for (int i = SelectedChoice; i < Menu.Count(); i++) { g.DrawString(fntArial12, Menu[i].Name, new Vector2(X, Y), Color.FromNonPremultiplied(255, 255, 255, 255 - (int)((Y - BaseY) / 10.0) * 10)); if (Menu[i].Open) { for (int j = 0; j < Menu[i].Categories.Count(); j++) { g.DrawString(fntArial12, Menu[i].Categories[j], new Vector2(X + 10, Y += fntArial12.LineSpacing), Color.FromNonPremultiplied(255, 255, 255, 255 - (int)((Y - BaseY) / 10.0) * 10)); } } Y += fntArial12.LineSpacing * 3; } Y = BaseY - fntArial12.LineSpacing * 3; if (SubMenu != -1) { Y -= fntArial12.LineSpacing * (SubMenu + 1); } for (int i = SelectedChoice - 1; i >= 0; i--) { if (Menu[i].Open) { for (int j = 0; j < Menu[i].Categories.Count(); j++) { g.DrawString(fntArial12, Menu[i].Categories[j], new Vector2(X + 10, Y), Color.FromNonPremultiplied(255, 255, 255, 255 - (int)((BaseY - Y) / 10.0) * 10)); Y -= fntArial12.LineSpacing; } Y -= fntArial12.LineSpacing; } g.DrawString(fntArial12, Menu[i].Name, new Vector2(X, Y), Color.FromNonPremultiplied(255, 255, 255, 255 - (int)((BaseY - Y) / 10.0) * 10)); Y -= fntArial12.LineSpacing * 3; } //Draw cursor. g.Draw(sprPixel, new Rectangle(0, BaseY, Constants.Width, fntArial12.LineSpacing), Color.FromNonPremultiplied(255, 255, 255, SelectedAlpha)); }
public override void Draw(CustomSpriteBatch g) { for (int X = 0; X < CurrentAttack.MAPAttributes.ListChoice.Count; X++) { for (int Y = 0; Y < CurrentAttack.MAPAttributes.ListChoice[X].Count; Y++) { if (CurrentAttack.MAPAttributes.ListChoice[X][Y]) { g.Draw(GameScreen.sprPixel, new Rectangle((int)(Map.CursorPosition.X + X - Map.CameraPosition.X - CurrentAttack.MAPAttributes.Width) * Map.TileSize.X, (int)(Map.CursorPosition.Y + Y - Map.CameraPosition.Y - CurrentAttack.MAPAttributes.Height) * Map.TileSize.Y, Map.TileSize.X, Map.TileSize.Y), Color.DarkRed); } } } BattlePreview.DrawDisplayUnit(g); }
public override void Draw(CustomSpriteBatch g) { //Draw the action panel. int X = Constants.Width - 150; int Y = 10; GameScreen.DrawBox(g, new Vector2(X, Y), 150, ListNextChoice.Count * 22, Color.White); //g.Draw(sprMenuText, new Vector2(X, Y), Color.White); for (int i = 0; i < ListNextChoice.Count; i++) { g.DrawString(fntFinlanderFont, ListNextChoice[i].Name, new Vector2(X + 5, Y + i * fntFinlanderFont.LineSpacing), Color.White); } //Draw the menu cursor. g.Draw(sprMenuHighlight, new Vector2(X + 5, Y + 6 + ActionMenuCursor * fntFinlanderFont.LineSpacing), Color.White); }
public override void Draw(CustomSpriteBatch g) { int X = (int)(Map.CursorPosition.X + 1 - Map.CameraPosition.X) * Map.TileSize.X; int Y = (int)(Map.CursorPosition.Y - Map.CameraPosition.Y) * Map.TileSize.Y; if (X + MinActionMenuWidth + MinActionMenuWidth >= Constants.Width) { X = Constants.Width - MinActionMenuWidth - MinActionMenuWidth; } for (int U = 0; U < 1; ++U) { GameScreen.DrawBox(g, new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), MinActionMenuWidth, PannelHeight, Color.White); GameScreen.DrawText(g, "Electric Wall", new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), Color.White); } g.Draw(GameScreen.sprPixel, new Rectangle(X + MinActionMenuWidth, Y + SelectedUnitIndex * PannelHeight, 50, 20), Color.FromNonPremultiplied(255, 255, 255, 128)); }
public void DrawOverlayChainStart(CustomSpriteBatch g) { g.Begin(); Vector2 Center = new Vector2((float)txtChainStartOriginX.Value, (float)txtChainStartOriginY.Value); g.Draw(sprPixel, new Rectangle((int)Center.X - 1, (int)Center.Y - 1, 3, 1), null, Color.Red); g.Draw(sprPixel, new Rectangle((int)Center.X - 1, (int)Center.Y + 1, 3, 1), null, Color.Red); g.Draw(sprPixel, new Rectangle((int)Center.X - 1, (int)Center.Y - 1, 1, 3), null, Color.Red); g.Draw(sprPixel, new Rectangle((int)Center.X + 1, (int)Center.Y - 1, 1, 3), null, Color.Red); g.Draw(sprPixel, new Rectangle(0, (int)Center.Y, (int)Center.X - 1, 1), null, Color.Black); g.Draw(sprPixel, new Rectangle((int)Center.X + 2, (int)Center.Y, Width - (int)Center.X - 5, 1), null, Color.Black); g.Draw(sprPixel, new Rectangle((int)Center.X, 0, 1, (int)Center.Y - 1), null, Color.Black); g.Draw(sprPixel, new Rectangle((int)Center.X, (int)Center.Y + 2, 1, Height - (int)Center.Y - 5), null, Color.Black); g.End(); }
public void DrawOverlay(CustomSpriteBatch g) { g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); g.Draw(sprPixel, new Rectangle(0, 0, Width, 1), null, Color.Black, 0, Vector2.Zero, SpriteEffects.None, 0); g.Draw(sprPixel, new Rectangle(0, 0, 1, Height), null, Color.Black, 0, Vector2.Zero, SpriteEffects.None, 0); g.Draw(sprPixel, new Rectangle(0, Height, Width, 1), null, Color.Black, 0, Vector2.Zero, SpriteEffects.None, 0); g.Draw(sprPixel, new Rectangle(Width, 0, 1, Height), null, Color.Black, 0, Vector2.Zero, SpriteEffects.None, 0); if (MultipleSelectionRectangle.Width > 0) { int RecX = MultipleSelectionRectangle.X; int RecY = MultipleSelectionRectangle.Y; g.Draw(sprPixel, new Rectangle(RecX, RecY, MultipleSelectionRectangle.Width, 1), null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, 0); g.Draw(sprPixel, new Rectangle(RecX, RecY, 1, MultipleSelectionRectangle.Height), null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, 0); g.Draw(sprPixel, new Rectangle(RecX, RecY + MultipleSelectionRectangle.Height, MultipleSelectionRectangle.Width, 1), null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, 0); g.Draw(sprPixel, new Rectangle(RecX + MultipleSelectionRectangle.Width, RecY, 1, MultipleSelectionRectangle.Height), null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, 0); g.Draw(sprPixel, new Rectangle(RecX + MultipleSelectionOrigin.X - 2, RecY + MultipleSelectionOrigin.Y - 2, 5, 5), null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, 0); } g.End(); }
public static void Draw(CustomSpriteBatch g) { for (int P = 0; P < ListParticule.Count; P++) { if (Particule.ListParticule[P].IsAlive) { g.Draw(ListParticule[P].ActiveSprite, ListParticule[P].Position, ListParticule[P].SpriteSource, Color.FromNonPremultiplied(255, 255, 255, ListParticule[P].Alpha), ListParticule[P].Angle, ListParticule[P].Origin, ListParticule[P].Scale, SpriteEffects.None, 0); } } g.End(); Propulsor.ParticleSystem.Draw(GameScreen.GraphicsDevice); FlameParticle.ParticleSystem.Draw(GameScreen.GraphicsDevice); Boss1.BombFlame.ParticleSystem.Draw(GameScreen.GraphicsDevice); FlakTrace.ParticleSystem.Draw(GameScreen.GraphicsDevice); g.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); }
public void Draw(CustomSpriteBatch g, Vector2 Offset, Vector2 BulletPosition, Vector2 BulletSpeed, float Angle) { switch (BulletTrailType) { case BulletTrailTypes.StretchAll: Vector2 StartPos = BulletPosition - Offset - BulletSpeed; Rectangle LineSize = new Rectangle((int)StartPos.X, (int)StartPos.Y, (int)BulletSpeed.Length() + TrailImage.Height, TrailImage.Height); g.Draw(TrailImage, LineSize, null, Color.White, Angle, new Vector2(0, TrailImage.Height / 2), SpriteEffects.None, 0); break; case BulletTrailTypes.StretchPartial: break; case BulletTrailTypes.Particule: break; } }
public override void Draw(CustomSpriteBatch g, int NonDemoAnimationTimer) { float DrawPositionX; if (IsRight) { DrawPositionX = PositionX - 120; } else { DrawPositionX = PositionX + 120; } DrawBackgroundBox(g, DrawPositionX, PositionY); g.Draw(SharedUnitStats.SharedUnit.SpriteMap, new Vector2( DrawPositionX + 2, PositionY + 8), Color.White); }
private void DrawDelayedAttacks(CustomSpriteBatch g) { int BorderX = (int)(TileSize.X * 0.1); int BorderY = (int)(TileSize.Y * 0.1); foreach (DelayedAttack ActiveAttack in Map.ListDelayedAttack) { foreach (Vector3 ActivePosition in ActiveAttack.ListAttackPosition) { g.Draw(GameScreen.sprPixel, new Rectangle( (int)(ActivePosition.X - CameraPosition.X) * TileSize.X + BorderX, (int)(ActivePosition.Y - CameraPosition.Y) * TileSize.Y + BorderY, TileSize.X - BorderX * 2, TileSize.Y - BorderY * 2), Color.FromNonPremultiplied(139, 0, 0, 190)); } } }
public void DrawNextPositionForMakers(CustomSpriteBatch g, Texture2D sprPixel) { int Index = SpawnFrame; while (Index >= 0) { g.Draw(sprPixel, new Rectangle((int)DicAnimationKeyFrame[Index].Position.X - 2, (int)DicAnimationKeyFrame[Index].Position.Y - 2, 5, 5), Color.Black); Vector2 ActivePosition = DicAnimationKeyFrame[Index].Position; if (DicAnimationKeyFrame[Index].NextKeyFrame >= 0) { g.DrawLine(sprPixel, new Vector2(ActivePosition.X, ActivePosition.Y), new Vector2(DicAnimationKeyFrame[DicAnimationKeyFrame[Index].NextKeyFrame].Position.X, DicAnimationKeyFrame[DicAnimationKeyFrame[Index].NextKeyFrame].Position.Y), Color.Black); } Index = DicAnimationKeyFrame[Index].NextKeyFrame; } }
public override void Draw(CustomSpriteBatch g) { float X, Y; DrawNextChoice(g); X = (Map.CursorPosition.X + 1 - Map.CameraPosition.X) * Map.TileSize.X; Y = (Map.CursorPosition.Y - Map.CameraPosition.Y) * Map.TileSize.Y; if (X + MinActionMenuWidth + MinActionMenuWidth + MinActionMenuWidth >= Constants.Width) { X = Constants.Width - MinActionMenuWidth - MinActionMenuWidth - MinActionMenuWidth; } if (ShowSquadMembers) { for (int U = 0; U < ActiveSquad.UnitsAliveInSquad; ++U) { GameScreen.DrawBox(g, new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), MinActionMenuWidth, PannelHeight, Color.White); if (!(ActiveSquad[U] is UnitTransforming) || TransformingUnit.PermanentTransformation) { TextHelper.DrawText(g, ActiveSquad[U].RelativePath, new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), Color.Gray); } else { TextHelper.DrawText(g, ActiveSquad[U].RelativePath, new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), Color.White); } } g.Draw(GameScreen.sprPixel, new Rectangle((int)X + MinActionMenuWidth, (int)Y + ActiveSquad.IndexOf(TransformingUnit) * PannelHeight, 50, 20), Color.FromNonPremultiplied(255, 255, 255, 128)); } /* * Might be needed if we use wingmans * for (int U = 0; U < TransformingUnit.ArrayTransformingUnit.Length; ++U) * { * g.Draw(GameScreen.sprPixel, new Rectangle((int)X + MinActionMenuWidth + MinActionMenuWidth, (int)Y + U * PannelHeight, 50, 20), Color.Navy); * if (TransformingUnit.CanTransform(U, Map.ActiveSquad.CurrentWingmanA, Map.ActiveSquad.CurrentWingmanB)) * TextHelper.DrawText(g, TransformingUnit.ArrayTransformingUnit[U].TransformingUnitName, new Vector2(X + MinActionMenuWidth + MinActionMenuWidth, Y + U * PannelHeight), Color.White); * else * TextHelper.DrawText(g, TransformingUnit.ArrayTransformingUnit[U].TransformingUnitName, new Vector2(X + MinActionMenuWidth + MinActionMenuWidth, Y + U * PannelHeight), Color.Gray); * } * g.Draw(GameScreen.sprPixel, new Rectangle((int)X + MinActionMenuWidth + MinActionMenuWidth, (int)Y + TransformationChoice * PannelHeight, 50, 20), Color.FromNonPremultiplied(255, 255, 255, 128));*/ }
public override void Draw(CustomSpriteBatch g, bool IsInEditMode) { SpriteEffects ActiveEffect = SpriteEffects.None; if (ScaleFactor.X < 0) { ActiveEffect = SpriteEffects.FlipHorizontally; } if (ScaleFactor.Y < 0) { ActiveEffect |= SpriteEffects.FlipVertically; } g.Draw(SpriteSheet, new Vector2(Position.X, Position.Y), SourceRectangle, Color.FromNonPremultiplied(255, 255, 255, Alpha), Angle, new Vector2(Origin.X, Origin.Y), new Vector2(Math.Abs(ScaleFactor.X), Math.Abs(ScaleFactor.Y)), ActiveEffect, DrawingDepth); }
public virtual void DrawEditor(CustomSpriteBatch g, int ScreenWidth, int ScreenHeight, bool IsInEditMode, bool ShowBorderBoxes, bool ShowNextPositions) { GraphicsDevice.SetRenderTarget(null); GraphicsDevice.Clear(Color.White); if (ActiveAnimationBackground != null) { ActiveAnimationBackground.Draw(g, ScreenWidth, ScreenHeight); } g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); for (int L = 0; L < ListAnimationLayer.Count; L++) { AnimationLayer ActiveLayer = ListAnimationLayer[L]; if (ActiveLayer.ListPolygonCutter.Count > 0) { g.End(); g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); PolygonEffect.Texture = ActiveLayer.renderTarget; PolygonEffect.CurrentTechnique.Passes[0].Apply(); GraphicsDevice.RasterizerState = RasterizerState.CullNone; for (int P = 0; P < ActiveLayer.ListPolygonCutter.Count; P++) { ActiveLayer.ListPolygonCutter[P].Draw(g, IsInEditMode); } } if (IsInEditMode || ActiveLayer.ListPolygonCutter.Count <= 0) { g.Draw(ActiveLayer.renderTarget, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.1f); } } g.End(); //Draw HUD DrawOverlay(g); }
/// <summary> /// Render some text directly to the spritebatch. /// </summary> /// <param name="sb">The spritebatch to draw with.</param> /// <param name="str">The string.</param> /// <param name="pos">The top-left position to draw the text at.</param> /// <param name="color">The color to draw the text with.</param> public void Render(CustomSpriteBatch sb, string str, Vector2 pos, Color color) { //TODO: Word wrapping int curX = 0; int curY = 0; foreach (char c in str) { var fc = m_font.Chars.Find(f => f.ID == c); var texture = m_pages[fc.Page]; var rectSource = new Rectangle(fc.X, fc.Y, fc.Width, fc.Height); var rectDest = new RotRect(pos.X + curX + fc.XOffset, pos.Y + curY + fc.YOffset, fc.Width, fc.Height); sb.Draw(texture, rectSource, rectDest, color, false, false, false); curX += fc.XAdvance + ExtraKerning; } }
public override void Draw(CustomSpriteBatch g) { if (AnimationPhase == 0) { DrawIntro(g); } else if (AnimationPhase == AnimationPhases.Outro) { DrawOutro(g); } else { DrawnCard.DrawCard(g); DrawnCard.DrawCardInfo(g, Map.fntArial12); GameScreen.DrawBox(g, new Vector2(Constants.Width / 2 - 100, Constants.Height - 70), 200, 30, Color.White); g.DrawStringMiddleAligned(Map.fntArial12, "Drew 1 card", new Vector2(Constants.Width / 2, Constants.Height - 65), Color.White); g.Draw(GameScreen.sprPixel, new Rectangle(Constants.Width / 2 + 76, Constants.Height - 65, 18, 18), Color.White); } }
public override void Draw(CustomSpriteBatch g, int NonDemoAnimationTimer) { int SupportPosX = 150 - (int)(NonDemoAnimationTimer / NonDemoBattleFrame.SwitchLength * 120); float DrawPositionX; if (IsRight) { DrawPositionX = PositionX - 120 + SupportPosX; } else { DrawPositionX = PositionX + 120 - SupportPosX; } DrawBackgroundBox(g, DrawPositionX, PositionY); g.Draw(SharedUnitStats.SharedUnit.SpriteMap, new Vector2( DrawPositionX + 2, PositionY + 8), Color.White); }
public virtual void Draw(CustomSpriteBatch g, Vector2 Position) { if (IsAnimated) { ActiveAnimation.TransformationMatrix = Matrix.CreateTranslation(-ActiveAnimation.AnimationOrigin.Position.X, -ActiveAnimation.AnimationOrigin.Position.Y, 0) * Matrix.CreateRotationZ(Angle) * Matrix.CreateScale(Scale.X, Scale.Y, 1f) * Matrix.CreateTranslation(Position.X, Position.Y, 0); ActiveAnimation.Draw(g); } else if (StaticSprite != null) { g.Draw(StaticSprite, Position, new Rectangle(0, 0, StaticSprite.Width, StaticSprite.Height), Color.White, Angle, Origin, AbsoluteScale, ScaleEffect, Depth); } else { ActualSprite.Draw(g, Position, Color.White, Angle, Depth); } }
public override void Draw(CustomSpriteBatch g, Vector2 Position) { if (IsAnimated) { ActiveAnimation.TransformationMatrix = Matrix.CreateTranslation(-ActiveAnimation.AnimationOrigin.Position.X, -ActiveAnimation.AnimationOrigin.Position.Y, 0) * Matrix.CreateRotationZ(Angle) * Matrix.CreateScale(Scale.X, Scale.Y, 1f) * Matrix.CreateTranslation(Position.X, Position.Y, 0); ActiveAnimation.Draw(g); } else if (StaticSprite != null) { g.Draw(StaticSprite, Position, new Rectangle(0, 0, StaticSprite.Width, StaticSprite.Height), Color.FromNonPremultiplied(255, 255, 255, 127), Angle, Origin, AbsoluteScale, ScaleEffect, Depth); } else { ActualSprite.Draw(g, Position, Color.FromNonPremultiplied(255, 255, 255, (int)(TimeAliveInSecondsRemaining / TimeAliveInSeconds * 127)), Angle, Depth); } }
public void Draw(CustomSpriteBatch g) { if (ButtonState == ButtonStates.Idle) { GameScreen.DrawBox(g, new Vector2(ButtonCollsionBox.X, ButtonCollsionBox.Y), ButtonCollsionBox.Width, ButtonCollsionBox.Height, Color.White); } else if (ButtonState == ButtonStates.Disabled) { GameScreen.DrawBox(g, new Vector2(ButtonCollsionBox.X, ButtonCollsionBox.Y), ButtonCollsionBox.Width, ButtonCollsionBox.Height, Color.Black); } else if (ButtonState == ButtonStates.Open) { GameScreen.DrawBox(g, new Vector2(ButtonCollsionBox.X, ButtonCollsionBox.Y), ButtonCollsionBox.Width, ButtonCollsionBox.Height, Color.Black); GameScreen.DrawBox(g, new Vector2(ButtonCollsionBox.X, ButtonCollsionBox.Y + ButtonCollsionBox.Height), ButtonCollsionBox.Width, ButtonCollsionBox.Height * Choices.Length, Color.White); for (int C = 0; C < Choices.Length; ++C) { g.DrawStringVerticallyAligned(fntText, Choices[C], new Vector2(ButtonCollsionBox.X + 5, ButtonCollsionBox.Y + ButtonCollsionBox.Height / 2 + ButtonCollsionBox.Height + ButtonCollsionBox.Height * C), Color.White); if (MouseHelper.MouseStateCurrent.X >= ButtonCollsionBox.X && MouseHelper.MouseStateCurrent.X <= ButtonCollsionBox.X + ButtonCollsionBox.Width && MouseHelper.MouseStateCurrent.Y >= ButtonCollsionBox.Y + ButtonCollsionBox.Height + ButtonCollsionBox.Height * C && MouseHelper.MouseStateCurrent.Y < ButtonCollsionBox.Y + ButtonCollsionBox.Height + ButtonCollsionBox.Height * (C + 1)) { g.Draw(GameScreen.sprPixel, new Rectangle(ButtonCollsionBox.X + 4, ButtonCollsionBox.Y + 4 + ButtonCollsionBox.Height + ButtonCollsionBox.Height * C, ButtonCollsionBox.Width - 8, ButtonCollsionBox.Height - 8), Color.FromNonPremultiplied(255, 255, 255, 127)); } } } else if (ButtonState == ButtonStates.Hover) { GameScreen.DrawBox(g, new Vector2(ButtonCollsionBox.X, ButtonCollsionBox.Y), ButtonCollsionBox.Width, ButtonCollsionBox.Height, Color.Gray); } g.DrawStringVerticallyAligned(fntText, SelectedItem, new Vector2(ButtonCollsionBox.X + 5, ButtonCollsionBox.Y + ButtonCollsionBox.Height / 2), Color.White); }
public void Draw(CustomSpriteBatch g, int LayerIndex, bool IsSubLayer) { MapLayer Owner = Map.LayerManager.ListLayer[LayerIndex]; if (!Owner.IsVisible) { return; } float BaseHeight = LayerIndex; for (int X = Owner.LayerGrid.ArrayTile.GetLength(0) - 1; X >= 0; --X) { for (int Y = Owner.LayerGrid.ArrayTile.GetLength(1) - 1; Y >= 0; --Y) { Color FinalColor = Color.White; float FinalHeight = BaseHeight + Owner.ArrayTerrain[X, Y].Position.Z; if (FinalHeight > CameraPosition.Z) { FinalColor.A = (byte)Math.Min(255, 255 - (FinalHeight - CameraPosition.Z) * 255); } g.Draw(Map.ListTileSet[Owner.LayerGrid.ArrayTile[X, Y].TilesetIndex], new Vector2((X - CameraPosition.X) * TileSize.X, (Y - CameraPosition.Y) * TileSize.Y), Owner.LayerGrid.ArrayTile[X, Y].Origin, FinalColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, Owner.LayerGrid.Depth); } } for (int P = 0; P < Owner.ListProp.Count; ++P) { Owner.ListProp[P].Draw(g); } if (Map.ShowUnits && !IsSubLayer) { DrawDrawablePoints(g); DrawCursor(g); } }
public virtual void DrawCardInfo(CustomSpriteBatch g, SpriteFont fntCardInfo) { float InfoBoxX = Constants.Width / 1.8f; float InfoBoxY = Constants.Height / 10; int BoxWidth = (int)(Constants.Width / 2.8); int BoxHeight = (int)(Constants.Height / 2); GameScreen.DrawBox(g, new Vector2(InfoBoxX, InfoBoxY), BoxWidth, BoxHeight, Color.White); float CurrentX = InfoBoxX + 10; float CurrentY = InfoBoxY + 5; g.DrawString(fntCardInfo, CardType + " Card", new Vector2(CurrentX, CurrentY), Color.White); CurrentY += 20; g.DrawString(fntCardInfo, Name, new Vector2(CurrentX, CurrentY), Color.White); g.Draw(GameScreen.sprPixel, new Rectangle((int)InfoBoxX + BoxWidth - 30, (int)CurrentY, 18, 18), Color.White); CurrentY += 20; g.DrawString(fntCardInfo, CardType, new Vector2(CurrentX, CurrentY), Color.White); g.Draw(GameScreen.sprPixel, new Rectangle((int)InfoBoxX + BoxWidth - 30, (int)CurrentY, 18, 18), Color.White); CurrentY += 20; if (CardType == CreatureCard.CreatureCardType) { CreatureCard ActiveCard = (CreatureCard)this; g.Draw(GameScreen.sprPixel, new Rectangle((int)CurrentX, (int)CurrentY, 18, 18), Color.White); g.DrawString(fntCardInfo, ActiveCard.MaxST.ToString(), new Vector2(CurrentX + 20, CurrentY), Color.White); g.Draw(GameScreen.sprPixel, new Rectangle((int)CurrentX + 50, (int)CurrentY, 18, 18), Color.White); g.DrawString(fntCardInfo, ActiveCard.CurrentHP.ToString(), new Vector2(CurrentX + 70, CurrentY), Color.White); g.Draw(GameScreen.sprPixel, new Rectangle((int)CurrentX + 100, (int)CurrentY, 18, 18), Color.White); g.DrawString(fntCardInfo, ActiveCard.MaxHP.ToString(), new Vector2(CurrentX + 120, CurrentY), Color.White); } CurrentY += 20; g.Draw(GameScreen.sprPixel, new Rectangle((int)CurrentX, (int)CurrentY, 18, 18), Color.White); g.DrawString(fntCardInfo, MagicCost.ToString(), new Vector2(CurrentX + 20, CurrentY), Color.White); CurrentY += 20; g.DrawString(fntCardInfo, Description.ToString(), new Vector2(CurrentX, CurrentY), Color.White); }
public override void Draw(CustomSpriteBatch g) { g.End(); g.Begin(SpriteSortMode.Deferred, null); int LineHeight = 20; DrawBox(g, new Vector2(40, 40), Constants.Width - 80, Constants.Height - 80, Color.White); DrawText(g, "Normal", new Vector2(50, 50), Color.White); DrawText(g, "Super Tree Wars", new Vector2(50, 50 + LineHeight * 1), Color.White); DrawText(g, "Intermission", new Vector2(50, 50 + LineHeight * 2), Color.White); DrawText(g, "Multiplayer", new Vector2(50, 50 + LineHeight * 3), Color.White); DrawText(g, "World Map", new Vector2(50, 50 + LineHeight * 4), Color.White); DrawText(g, "Conquest", new Vector2(50, 50 + LineHeight * 5), Color.White); DrawText(g, "Sorcerer Street", new Vector2(50, 50 + LineHeight * 6), Color.White); DrawText(g, "Racing", new Vector2(50, 50 + LineHeight * 7), Color.White); DrawText(g, "Super Tank", new Vector2(50, 50 + LineHeight * 8), Color.White); DrawText(g, "Triple Thunder", new Vector2(50, 50 + LineHeight * 9), Color.White); g.Draw(sprPixel, new Rectangle(50, 50 + SelectedChoice * LineHeight, Constants.Width - 100, LineHeight), Color.FromNonPremultiplied(255, 255, 255, 127)); }