3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "irrlichttypes_extrabloated.h"
26 #define HUD_DIR_LEFT_RIGHT 0
27 #define HUD_DIR_RIGHT_LEFT 1
28 #define HUD_DIR_TOP_BOTTOM 2
29 #define HUD_DIR_BOTTOM_TOP 3
31 #define HUD_CORNER_UPPER 0
32 #define HUD_CORNER_LOWER 1
33 #define HUD_CORNER_CENTER 2
35 #define HUD_FLAG_HOTBAR_VISIBLE (1 << 0)
36 #define HUD_FLAG_HEALTHBAR_VISIBLE (1 << 1)
37 #define HUD_FLAG_CROSSHAIR_VISIBLE (1 << 2)
38 #define HUD_FLAG_WIELDITEM_VISIBLE (1 << 3)
39 #define HUD_FLAG_BREATHBAR_VISIBLE (1 << 4)
41 #define HUD_PARAM_HOTBAR_ITEMCOUNT 1
42 #define HUD_PARAM_HOTBAR_IMAGE 2
43 #define HUD_PARAM_HOTBAR_SELECTED_IMAGE 3
45 #define HUD_HOTBAR_ITEMCOUNT_DEFAULT 8
46 #define HUD_HOTBAR_ITEMCOUNT_MAX 23
52 HUD_ELEM_INVENTORY = 3,
53 HUD_ELEM_WAYPOINT = 4,
87 #include "irr_aabb3d.h"
98 video::IVideoDriver *driver;
99 scene::ISceneManager* smgr;
100 gui::IGUIEnvironment *guienv;
105 Inventory *inventory;
106 ITextureSource *tsrc;
110 s32 hotbar_imagesize;
112 video::SColor crosshair_argb;
113 video::SColor selectionbox_argb;
114 bool use_crosshair_image;
115 std::string hotbar_image;
116 bool use_hotbar_image;
117 std::string hotbar_selected_image;
118 bool use_hotbar_selected_image;
120 Hud(video::IVideoDriver *driver,scene::ISceneManager* smgr,
121 gui::IGUIEnvironment* guienv, gui::IGUIFont *font,
122 u32 text_height, IGameDef *gamedef,
123 LocalPlayer *player, Inventory *inventory);
125 void drawItem(v2s32 upperleftpos, s32 imgsize, s32 itemcount,
126 InventoryList *mainlist, u16 selectitem, u16 direction);
127 void drawLuaElements();
128 void drawStatbar(v2s32 pos, u16 corner, u16 drawdir,
129 std::string texture, s32 count, v2s32 offset);
131 void drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem, s32 breath);
134 void drawCrosshair();
135 void drawSelectionBoxes(std::vector<aabb3f> &hilightboxes);
138 void drawItemStack(video::IVideoDriver *driver,
140 const ItemStack &item,
141 const core::rect<s32> &rect,
142 const core::rect<s32> *clip,