#include "clouds.h"
#include "httpfetch.h"
#include "log.h"
+#include "fontengine.h"
+
#ifdef __ANDROID__
#include "tile.h"
#include <GLES/gl.h>
m_sound_manager = &dummySoundManager;
//create topleft header
- core::rect<s32> rect(0, 0, 500, 20);
+ std::wstring t = narrow_to_wide(std::string("Minetest ") +
+ minetest_version_hash);
+
+ core::rect<s32> rect(0, 0, glb_fontengine->getTextWidth(t), glb_fontengine->getTextHeight());
rect += v2s32(4, 0);
- std::string t = std::string("Minetest ") + minetest_version_hash;
m_irr_toplefttext =
- m_device->getGUIEnvironment()->addStaticText(narrow_to_wide(t).c_str(),
+ m_device->getGUIEnvironment()->addStaticText(t.c_str(),
rect,false,true,0,-1);
//create formspecsource
m_texture_source,
m_formspecgui,
m_buttonhandler,
- NULL, NULL);
+ NULL);
m_menu->allowClose(false);
m_menu->lockSize(true,v2u32(800,600));
}
m_menu->quitMenu();
- m_menu->remove();
- delete m_menu;
+ m_menu->drop();
m_menu = NULL;
}
cloudInit();
- while(m_device->run() && (!m_startgame) && (!m_kill)) {
+ unsigned int text_height = glb_fontengine->getTextHeight();
+
+ while(m_device->run() && (!m_startgame) && (!m_kill))
+ {
+ //check if we need to update the "upper left corner"-text
+ if (text_height != glb_fontengine->getTextHeight()) {
+ updateTopLeftTextSize();
+ text_height = glb_fontengine->getTextHeight();
+ }
+
driver->beginScene(true, true, video::SColor(255,140,186,250));
if (m_clouds_enabled)
/******************************************************************************/
void GUIEngine::setTopleftText(std::string append)
{
- std::string toset = std::string("Minetest ") + minetest_version_hash;
+ std::wstring toset = narrow_to_wide( std::string("Minetest ") +
+ minetest_version_hash);
- if (append != "") {
- toset += " / ";
- toset += append;
+ if (append != "")
+ {
+ toset += L" / ";
+ toset += narrow_to_wide(append);
}
- m_irr_toplefttext->setText(narrow_to_wide(toset).c_str());
+ m_irr_toplefttext->setText(toset.c_str());
+
+ updateTopLeftTextSize();
+}
+
+/******************************************************************************/
+void GUIEngine::updateTopLeftTextSize()
+{
+ std::wstring text = m_irr_toplefttext->getText();
+
+ core::rect<s32> rect(0, 0, glb_fontengine->getTextWidth(text), glb_fontengine->getTextHeight());
+ rect += v2s32(4, 0);
+
+ m_irr_toplefttext->remove();
+ m_irr_toplefttext =
+ m_device->getGUIEnvironment()->addStaticText(text.c_str(),
+ rect,false,true,0,-1);
}
/******************************************************************************/