1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add support for dpi based HUD scaling

Add support for (configurable) multiline hotbar
Improved screensize handling
Add userdefined gui scale by BlockMen
This commit is contained in:
sapier 2014-04-05 14:12:36 +02:00
parent 8d31534710
commit 1838a3fd69
13 changed files with 266 additions and 151 deletions

View file

@ -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<aabb3f> &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<s32>& rect, bool selected);
void drawCrosshair();
void drawSelectionBoxes(std::vector<aabb3f> &hilightboxes);
v2u32 m_screensize;
v2s32 m_displaycenter;
s32 m_hotbar_imagesize;
s32 m_padding;
video::SColor hbar_colors[4];
};
void drawItemStack(video::IVideoDriver *driver,