From 1838a3fd696782b1733a435bbb25accf3e40d1f3 Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 5 Apr 2014 14:12:36 +0200 Subject: Add support for dpi based HUD scaling Add support for (configurable) multiline hotbar Improved screensize handling Add userdefined gui scale by BlockMen --- src/hud.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'src/hud.h') diff --git a/src/hud.h b/src/hud.h index 1a24d0945..3897a850c 100644 --- a/src/hud.h +++ b/src/hud.h @@ -45,6 +45,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define HUD_HOTBAR_ITEMCOUNT_DEFAULT 8 #define HUD_HOTBAR_ITEMCOUNT_MAX 23 + +#define HOTBAR_IMAGE_SIZE 48 + enum HudElementType { HUD_ELEM_IMAGE = 0, HUD_ELEM_TEXT = 1, @@ -105,10 +108,6 @@ public: Inventory *inventory; ITextureSource *tsrc; - v2u32 screensize; - v2s32 displaycenter; - s32 hotbar_imagesize; - video::SColor crosshair_argb; video::SColor selectionbox_argb; bool use_crosshair_image; @@ -122,17 +121,25 @@ public: u32 text_height, IGameDef *gamedef, LocalPlayer *player, Inventory *inventory); - void drawItem(v2s32 upperleftpos, s32 imgsize, s32 itemcount, - InventoryList *mainlist, u16 selectitem, u16 direction); + void drawHotbar(s32 halfheartcount, u16 playeritem, s32 breath); + void resizeHotbar(); + void drawCrosshair(); + void drawSelectionBoxes(std::vector &hilightboxes); void drawLuaElements(); +private: void drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture, s32 count, v2s32 offset); - void drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem, s32 breath); - void resizeHotbar(); + void drawItems(v2s32 upperleftpos, s32 itemcount, s32 offset, + InventoryList *mainlist, u16 selectitem, u16 direction); + + void drawItem(const ItemStack &item, const core::rect& rect, bool selected); - void drawCrosshair(); - void drawSelectionBoxes(std::vector &hilightboxes); + v2u32 m_screensize; + v2s32 m_displaycenter; + s32 m_hotbar_imagesize; + s32 m_padding; + video::SColor hbar_colors[4]; }; void drawItemStack(video::IVideoDriver *driver, -- cgit v1.2.3