//TODO: Optional Unit (Hwp - takes up 4 spots, soldier, civilian, alien) //TODO: Battle items on ground (including dead/unconscious aliens/soldiers/civilians) //TODO: State of tile (fire, smoke, open door, etc.) //TODO: Selection state (selected, special icon, below selection, active selection, etc.) //TODO: Fog of war state //TODO: Brightness public void Render(GraphicsBuffer buffer, int topRow, int leftColumn) { Ground.Render(buffer, topRow, leftColumn); NorthWall.Render(buffer, topRow, leftColumn); WestWall.Render(buffer, topRow, leftColumn); Entity.Render(buffer, topRow, leftColumn); }
public void Render(GraphicsBuffer buffer) { var space = craft.CraftType.Metadata().Space; if (space == 0) return; var nextLeftColumn = 96; foreach (var index in Enumerable.Range(0, craft.SoldierIds.Count)) { var leftColumn = nextLeftColumn; nextLeftColumn += crew.Width - 1; crew.Render(buffer, 96, leftColumn); } nextLeftColumn = 96; foreach (var index in Enumerable.Range(0, (craft.TotalItemCount + 3) / 4)) { var leftColumn = nextLeftColumn; nextLeftColumn += items.Width - 2; items.Render(buffer, 120, leftColumn); } foreach (var index in Enumerable.Range(0, craft.TotalHwpCount)) { var leftColumn = nextLeftColumn; nextLeftColumn += tank.Width - 2; tank.Render(buffer, 120, leftColumn); } }
public override void Render(GraphicsBuffer buffer) { base.Render(buffer); var time = GameState.Current.Data.Time; RenderTime(buffer, time); RenderDate(buffer, time); }
public void Render(GraphicsBuffer buffer) { var pattern = new[] { scheme.Base, scheme.Light, scheme.Lighter, scheme.Light, scheme.Base }; foreach (var index in Enumerable.Range(0, pattern.Length)) buffer.DrawFrame( topRow + index, leftColumn + index, width - 2 * index, height - 2 * index, pattern[index]); buffer.DrawBackground( background, topRow + pattern.Length, leftColumn + pattern.Length, width - 2 * pattern.Length, height - 2 * pattern.Length, paletteIndex); }
public void Render(GraphicsBuffer buffer) { buffer.DrawHorizontalLine(topRow, leftColumn, width, borderColor); buffer.DrawHorizontalLine(topRow + height - 1, leftColumn, width, borderColor); buffer.DrawVerticalLine(topRow, leftColumn + width, height, borderColor); buffer.FillRect(topRow + 1, leftColumn, position, height - 2, fillColor); if (unfilledColor != null) buffer.FillRect(topRow + 1, leftColumn + position, width - position, height - 2, unfilledColor.Value); }
public void Render(GraphicsBuffer buffer, int topRow, int leftColumn) { //TODO: cycle through animated frames (but control cycling through door frames) var partData = PartData; var image = TileType.Image(partData.Images[0]); if (image == null) return; buffer.DrawItem(topRow - partData.VerticalImageOffset, leftColumn, image); }
private static void RenderTime(GraphicsBuffer buffer, DateTime time) { var hour = time.ToString("%H"); Font.Large.DrawString(buffer, 74, hour.Length == 1 ? 269 : 259, hour, ColorScheme.LightBlue); Font.Large.DrawString(buffer, 74, 279, ":", ColorScheme.LightBlue); Font.Large.DrawString(buffer, 74, 283, time.ToString("mm"), ColorScheme.LightBlue); Font.Large.DrawString(buffer, 74, 303, ":", ColorScheme.LightBlue); Font.Normal.DrawString(buffer, 80, 307, time.ToString("ss"), ColorScheme.LightBlue); }
public void Render(GraphicsBuffer buffer, bool flash) { var metadata = WorldObjectType.Metadata(); var color = Palette.GetPalette(0).GetColor(metadata.PaletteIndex + (flash ? 1 : 0)); foreach (var x in Enumerable.Range(0, 3)) foreach (var y in Enumerable.Range(0, 3)) if (metadata.Mask[x][y]) buffer.SetPixel(Location.Y + y - 1, Location.X + x - 1, color); }
public override void Render(GraphicsBuffer buffer) { base.Render(buffer); var textWidth = Font.MeasureString(Text); var textRightColumn = LeftColumn + textWidth; var fillWidth = width - textWidth; var fillCount = fillWidth / (Font.MeasureString(".") - 1); var fillText = new string('.', fillCount); Font.DrawString(buffer, TopRow, textRightColumn - 1, fillText, fillScheme); }
public void Render(GraphicsBuffer buffer) { buffer.DrawBackground( background, 0, 0, GraphicsBuffer.GameWidth, GraphicsBuffer.GameHeight, paletteIndex); }
private static void RenderDate(GraphicsBuffer buffer, DateTime time) { var weekday = time.ToString("dddd"); var weekdayLeftColumn = Label.CenterOf(257, 63).CalculateTextColumn(weekday, Font.Normal); Font.Normal.DrawString(buffer, 87, weekdayLeftColumn, weekday, ColorScheme.LightBlue); Font.Normal.DrawString(buffer, 94, 267, time.Day.FormatOrdinal(), ColorScheme.LightBlue); Font.Normal.DrawString(buffer, 94, 295, time.ToString("MMM"), ColorScheme.LightBlue); var year = time.ToString("yyyy"); var yearLeftColumn = Label.CenterOf(257, 63).CalculateTextColumn(year, Font.Normal); Font.Normal.DrawString(buffer, 101, yearLeftColumn, year, ColorScheme.LightBlue); }
public void Render(GraphicsBuffer buffer) { foreach (var row in Enumerable.Range(0, 200)) { foreach (var column in Enumerable.Range(0, 320)) { var paletteIndex = image[row, column]; buffer.SetPixel(row, column, palette[paletteIndex]); } } }
private void RenderWeapon1(GraphicsBuffer buffer) { if (craft.Weapons.Count < 1) return; var weapon = craft.Weapons[0]; var metadata = weapon.WeaponType.Metadata(); Font.Normal.DrawString(buffer, 48, 56, metadata.Name, ColorScheme.DarkYellow); Font.Normal.DrawString(buffer, 64, 56, "AMMO>", ColorScheme.Blue); Font.Normal.DrawString(buffer, 64, 82, weapon.Ammunition.FormatNumber(), ColorScheme.DarkYellow); Font.Normal.DrawString(buffer, 72, 56, "MAX>", ColorScheme.Blue); Font.Normal.DrawString(buffer, 72, 77, metadata.Ammunition.FormatNumber(), ColorScheme.DarkYellow); metadata.Image.Render(buffer, 63, 121); }
private void RenderWeapon2(GraphicsBuffer buffer) { if (craft.Weapons.Count < 2) return; var weapon = craft.Weapons[1]; var metadata = weapon.WeaponType.Metadata(); Font.Normal.DrawString(buffer, 48, 204, metadata.Name, ColorScheme.DarkYellow); Font.Normal.DrawString(buffer, 64, 204, "AMMO>", ColorScheme.Blue); Font.Normal.DrawString(buffer, 64, 230, weapon.Ammunition.FormatNumber(), ColorScheme.DarkYellow); Font.Normal.DrawString(buffer, 72, 204, "MAX>", ColorScheme.Blue); Font.Normal.DrawString(buffer, 72, 225, metadata.Ammunition.FormatNumber(), ColorScheme.DarkYellow); metadata.Image.Render(buffer, 63, 184); }
public void DrawString( GraphicsBuffer buffer, int topRow, int leftColumn, string value, ColorScheme scheme) { var column = leftColumn; foreach (var character in value.Select(GetCharacter)) { character.Render(buffer, topRow, column, scheme); column += character.Width - 1; } }
public void Render(GraphicsBuffer buffer, int topRow, int leftColumn) { foreach (var row in Enumerable.Range(0, Tiles.GetLength(0))) foreach (var column in Enumerable.Range(0, Tiles.GetLength(1))) { var top = topRow + column * 8 + row * 8; var left = leftColumn + column * 16 - row * 16; var bottom = top + 40; var right = left + 32; if (bottom < 0 || right < 0 || top >= 144 || left >= 320) continue; Tiles[row, column].Render(buffer, top, left); } }
private static void DrawUnitInformation(GraphicsBuffer buffer, Unit unit) { if (unit == null) return; Font.Normal.DrawString(buffer, 176, 134, unit.Name, ColorScheme.Blue); Font.Small.DrawString(buffer, 186, 136, $"{unit.TimeUnits}", ColorScheme.LightGreen); Font.Small.DrawString(buffer, 194, 136, $"{unit.Health}", ColorScheme.Red); Font.Small.DrawString(buffer, 186, 154, $"{unit.Energy}", ColorScheme.Orange); Font.Small.DrawString(buffer, 194, 154, $"{unit.Morale}", ColorScheme.Purple); new Bar(185, 170, unit.MaxTimeUnits, 3, unit.TimeUnits, 55, 48).Render(buffer); new Bar(189, 170, unit.MaxEnergy, 3, unit.Energy, 23, 16).Render(buffer); new Bar(193, 170, unit.MaxHealth, 3, unit.Health, 39, 32).Render(buffer); new Bar(197, 170, unit.MaxMorale, 3, unit.Morale, 249, 247).Render(buffer); unit.Rank?.Image().Render(buffer, 177, 107); }
public void Render(GraphicsBuffer buffer, int topRow, int leftColumn, ColorScheme scheme) { foreach (var rowIndex in Enumerable.Range(0, height)) { foreach (var columnIndex in Enumerable.Range(0, Width)) { var colorIndex = data[rowIndex * Width + columnIndex]; if (colorIndex != 0) buffer.SetPixel( topRow + rowIndex, leftColumn + columnIndex, scheme.GetColor(colorIndex)); } } }
public void Render(GraphicsBuffer buffer, int topRow, int leftColumn) { var nextIndex = sizeof(int) * 2; foreach (var row in Enumerable.Range(0, Height)) { foreach (var column in Enumerable.Range(0, Width)) { var index = nextIndex; nextIndex += 4; if (data[index + 3] != 0) { buffer.SetPixel( topRow + Height - row - 1, leftColumn + column, Color.FromArgb(data[index], data[index + 1], data[index + 2])); } } } }
public override void Render(GraphicsBuffer buffer) { foreach (var index in Enumerable.Range(0, 8)) { var baseLeftColumn = leftColumn + index * 16; preview.Render(buffer, topRow + 1, baseLeftColumn + 1); if (index == GameState.Current.Data.SelectedBase) buffer.DrawFrame(topRow, baseLeftColumn, 16, 16, Color.White); if (index >= GameState.Current.Data.Bases.Count) continue; foreach (var facility in GameState.Current.Data.Bases[index].Facilities) { var facilityTopRow = topRow + 2 + facility.Row * 2; var facilityLeftColumn = baseLeftColumn + 2 + facility.Column * 2; var image = GetFacilityPreviewImage(facility); image.Render(buffer, facilityTopRow, facilityLeftColumn); } } }
//private int firingFrame; //TODO: Floater //TODO: Snakeman //HWPs (large 4x4 images) //TODO: Tanks (tanks, laser, hover) //TODO: Cyberdisc //TODO: Reaper //TODO: Sectopod //TODO: Ground items public override void Render(GraphicsBuffer buffer) { //base.Render(buffer); //var item = new BattleItem { Item = WeaponType.BlasterLauncher }; const BattleItem item = null; var sprites = Sprite.Chryssalid; var death = Animation.ChryssalidDeath; //var firing = Animation.CelatidFiring; sprites[Direction.North].Render(buffer, 0, 144, item); sprites[Direction.NorthEast].Render(buffer, 0, 176, item); sprites[Direction.East].Render(buffer, 0, 208, item); sprites[Direction.SouthEast].Render(buffer, 0, 240, item); sprites[Direction.South].Render(buffer, 80, 240, item); sprites[Direction.SouthWest].Render(buffer, 80, 208, item); sprites[Direction.West].Render(buffer, 80, 176, item); sprites[Direction.NorthWest].Render(buffer, 80, 144, item); if (stopwatch.ElapsedMilliseconds > 1000) { frame = (frame + 1) % sprites[Direction.North].FrameCount; deathFrame = (deathFrame + 1) % death.FrameCount; //firingFrame = (firingFrame + 1) % firing.FrameCount; stopwatch.Restart(); } sprites[Direction.North].Animate(buffer, 40, 144, item, frame); sprites[Direction.NorthEast].Animate(buffer, 40, 176, item, frame); sprites[Direction.East].Animate(buffer, 40, 208, item, frame); sprites[Direction.SouthEast].Animate(buffer, 40, 240, item, frame); sprites[Direction.South].Animate(buffer, 120, 240, item, frame); sprites[Direction.SouthWest].Animate(buffer, 120, 208, item, frame); sprites[Direction.West].Animate(buffer, 120, 176, item, frame); sprites[Direction.NorthWest].Animate(buffer, 120, 144, item, frame); death.Animate(buffer, 0, 0, deathFrame); //firing.Animate(buffer, 0, 32, firingFrame); Font.Normal.DrawString(buffer, 100, 0, $"Frame {frame}", ColorScheme.White); Font.Normal.DrawString(buffer, 110, 0, $"Death {deathFrame}", ColorScheme.White); }
public void Render(GraphicsBuffer buffer) { ActiveScreen?.Render(buffer); }
public override void Render(GraphicsBuffer buffer) { RenderBackground(buffer); if (mode == Mode.PlaceAccessLift) { Font.Normal.DrawString(buffer, 0, 10, "SELECT POSITION FOR ACCESS LIFT", ColorScheme.Yellow); return; } RenderFacilities(buffer); RenderPreviewText(buffer); RenderFocusRectangle(buffer); }
private void RenderPreviewText(GraphicsBuffer buffer) { if (mode != Mode.ViewFacilities) return; var position = GameState.Current.PointerPosition; var facilityPoint = GetFacilityPoint(position.X, position.Y); if (facilityPoint != null) { var facility = GameState.SelectedBase.FindFacilityAt(facilityPoint.Row, facilityPoint.Column, true); if (facility != null) Font.Normal.DrawString(buffer, 0, 0, facility.FacilityType.Metadata().Name, ColorScheme.Blue); } }
private void RenderFocusRectangle(GraphicsBuffer buffer) { if (mode != Mode.BuildFacility) return; var position = GameState.Current.PointerPosition; var facilityPoint = GetFacilityPoint(position.X, position.Y); if (facilityPoint != null && IsSpaceAvailable(facilityPoint.Row, facilityPoint.Column)) buffer.DrawFrame( facilityPoint.Row * 32 + 8, facilityPoint.Column * 32, FacilitySize * 32, FacilitySize * 32, Color.FromArgb(255, 255, 0)); }
private static void RenderHangarBridges(GraphicsBuffer buffer, Facility facility) { var topRow = facility.Row * 32 + 8; var leftColumn = facility.Column * 32; if (IsFacilityAt(facility.Row + 2, facility.Column, false)) verticalBridge.Render(buffer, topRow + 32 + 29, leftColumn + 12); if (IsFacilityAt(facility.Row + 2, facility.Column + 1, false)) verticalBridge.Render(buffer, topRow + 32 + 29, leftColumn + 32 + 12); if (IsFacilityAt(facility.Row, facility.Column + 2, false)) horizontalBridge.Render(buffer, topRow + 12, leftColumn + 32 + 29); if (IsFacilityAt(facility.Row + 1, facility.Column + 2, false)) horizontalBridge.Render(buffer, topRow + 32 + 12, leftColumn + 32 + 29); }
private static void RenderFacility(GraphicsBuffer buffer, Facility facility) { var topRow = facility.Row * 32 + 8; var leftColumn = facility.Column * 32; var metadata = facility.FacilityType.Metadata(); if (metadata.Shape != FacilityShape.Hangar) metadata.Image.Render(buffer, topRow + metadata.RowOffset, leftColumn + metadata.ColumnOffset); if (facility.DaysUntilConstructionComplete == 0) return; var daysRemaining = facility.DaysUntilConstructionComplete.ToString(CultureInfo.InvariantCulture); var size = metadata.Shape.Size() * 32; var textTopRow = topRow + (size - Font.Large.Height) / 2; var textLeftColumn = leftColumn + (size - Font.Large.MeasureString(daysRemaining)) / 2; Font.Large.DrawString(buffer, textTopRow, textLeftColumn, daysRemaining, ColorScheme.Yellow); }
private static void RenderFacilities(GraphicsBuffer buffer) { var selectedBase = GameState.SelectedBase; foreach (var facility in selectedBase.Facilities) RenderBuilding(buffer, facility); foreach (var facility in selectedBase.Facilities) RenderBridges(buffer, facility); foreach (var facility in selectedBase.Facilities) RenderFacility(buffer, facility); RenderCrafts(buffer); }
public override void Render(GraphicsBuffer buffer) { Font.UpDownButtons.DrawString(buffer, topRow, leftColumn, "U", state == State.Up ? scheme.Inverse : scheme); Font.UpDownButtons.DrawString(buffer, topRow, leftColumn + 12, "D", state == State.Down ? scheme.Inverse : scheme); }
private static void RenderCrafts(GraphicsBuffer buffer) { var selectedBase = GameState.SelectedBase; var crafts = selectedBase.Crafts.Where(craft => craft.Status != CraftStatus.Out).ToList(); var hangars = selectedBase.Facilities.Where(facility => facility.FacilityType == FacilityType.Hangar).ToList(); foreach (var craftAndHangar in hangars.Zip(crafts, (hangar, craft) => new {Hangar = hangar, Craft = craft})) RenderCraft(buffer, craftAndHangar.Hangar, craftAndHangar.Craft); }