예제 #1
0
 // 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);
 }
예제 #2
0
 // 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);
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
        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);
            }
        }
예제 #5
0
 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);
 }
예제 #6
0
        //-----------------------------------------------------------------------------
        // 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);
        }
예제 #7
0
 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);
     }
 }
예제 #8
0
        //-----------------------------------------------------------------------------
        // 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));
        }
예제 #9
0
        // 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);
        }
예제 #12
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
        // 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));
        }
예제 #16
0
 // 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));
 }
예제 #17
0
 public override void Draw(Graphics2D g)
 {
     if (CurrentState != null)
         CurrentState.Draw(g);
 }
예제 #18
0
 private void DrawSideInfo(Graphics2D g)
 {
 }
예제 #19
0
        /** <summary> Called every step to draw debug information. </summary> */
        public override void Draw(Graphics2D g)
        {
            DrawSideInfo(g);

            base.Draw(g);
        }
예제 #20
0
 //-----------------------------------------------------------------------------
 // Drawing
 //-----------------------------------------------------------------------------
 protected virtual void DrawSprite(Graphics2D g, Point2I position, int lightOrDark)
 {
     g.DrawSprite(sprite[level], lightOrDark, position);
 }
예제 #21
0
 public override void Draw(Graphics2D g)
 {
 }
예제 #22
0
 // Draws the item inside the inventory.
 public virtual void DrawSlot(Graphics2D g, Point2I position, int lightOrDark)
 {
     DrawSprite(g, position, lightOrDark);
 }
예제 #23
0
        // 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);
        }
예제 #24
0
        // 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);
            }
        }
예제 #25
0
 //-----------------------------------------------------------------------------
 // Drawing
 //-----------------------------------------------------------------------------
 // Draws the slot and its item.
 public void Draw(Graphics2D g)
 {
     if (item != null) {
         item.DrawSlot(g, position, GameData.VARIANT_LIGHT);
     }
 }
예제 #26
0
 public void DrawRoomState(Graphics2D g)
 {
     roomStateStack.Draw(g);
 }
예제 #27
0
 // Draws the item inside the inventory.
 public override void DrawSlot(Graphics2D g, Point2I position, int lightOrDark)
 {
     DrawSprite(g, position, lightOrDark);
     DrawAmmo(g, position, lightOrDark);
 }
예제 #28
0
 public virtual void DrawOver(Graphics2D g)
 {
 }
예제 #29
0
 // 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));
     }
 }
예제 #30
0
 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);
 }