Mobile: fix statustext and hud text position
This commit is contained in:
parent
53c4472481
commit
b028ff30f6
|
@ -478,10 +478,10 @@ $(CURL_LIB): $(CURL_TIMESTAMP)
|
|||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON} -fno-lto"; \
|
||||
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
|
||||
./configure --host=${TARGET_HOST} --enable-static --disable-shared \
|
||||
--disable-debug --disable-dependency-tracking -disable-ftp \
|
||||
--disable-debug --disable-verbose --disable-dependency-tracking --disable-ftp \
|
||||
--disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict \
|
||||
--disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp \
|
||||
--disable-gopher --disable-sspi --disable-manual --disable-zlib --without-zlib; \
|
||||
--disable-gopher --disable-sspi --disable-manual; \
|
||||
$(MAKE) -s || exit 1; \
|
||||
touch ${CURL_TIMESTAMP}; \
|
||||
touch ${CURL_TIMESTAMP_INT}; \
|
||||
|
|
|
@ -168,21 +168,12 @@ core.register_playerevent(player_event_handler)]]
|
|||
|
||||
local hud, timer, wield = {}, {}, {}
|
||||
local timeout = 2
|
||||
local textposition
|
||||
|
||||
core.register_on_joinplayer(function(player)
|
||||
if PLATFORM == "iOS" then
|
||||
textposition = {x = 0.5, y = 0.89}
|
||||
else
|
||||
textposition = {x = 0.5, y = 0.975}
|
||||
end
|
||||
end)
|
||||
|
||||
local function add_text(player)
|
||||
local player_name = player:get_player_name()
|
||||
hud[player_name] = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
position = textposition,
|
||||
position = {x = 0.5, y = 0.975},
|
||||
offset = {x = 0, y = -75},
|
||||
alignment = {x = 0, y = 0},
|
||||
number = 0xFFFFFF,
|
||||
|
|
|
@ -432,18 +432,15 @@ void set_default_settings(Settings *settings)
|
|||
(160 * porting::getDisplayDensity()));
|
||||
if (x_inches <= 3.7) {
|
||||
// small 4" phones
|
||||
settings->setDefault("hud_scaling", "0.5");
|
||||
settings->setDefault("gui_scaling", "1.0");
|
||||
settings->setDefault("hud_scaling", "0.55");
|
||||
settings->setDefault("mouse_sensitivity", "0.25");
|
||||
} else if (x_inches > 3.7 && x_inches < 5) {
|
||||
// all phones
|
||||
settings->setDefault("hud_scaling", "0.6");
|
||||
settings->setDefault("gui_scaling", "1.2");
|
||||
settings->setDefault("hud_scaling", "0.65");
|
||||
settings->setDefault("mouse_sensitivity", "0.15");
|
||||
} else if (x_inches >= 5) {
|
||||
// tablets
|
||||
settings->setDefault("hud_scaling", "0.85");
|
||||
settings->setDefault("gui_scaling", "1.2");
|
||||
settings->setDefault("hud_scaling", "0.9");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4496,7 +4496,11 @@ void Game::updateGui(const RunStats &stats, f32 dtime, const CameraOrientation &
|
|||
if (!m_statustext.empty()) {
|
||||
s32 status_width = guitext_status->getTextWidth();
|
||||
s32 status_height = guitext_status->getTextHeight();
|
||||
#ifdef __ANDROID__
|
||||
s32 status_y = screensize.Y - 350;
|
||||
#else
|
||||
s32 status_y = screensize.Y - 150 * g_settings->getFloat("hud_scaling");
|
||||
#endif
|
||||
s32 status_x = (screensize.X - status_width) / 2;
|
||||
core::rect<s32> rect(
|
||||
status_x , status_y - status_height,
|
||||
|
|
|
@ -329,7 +329,13 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
|
|||
std::wstring text = unescape_enriched(utf8_to_wide(e->text));
|
||||
core::dimension2d<u32> textsize = font->getDimension(text.c_str());
|
||||
v2s32 offset((e->align.X - 1.0) * (textsize.Width / 2),
|
||||
(e->align.Y - 1.0) * (textsize.Height / 2));
|
||||
#if defined(__ANDROID__)
|
||||
(e->align.Y - 1.0) * (textsize.Height) * 4);
|
||||
#elif defined(__IOS__)
|
||||
(e->align.Y - 1.0) * (textsize.Height) * 3);
|
||||
#else
|
||||
(e->align.Y - 1.0) * (textsize.Height / 2));
|
||||
#endif
|
||||
v2s32 offs(e->offset.X, e->offset.Y);
|
||||
font->draw(text.c_str(), size + pos + offset + offs, color);
|
||||
break; }
|
||||
|
|
Loading…
Reference in New Issue