public Menu() : base("MenuBackgroundDefault") { //a menu will fit its bounds to the camera Bounds = new Zone(Global.Camera.TopLeftCorner.X, Global.Camera.TopLeftCorner.Y, (Global.Camera.Center.X - Global.Camera.TopLeftCorner.X) * 2, (Global.Camera.Center.Y - Global.Camera.TopLeftCorner.Y) * 2); background.Bounds.Center = Bounds.Center; }
public ControllableObject(Player owner, Zone initialBounds) : base(initialBounds) { Owner = owner; Owner.AddObject(this); currentTask = new IdleTask(); currentTask.Finished = true; }
public Resource(Zone initialBounds) : base(initialBounds) { //initialize element array elements = new int[88]; for (int i = 0; i < Elements.Length; i++) { elements[i] = 0; } //initialize sprites Idle = new Animation("WhitePixel"); BeingMined = new Animation("WhitePixel"); Consumed = new Animation("WhitePixel"); }
public override void Draw() { base.Draw(); foreach (GroupedSprite gs in Sprites.Values) { if (gs.IsVisible) { if (FitSpritesToBounds) gs.Sprite.Draw(new Zone(Left, Top, Width, Height)); else { Zone z = new Zone(0, 0, gs.Sprite.Bounds.Width, gs.Sprite.Bounds.Height); z.Center = Center + gs.Offset; gs.Sprite.Draw(z); } } } }
private Vector2 position; //the center of the MapObject #endregion Fields #region Constructors public MapObject(Zone initialBounds) { this.bounds = initialBounds; this.bounds.LockDimensions = true; this.position = new Vector2(-1, -1); if (!(this is EmptySpace || this is Location)) { //set the position of this object to place in the map array Position = new Vector2(bounds.Left, bounds.Top); //add this object to the list of map objects Scenario.Map.AddObject(this); } this.position = bounds.Center.Vector; //development diagnostic DrawBorder = true; }
//moar to come! public Scenario() { //set up Screen stuff Bounds = new Zone(0, 0, 2048, 2048); background.SpriteName = "Dirt"; background.Bounds = new Zone(0, 0, 2048, 2048); //set up Map (based on configuration variables above) map = new RandomMap(new Point(2048, 2048), MapType); players = new List<Player>(); instance = this; ((RandomMap)map).Populate(); players.Add(new HumanPlayer(Color.Red)); new Gatherer(Players[0], new Point(400, 400)); new BigAssWall(Players[0], Map, new Point(500, 20)); }
public override void Draw() { Zone z = new Zone(Bounds.Center.X, Bounds.Center.Y, 0, 0); //draw the border pixel.Color = BorderColor; pixel.Draw(Bounds); //draw the left half pixel.Color = FillColor1; z.Left = Bounds.Left + BorderThickness; z.Top = Bounds.Top - BorderThickness; z.Bottom = Bounds.Bottom + BorderThickness; z.Right = z.Left + (int)(factorFull * (Bounds.Width - 2 * BorderThickness)); pixel.Draw(z); //draw the right half pixel.Color = FillColor2; z.Right = Bounds.Right - BorderThickness; z.Left = z.Right - (int)((1.0f - factorFull) * (Bounds.Width - 2 * BorderThickness)); pixel.Draw(z); }
public Unit(Player owner, Zone initialBounds) : base(owner, initialBounds) { Idle = new Animation("WhitePixel"); Idle.Bounds.Width = this.Width; Idle.Bounds.Height = this.Height; Moving = new Animation("WhitePixel"); Moving.Bounds.Width = this.Width; Moving.Bounds.Height = this.Height; Attacking = new Animation("WhitePixel"); Attacking.Bounds.Width = this.Width; Attacking.Bounds.Height = this.Height; Dying = new Animation("WhitePixel"); Dying.Bounds.Width = this.Width; Dying.Bounds.Height = this.Height; }
public void Draw(Resource r) { //draw the border pixel.Color = BorderColor; pixel.Draw(new Zone(Bounds.Left, Bounds.Top, Bounds.Width - 1, Bounds.Height)); //draw each element Zone z = new Zone(Bounds.Left + BorderThickness, Bounds.Top + BorderThickness, 0, 0); z.Bottom = Bounds.Bottom - BorderThickness; float percentageComplete = 0.0f; for (int i = 0; i < 88; i++) { if (r.Elements[i] == 0) continue; //only proceed if there's something worth drawing pixel.Color = Elements.GetElement(i).Color; //draw it the corresponding element color float width = ((float)r.Elements[i] / (float)r.TotalUnits) * ((float)Bounds.Width - 2 * BorderThickness); z.Right = (int)(Bounds.Left + BorderThickness + percentageComplete * (Bounds.Width - 2 * BorderThickness) + width); z.Left = (int)(Bounds.Left + BorderThickness + percentageComplete * (Bounds.Width - 2 * BorderThickness)); percentageComplete += (float)r.Elements[i] / (float)r.TotalUnits; pixel.Draw(z); } }
public ProgressBar(Zone bounds) { Bounds = bounds; }
public static void DrawPixel(Zone bounds, Color color) { if (pixel == null) pixel = new Sprite("WhitePixel"); pixel.Color = color; pixel.Draw(bounds); }
public bool Contains(Zone z) { if (this.Mode != z.Mode) throw new Exception("Attempted to compare zones of differing coordinate modes."); else { return (this.Left <= z.Left && this.Right >= z.Right && this.Top <= z.Top && this.Bottom >= z.Bottom); } }
public void Draw(Zone z) { //draw this sprite to an external Zone Global.SpriteBatch.Draw(Sprites.Textures[texture], z.WindowCoordinates.Rectangle, frame, Color); }
public Screen(string backgroundSpriteName = "None") { background = new Sprite(backgroundSpriteName); Bounds = new Zone(0, 0, background.Bounds.Width, background.Bounds.Height); }
public void DrawBorder() { Zone z = new Zone(); z.Center = Center; //top line z.Left = Left - 1; z.Top = Top - 1; z.Right = Right; z.Bottom = Top; Utility.DrawPixel(z, Color.Tomato); //right line z.Right = Right + 1; z.Left = Right; z.Bottom = Bottom; Utility.DrawPixel(z, Color.Tomato); //bottom line z.Bottom = Bottom + 1; z.Top = Bottom; z.Left = Left; Utility.DrawPixel(z, Color.Tomato); //left line z.Left = Left - 1; z.Right = Left; z.Top = Top; Utility.DrawPixel(z, Color.Tomato); }
public static void Draw() { cursor.Draw(); pixel.Color = Color.ForestGreen; pixel.Color.A = 1; pixel.Draw(SelectionBox); pixel.Color = Color.White; //draw four lines by stretching pixel Zone z = new Zone(Zone.ZoneModeEnum.WindowCoordinates, 0, 0, 0, 0); //top line z.Left = SelectionBox.Left; z.Right = SelectionBox.Right; z.Top = SelectionBox.Top; z.Bottom = SelectionBox.Top + 1; pixel.Draw(z); //bottom line z.Bottom = SelectionBox.Bottom; z.Top = SelectionBox.Bottom - 1; pixel.Draw(z); //left line z.Right = SelectionBox.Left + 1; z.Top = SelectionBox.Top; pixel.Draw(z); //right line z.Right = SelectionBox.Right; z.Left = SelectionBox.Right - 1; pixel.Draw(z); }
public BoundedObject() { Bounds = new Zone(0, 0, 0, 0); }
public SelectableObject(Zone bounds) : base(bounds) { }
//this special type of bar is for Resource objects and display all the elements //contained by the Resource according to color and percentage public ResourceBar(Zone initialBounds) : base(initialBounds) { }
public SpriteGroup(Map m, Zone initialBounds) : base(m, initialBounds) { }
public Tester(Zone z) { ts.Font = Fonts.Consolas; ts.Text = "Test String"; ts.Origin = Global.Origins.Bottom; }
//this class is used by MapObject and Map to designate an empty area of the map public EmptySpace(Zone bounds) : base(bounds) { }
public BoundedObject(Zone initialBounds) { Bounds = initialBounds; }
public AnimatedMapObject(Zone bounds) : base(bounds) { }
public OffensiveUnit(Player owner, Zone bounds) : base(owner, bounds) { }