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 void DrawSprite(GraphicsBuffer buffer, int topRow, int leftColumn, BattleItem item, LegPosition legPosition, int frame) { var isWalking = legPosition == LegPosition.Walking; var isKneeling = legPosition == LegPosition.Kneeling; var isOneHanded = item != null && !item.IsTwoHanded; var isTwoHanded = item != null && item.IsTwoHanded; var walkingOffset = isWalking ? walkingOffsets[frame] : isKneeling ? 2 : //TODO: correct offset for kneeling 0; var armOffset = isWalking ? armOffsets[frame] : isKneeling ? 2 : //TODO: correct offset 0; var leftArm = isTwoHanded ? twoHandedLeftArm : isWalking ? leftArmAnimation[frame] : emptyLeftArm; //TODO: Firing position var rightArm = isTwoHanded ? twoHandedRightArm : isOneHanded ? oneHandedRightArm : isWalking ? rightArmAnimation[frame] : emptyRightArm; var legs = isWalking ? legsAnimation[frame] : isKneeling ? legsKneeling : legsStanding; foreach (var part in direction.Metadata().DrawOrder) { switch (part) { case SpritePart.OneHandedWeapon: if (isOneHanded) buffer.DrawItem(topRow + armOffset + weaponOffset, leftColumn, item.Sprites[direction]); break; case SpritePart.TwoHandedWeapon: if (isTwoHanded) buffer.DrawItem(topRow + armOffset + weaponOffset, leftColumn, item.Sprites[direction]); break; case SpritePart.LeftArm: buffer.DrawItem(topRow + armOffset, leftColumn, leftArm); break; case SpritePart.RightArm: buffer.DrawItem(topRow + armOffset, leftColumn, rightArm); break; case SpritePart.Head: buffer.DrawItem(topRow + walkingOffset, leftColumn, head); break; case SpritePart.Legs: buffer.DrawItem(topRow, leftColumn, legs); break; } } }
public void Animate(GraphicsBuffer buffer, int topRow, int leftColumn, int frame) { buffer.DrawItem(topRow, leftColumn, images[frame]); }
public void Render(GraphicsBuffer buffer) { buffer.DrawItem(topRow, leftColumn, item); }
private void DrawSprite(GraphicsBuffer buffer, int topRow, int leftColumn, BattleItem item, bool animating, int frame) { var body = animating ? animation[frame] : image; var walkingOffset = animating ? walkingOffsets[frame] : 0; foreach (var part in direction.Metadata().DrawOrder) { switch (part) { case SpritePart.Head: buffer.DrawItem(topRow, leftColumn, body); break; case SpritePart.OneHandedWeapon: if (item != null && !item.IsTwoHanded) buffer.DrawItem(topRow + walkingOffset, leftColumn, item.Sprites[direction]); break; case SpritePart.TwoHandedWeapon: if (item != null && item.IsTwoHanded) buffer.DrawItem(topRow + walkingOffset, leftColumn, item.Sprites[direction]); break; } } }
private void DrawSelection(GraphicsBuffer buffer) { if (selection == null) return; Font.Normal.DrawString(buffer, 20, 0, selection.Name, ColorScheme.Green); if (selection.Rounds > 0) { Font.Normal.DrawString(buffer, 64, 272, "AMMO:", ColorScheme.Green); Font.Normal.DrawString(buffer, 72, 272, "ROUNDS", ColorScheme.Green); Font.Normal.DrawString(buffer, 80, 272, "LEFT=", ColorScheme.Green); Font.Normal.DrawString(buffer, 80, 298, $"{selection.Rounds}", ColorScheme.Orange); buffer.DrawFrame(88, 272, 32, 48, Color.Gray); var ammunitionItem = selection.Ammunition == null ? selection : new BattleItem { Item = selection.Ammunition }; DrawCenteredBattleItem(buffer, ammunitionItem, 88, 272); } var cursor = GameState.Current.PointerPosition; var width = selection.Width * 16; var height = selection.Height * 16; buffer.DrawItem(cursor.Y - height / 2, cursor.X - width / 2, selection.Image); }
private static void DrawCenteredBattleItem(GraphicsBuffer buffer, BattleItem item, int topRow, int leftColumn) { if (item == null) return; var top = topRow + (3 - item.Height) * 16 / 2; var left = leftColumn + (2 - item.Width) * 16 / 2; buffer.DrawItem(top, left, item.Image); }
private static void DrawBattleItems(GraphicsBuffer buffer, BattleItem[] items, int topRow, int leftColumn) { foreach (var column in Enumerable.Range(0, items.Length)) { var item = items[column]; if (item != null) buffer.DrawItem(topRow, leftColumn + column * 16, item.Image); } }