// Draws the item inside the inventory. protected override void DrawSprite(Graphics2D g, Point2I position, int lightOrDark) { Sprite spr = sprite[level]; if (inventory.IsWeaponEquipped(this) && spriteEquipped != null) spr = spriteEquipped[level]; g.DrawSprite(spr, lightOrDark, position); }
// Draws the item inside the inventory. protected override void DrawSprite(Graphics2D g, Point2I position, int lightOrDark) { Sprite spr = sprite[level]; if (spriteEquipped != null) spr = spriteEquipped[level]; g.DrawSprite(isEquipped ? spr : sprite[level], lightOrDark, position); }
public override void Draw(Graphics2D g) { // Draw all states from the bottom up. for (int i = 0; i < states.Count; ++i) { states[i].Draw(g); } }
public override void Draw(Graphics2D g) { Zone zoneOld = roomOld.Room.Zone; Zone zoneNew = roomNew.Room.Zone; if (zoneOld == zoneNew) { // Draw the rooms normally. DrawRooms(g); } else { // Fade between zones. // Switch to the temp render target to draw the new zone. g.End(); g.SetRenderTarget(GameData.RenderTargetGameTemp); g.Begin(GameSettings.DRAW_MODE_DEFAULT); roomOld.Room.Zone = zoneNew; DrawRooms(g); roomOld.Room.Zone = zoneOld; // Switch to main render target to draw the old zone. g.End(); g.SetRenderTarget(GameData.RenderTargetGame); g.Begin(GameSettings.DRAW_MODE_DEFAULT); roomNew.Room.Zone = zoneOld; DrawRooms(g); roomNew.Room.Zone = zoneNew; // Draw the temp render target (with the new zone) at an opacity. float opacity = (float) distance / (float) maxDistance; Color color = Color.White * opacity; g.DrawImage(GameData.RenderTargetGameTemp, Vector2F.Zero, Vector2F.Zero, Vector2F.One, 0.0, color); } }
public override void Draw(Graphics2D g) { float opacity = timer / duration; if (type == FadeType.FadeIn) opacity = 1.0f - opacity; Color c = color * opacity; //c.A = (byte) (255.0f * opacity); g.FillRectangle(GameSettings.SCREEN_BOUNDS, c); }
//----------------------------------------------------------------------------- // Drawing //----------------------------------------------------------------------------- // Draws the HUD. public void Draw(Graphics2D g, bool light) { int lightDark = (light ? GameData.VARIANT_LIGHT : GameData.VARIANT_DARK); Rectangle2I r = new Rectangle2I(0, 0, GameSettings.SCREEN_WIDTH, 16); g.DrawSprite(GameData.SPR_HUD_BACKGROUND, lightDark, r); DrawItems(g, lightDark); DrawRupees(g, lightDark); DrawHearts(g, lightDark); }
public override void Draw(Graphics2D g) { if (drawHUD) { GameControl.HUD.Draw(g, true); g.Translate(0, 16); } g.DrawImage(backgroundSprite, Point2I.Zero); if (currentSlotGroup != null) DrawSlotCursor(g, currentSlotGroup.CurrentSlot); for (int i = 0; i < slotGroups.Count; i++) { slotGroups[i].Draw(g); } }
//----------------------------------------------------------------------------- // Slots //----------------------------------------------------------------------------- public virtual void DrawSlotCursor(Graphics2D g, Slot slot) { Sprite tR = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(9, 0)); Sprite bR = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(9, 1)); Sprite tL = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(10, 0)); Sprite bL = new Sprite(GameData.SHEET_MENU_SMALL_LIGHT, new Point2I(10, 1)); g.DrawSprite(tR, slot.Position + new Point2I(-8, 0)); g.DrawSprite(bR, slot.Position + new Point2I(-8, 8)); g.DrawSprite(tL, slot.Position + new Point2I(slot.Width, 0)); g.DrawSprite(bL, slot.Position + new Point2I(slot.Width, 8)); }
// Draw all the queued drawing instructions to a graphics object. public void DrawAll(Graphics2D g) { // Draw all instructions from the lowest layer to the highest layer. for (int i = 0; i < layerHeads.Length; i++) { DrawingInstruction instruction = layerHeads[i]; while (instruction != null) { g.DrawSprite(instruction.sprite, instruction.imageVariant, instruction.position.X, instruction.position.Y); instruction = instruction.next; } } }
public override void Draw(Graphics2D g) { g.ResetTranslation(); if (timer < TRANSITION_SPLIT_BEGIN_DELAY) { OldRoomControl.Draw(g); } else { NewRoomControl.Draw(g); g.ResetTranslation(); g.Translate(0, 16); g.FillRectangle(new Rectangle2F(0, 0, sideWidths[0], GameSettings.VIEW_HEIGHT), splitColor); g.FillRectangle(new Rectangle2F(GameSettings.VIEW_WIDTH - sideWidths[1], 0, sideWidths[1], GameSettings.VIEW_HEIGHT), splitColor); } }
public override void Draw(Graphics2D g) { Point2I panNew = -(Directions.ToPoint(direction) * distance); Point2I panOld = Directions.ToPoint(direction) * GameSettings.VIEW_SIZE; g.Translate(panNew); menuOld.Draw(g); g.ResetTranslation(); g.Translate(panNew); g.Translate(panOld); menuNew.Draw(g); g.ResetTranslation(); GameControl.HUD.Draw(g, true); }
public override void Draw(Graphics2D g) { g.Translate(0, 16); if (reward.HoldType == RewardHoldTypes.Raise && useChest) { g.DrawAnimation(animationPlayer, chestPosition + new Point2I(0, -8 - (timer + 2) / 4), 0.3f); } else if (timer >= (useChest ? RaiseDuration : NonChestDuration)) { if (reward.HoldType == RewardHoldTypes.TwoHands) { g.DrawAnimation(animationPlayer, GameControl.Player.Position + new Point2I(-8, -31), 0.3f); } else if (reward.HoldType == RewardHoldTypes.OneHand) { g.DrawAnimation(animationPlayer, GameControl.Player.Position + new Point2I(-12, -30), 0.3f); } } g.Translate(0, -16); }
public override void Draw(Graphics2D g) { g.ResetTranslation(); // Draw the room. if (isBeginningFade) OldRoomControl.Draw(g); else NewRoomControl.Draw(g); // Draw the fade. int t = timer; int delay = TRANSITION_SWITCH_FADE_DELAY / 2; if (!isBeginningFade) t = (TRANSITION_FADE_DURATION - delay) - t; float opacity = t / (float) (TRANSITION_FADE_DURATION - delay); opacity = GMath.Clamp(opacity, 0.0f, 1.0f); g.FillRectangle(GameSettings.SCREEN_BOUNDS, fadeColor * opacity); }
public override void DrawOver(Graphics2D g) { Vector2F pos = player.Position + objectDrawOffset + carryObject.Graphics.DrawOffset; pos.Y -= player.ZPosition; // Handle head bobbing when the player is moving horizontally. if (!isPickingUp && (player.Direction == Directions.Left || player.Direction == Directions.Right) && player.Graphics.AnimationPlayer.PlaybackTime >= 6) { pos.Y += 1; } // Draw the object. if (carryObject.Graphics.AnimationPlayer.SubStrip != null) { g.DrawAnimation(carryObject.Graphics.AnimationPlayer.SubStrip, carryObject.Graphics.ImageVariant, carryObject.Graphics.AnimationPlayer.PlaybackTime, pos, 0.0f); } else if (carryObject.Graphics.Sprite != null) g.DrawSprite(carryObject.Graphics.Sprite, carryObject.Graphics.ImageVariant, pos, 0.0f); }
// Draws the scrolling item description at the bottom of the screen. public void DrawDescription(Graphics2D g) { int position = textPosition - textStart; int textIndex = position / 8; if (position < 0) { // Round down always. textIndex = (position - 7) / 8; position = ((position - 7) / 8) * 8; } else { position = (position / 8) * 8; } int startIndex = GMath.Max(0, textIndex); int endIndex = GMath.Clamp(textIndex + 16, 0, description.Length); LetterString text = description.Substring(startIndex, endIndex - startIndex); if (position < 0) g.DrawLetterString(GameData.FONT_LARGE, text, new Point2I(16 - (position / 8) * 8, 108), new Color(16, 40, 88)); else g.DrawLetterString(GameData.FONT_LARGE, text, new Point2I(16, 108), new Color(16, 40, 88)); }
// Draws the item inside the inventory. public override void DrawSlot(Graphics2D g, Point2I position, int lightOrDark) { DrawSprite(g, position, lightOrDark); DrawAmmo(g, position, lightOrDark); g.DrawSprite(ammo[currentAmmo].Sprite, lightOrDark, position + new Point2I(8, 0)); }
public override void Draw(Graphics2D g) { if (CurrentState != null) CurrentState.Draw(g); }
private void DrawSideInfo(Graphics2D g) { }
/** <summary> Called every step to draw debug information. </summary> */ public override void Draw(Graphics2D g) { DrawSideInfo(g); base.Draw(g); }
//----------------------------------------------------------------------------- // Drawing //----------------------------------------------------------------------------- protected virtual void DrawSprite(Graphics2D g, Point2I position, int lightOrDark) { g.DrawSprite(sprite[level], lightOrDark, position); }
public override void Draw(Graphics2D g) { }
// Draws the item inside the inventory. public virtual void DrawSlot(Graphics2D g, Point2I position, int lightOrDark) { DrawSprite(g, position, lightOrDark); }
// Draws the ruppes and dungeon keys. private void DrawRupees(Graphics2D g, int lightDark) { Color black = (lightDark == GameData.VARIANT_LIGHT ? new Color(16, 16, 16) : Color.Black); int advancedOffset = (gameControl.IsAdvancedGame ? 8 : 0); Dungeon dungeon = gameControl.RoomControl.Dungeon; if (dungeon != null) { // Display the small key count. g.DrawSprite(GameData.SPR_HUD_KEY, lightDark, new Point2I(80 - advancedOffset, 0)); g.DrawSprite(GameData.SPR_HUD_X, lightDark, new Point2I(88 - advancedOffset, 0)); g.DrawString(GameData.FONT_SMALL, dungeon.NumSmallKeys.ToString(), new Point2I(96 - advancedOffset, 0), black); } else { // Display rupee icon. g.DrawSprite(GameData.SPR_HUD_RUPEE, lightDark, new Point2I(80 - advancedOffset, 0)); } g.DrawString(GameData.FONT_SMALL, dynamicRupees.ToString("000"), new Point2I(80 - advancedOffset, 8), black); }
// Draws the equipped usable items. private void DrawItems(Graphics2D g, int lightDark) { if (Inventory.IsTwoHandedEquipped) { // B bracket side g.DrawSprite(GameData.SPR_HUD_BRACKET_LEFT_B, lightDark, new Point2I(8, 0)); // A bracket side g.DrawSprite(GameData.SPR_HUD_BRACKET_RIGHT_A, lightDark, new Point2I(56, 0)); Inventory.EquippedWeapons[0].DrawSlot(g, new Point2I(16, 0), lightDark); } else if (!gameControl.IsAdvancedGame) { // B bracket g.DrawSprite(GameData.SPR_HUD_BRACKET_LEFT_B, lightDark, new Point2I(0, 0)); g.DrawSprite(GameData.SPR_HUD_BRACKET_RIGHT, lightDark, new Point2I(32, 0)); // A bracket g.DrawSprite(GameData.SPR_HUD_BRACKET_LEFT_A, lightDark, new Point2I(40, 0)); g.DrawSprite(GameData.SPR_HUD_BRACKET_RIGHT, lightDark, new Point2I(72, 0)); if (Inventory.EquippedWeapons[1] != null) Inventory.EquippedWeapons[1].DrawSlot(g, new Point2I(8, 0), lightDark); if (Inventory.EquippedWeapons[0] != null) Inventory.EquippedWeapons[0].DrawSlot(g, new Point2I(48, 0), lightDark); } else { // B bracket side g.DrawSprite(GameData.SPR_HUD_BRACKET_LEFT_B, lightDark, new Point2I(0, 0)); // Both bracket side g.DrawSprite(GameData.SPR_HUD_BRACKET_LEFT_RIGHT, lightDark, new Point2I(32, 0)); // A bracket side g.DrawSprite(GameData.SPR_HUD_BRACKET_RIGHT_A, lightDark, new Point2I(64, 0)); if (Inventory.EquippedWeapons[1] != null) Inventory.EquippedWeapons[1].DrawSlot(g, new Point2I(8, 0), lightDark); if (Inventory.EquippedWeapons[0] != null) Inventory.EquippedWeapons[0].DrawSlot(g, new Point2I(40, 0), lightDark); } }
//----------------------------------------------------------------------------- // Drawing //----------------------------------------------------------------------------- // Draws the slot and its item. public void Draw(Graphics2D g) { if (item != null) { item.DrawSlot(g, position, GameData.VARIANT_LIGHT); } }
public void DrawRoomState(Graphics2D g) { roomStateStack.Draw(g); }
// Draws the item inside the inventory. public override void DrawSlot(Graphics2D g, Point2I position, int lightOrDark) { DrawSprite(g, position, lightOrDark); DrawAmmo(g, position, lightOrDark); }
public virtual void DrawOver(Graphics2D g) { }
// Draws the player's life. private void DrawHearts(Graphics2D g, int lightDark) { for (int i = 0; i < gameControl.Player.MaxHealth / 4; i++) { int fullness = GMath.Clamp(dynamicHealth - i * 4, 0, 4); if (!gameControl.IsAdvancedGame) g.DrawSprite(GameData.SPR_HUD_HEARTS[fullness], lightDark, new Point2I(104 + (i % 7) * 8, (i / 7) * 8)); else g.DrawSprite(GameData.SPR_HUD_HEARTS[fullness], lightDark, new Point2I(96 + (i % 8) * 8, (i / 8) * 8)); } }
protected virtual void DrawLevel(Graphics2D g, Point2I position, int lightOrDark) { Color color = (lightOrDark == GameData.VARIANT_LIGHT ? new Color(16, 16, 16) : Color.Black); g.DrawSprite(GameData.SPR_HUD_LEVEL, lightOrDark, position + new Point2I(8, 8)); g.DrawString(GameData.FONT_SMALL, (level + 1).ToString(), position + new Point2I(16, 8), color); }