mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Make hud use fontengine too
Fix non coding style conforming glb_fontengine to g_fontengine Fix fonts never been deleted due to grabbed to often
This commit is contained in:
parent
d1d6a97b1c
commit
39162de15a
12 changed files with 41 additions and 47 deletions
12
src/hud.cpp
12
src/hud.cpp
|
@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "localplayer.h"
|
||||
#include "camera.h"
|
||||
#include "porting.h"
|
||||
#include "fontengine.h"
|
||||
#include <IGUIStaticText.h>
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
|
@ -38,14 +39,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#endif
|
||||
|
||||
Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
|
||||
gui::IGUIEnvironment* guienv, gui::IGUIFont *font,
|
||||
u32 text_height, IGameDef *gamedef,
|
||||
LocalPlayer *player, Inventory *inventory) {
|
||||
gui::IGUIEnvironment* guienv, IGameDef *gamedef, LocalPlayer *player,
|
||||
Inventory *inventory) {
|
||||
this->driver = driver;
|
||||
this->smgr = smgr;
|
||||
this->guienv = guienv;
|
||||
this->font = font;
|
||||
this->text_height = text_height;
|
||||
this->gamedef = gamedef;
|
||||
this->player = player;
|
||||
this->inventory = inventory;
|
||||
|
@ -156,7 +154,7 @@ void Hud::drawItem(const ItemStack &item, const core::rect<s32>& rect, bool sele
|
|||
video::SColor bgcolor2(128, 0, 0, 0);
|
||||
if (!use_hotbar_image)
|
||||
driver->draw2DRectangle(bgcolor2, rect, NULL);
|
||||
drawItemStack(driver, font, item, rect, NULL, gamedef);
|
||||
drawItemStack(driver, g_fontengine->getFont(), item, rect, NULL, gamedef);
|
||||
}
|
||||
|
||||
//NOTE: selectitem = 0 -> no selected; selectitem 1-based
|
||||
|
@ -240,6 +238,8 @@ void Hud::drawItems(v2s32 upperleftpos, s32 itemcount, s32 offset,
|
|||
|
||||
|
||||
void Hud::drawLuaElements(v3s16 camera_offset) {
|
||||
uint32_t text_height = g_fontengine->getTextHeight();
|
||||
irr::gui::IGUIFont* font = g_fontengine->getFont();
|
||||
for (size_t i = 0; i != player->maxHudId(); i++) {
|
||||
HudElement *e = player->getHud(i);
|
||||
if (!e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue