Move android GUI buttons around, remove version name/number at top of screen, remove show debug info for release builds
This commit is contained in:
parent
d91f322e25
commit
d0d023396a
|
@ -9,7 +9,7 @@
|
||||||
print = core.debug
|
print = core.debug
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
os.setlocale("C", "numeric")
|
os.setlocale("C", "numeric")
|
||||||
multicraft = core
|
minetest = core
|
||||||
|
|
||||||
-- Load other files
|
-- Load other files
|
||||||
local scriptdir = core.get_builtin_path()..DIR_DELIM
|
local scriptdir = core.get_builtin_path()..DIR_DELIM
|
||||||
|
|
|
@ -2346,7 +2346,6 @@ inline void Game::updateInteractTimers(GameRunData *runData, f32 dtime)
|
||||||
runData->time_from_last_punch += dtime;
|
runData->time_from_last_punch += dtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* returns false if game should exit, otherwise true
|
/* returns false if game should exit, otherwise true
|
||||||
*/
|
*/
|
||||||
inline bool Game::checkConnection()
|
inline bool Game::checkConnection()
|
||||||
|
@ -4058,10 +4057,14 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
|
||||||
guitext->setText(narrow_to_wide(os.str()).c_str());
|
guitext->setText(narrow_to_wide(os.str()).c_str());
|
||||||
guitext->setVisible(true);
|
guitext->setVisible(true);
|
||||||
} else if (flags.show_hud || flags.show_chat) {
|
} else if (flags.show_hud || flags.show_chat) {
|
||||||
|
#ifdef ANDROID
|
||||||
|
guitext->setVisible(false);
|
||||||
|
#else
|
||||||
std::ostringstream os(std::ios_base::binary);
|
std::ostringstream os(std::ios_base::binary);
|
||||||
os << "MultiCraft " << g_version_hash;
|
os << "MultiCraft " << g_version_hash;
|
||||||
guitext->setText(narrow_to_wide(os.str()).c_str());
|
guitext->setText(narrow_to_wide(os.str()).c_str());
|
||||||
guitext->setVisible(true);
|
guitext->setVisible(true);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
guitext->setVisible(false);
|
guitext->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,24 +174,25 @@ void TouchScreenGUI::initButton(touch_gui_button_id id, rect<s32> button_rect,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getMaxControlPadSize(float density) {
|
static int getMaxControlPadSize(float density) {
|
||||||
return 200 * density * g_settings->getFloat("hud_scaling");
|
return 235 * density * g_settings->getFloat("hud_scaling");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
||||||
{
|
{
|
||||||
assert(tsrc != 0);
|
assert(tsrc != 0);
|
||||||
|
|
||||||
const u32 spacing = 17;
|
const u32 spacing = 7;
|
||||||
|
|
||||||
u32 control_pad_size =
|
u32 control_pad_size =
|
||||||
MYMIN((2 * m_screensize.Y + spacing * 2) / 3,
|
MYMIN((2 * m_screensize.Y + spacing * 2) / 3,
|
||||||
getMaxControlPadSize(density));
|
getMaxControlPadSize(density));
|
||||||
|
|
||||||
u32 button_size = control_pad_size / 3.5;
|
u32 button_size = (control_pad_size - spacing * 2 ) / 3;
|
||||||
m_visible = true;
|
m_visible = true;
|
||||||
m_texturesource = tsrc;
|
m_texturesource = tsrc;
|
||||||
m_control_pad_rect = rect<s32>(0, m_screensize.Y - 3 * button_size,
|
m_control_pad_rect = rect<s32>(
|
||||||
3 * button_size, m_screensize.Y);
|
spacing, m_screensize.Y - control_pad_size - spacing,
|
||||||
|
spacing + control_pad_size, m_screensize.Y - spacing);
|
||||||
/*
|
/*
|
||||||
draw control pad
|
draw control pad
|
||||||
0 3 6
|
0 3 6
|
||||||
|
@ -202,10 +203,14 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
||||||
|
|
||||||
for (int y = 0; y < 3; ++y)
|
for (int y = 0; y < 3; ++y)
|
||||||
for (int x = 0; x < 3; ++x, ++number) {
|
for (int x = 0; x < 3; ++x, ++number) {
|
||||||
rect<s32> button_rect(
|
v2s32 tl;
|
||||||
y * (button_size) + spacing * y, m_screensize.Y - button_size * (3 - x ) - spacing * (3 - x),
|
tl.X = y * (button_size + spacing) + spacing;
|
||||||
(y + 1) * button_size + spacing * y, m_screensize.Y - button_size * (2 - x ) - spacing * (2 - x)
|
tl.Y = m_screensize.Y - (button_size + spacing) * (3 - x);
|
||||||
);
|
// rect<s32> button_rect(
|
||||||
|
// y * (button_size) + spacing * y, m_screensize.Y - button_size * (3 - x ) - spacing * (3 - x),
|
||||||
|
// (y + 1) * button_size + spacing * y, m_screensize.Y - button_size * (2 - x ) - spacing * (2 - x)
|
||||||
|
// );
|
||||||
|
rect<s32> button_rect(tl.X, tl.Y, tl.X + button_size, tl.Y + button_size);
|
||||||
touch_gui_button_id id = after_last_element_id;
|
touch_gui_button_id id = after_last_element_id;
|
||||||
std::wstring caption;
|
std::wstring caption;
|
||||||
switch (number) {
|
switch (number) {
|
||||||
|
@ -246,19 +251,25 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
||||||
|
|
||||||
/* init inventory button */
|
/* init inventory button */
|
||||||
initButton(inventory_id,
|
initButton(inventory_id,
|
||||||
rect<s32>(0, m_screensize.Y - (button_size/2),
|
rect<s32>(m_screensize.X-(3*button_size),
|
||||||
(button_size/2), m_screensize.Y), L"inv", true);
|
m_screensize.Y - (0.5*button_size),
|
||||||
|
m_screensize.X-(2.5*button_size),
|
||||||
|
m_screensize.Y),
|
||||||
|
L"inv", true);
|
||||||
|
|
||||||
/* init drop button */
|
/* init drop button */
|
||||||
initButton(drop_id,
|
initButton(drop_id,
|
||||||
rect<s32>(2.5*button_size, m_screensize.Y - (button_size/2),
|
rect<s32>(m_screensize.X-(0.5*button_size),
|
||||||
3*button_size, m_screensize.Y), L"drop", true);
|
m_screensize.Y - (0.5*button_size),
|
||||||
|
m_screensize.X-(0.0*button_size),
|
||||||
|
m_screensize.Y),
|
||||||
|
L"drop", true);
|
||||||
|
|
||||||
/* init crunch button */
|
/* init crunch button */
|
||||||
initButton(crunch_id,
|
initButton(crunch_id,
|
||||||
rect<s32>(m_screensize.X-(1.75*button_size),
|
rect<s32>(m_screensize.X-(2.25*button_size),
|
||||||
m_screensize.Y - (0.5*button_size),
|
m_screensize.Y - (0.5*button_size),
|
||||||
m_screensize.X-(0.25*button_size),
|
m_screensize.X-(1.25*button_size),
|
||||||
m_screensize.Y),
|
m_screensize.Y),
|
||||||
L"H",false);
|
L"H",false);
|
||||||
|
|
||||||
|
@ -272,22 +283,24 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
||||||
#ifdef ENABLE_ANDROID_NOCLIP
|
#ifdef ENABLE_ANDROID_NOCLIP
|
||||||
/* init noclip button */
|
/* init noclip button */
|
||||||
initButton(noclip_id,
|
initButton(noclip_id,
|
||||||
rect<s32>(m_screensize.X - (0.75*button_size), 2.25*button_size,
|
rect<s32>(m_screensize.X - (0.75*button_size), m_screensize.Y - (3.75*button_size),
|
||||||
m_screensize.X, 3*button_size),
|
m_screensize.X, m_screensize.Y - (button_size*3)),
|
||||||
L"clip", false, SLOW_BUTTON_REPEAT);
|
L"clip", false, SLOW_BUTTON_REPEAT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* init fast button */
|
/* init fast button */
|
||||||
initButton(fast_id,
|
initButton(fast_id,
|
||||||
rect<s32>(m_screensize.X - (0.75*button_size), 1.5*button_size,
|
rect<s32>(m_screensize.X - (0.75*button_size), m_screensize.Y - (3*button_size),
|
||||||
m_screensize.X, 2.25*button_size),
|
m_screensize.X, m_screensize.Y - (button_size*2.25)),
|
||||||
L"fast", false, SLOW_BUTTON_REPEAT);
|
L"fast", false, SLOW_BUTTON_REPEAT);
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
/* init debug button */
|
/* init debug button */
|
||||||
initButton(debug_id,
|
initButton(debug_id,
|
||||||
rect<s32>(m_screensize.X - (0.75*button_size), 0.75*button_size,
|
rect<s32>(m_screensize.X - (0.75*button_size), 0.75*button_size,
|
||||||
m_screensize.X, 1.5*button_size),
|
m_screensize.X, 1.5*button_size),
|
||||||
L"dbg", false, SLOW_BUTTON_REPEAT);
|
L"dbg", false, SLOW_BUTTON_REPEAT);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* init chat button */
|
/* init chat button */
|
||||||
initButton(chat_id,
|
initButton(chat_id,
|
||||||
|
@ -297,14 +310,14 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
||||||
|
|
||||||
/* init camera button */
|
/* init camera button */
|
||||||
initButton(camera_id,
|
initButton(camera_id,
|
||||||
rect<s32>(m_screensize.X - (1.5*button_size), 0,
|
rect<s32>(0, 0,
|
||||||
m_screensize.X - (0.75*button_size), 0.75*button_size),
|
0.75*button_size, 0.75*button_size),
|
||||||
L"cam", false, SLOW_BUTTON_REPEAT);
|
L"cam", false, SLOW_BUTTON_REPEAT);
|
||||||
|
|
||||||
/* init rangeselect button */
|
/* init rangeselect button */
|
||||||
initButton(range_id,
|
initButton(range_id,
|
||||||
rect<s32>(m_screensize.X - (2.25*button_size), 0,
|
rect<s32>(0.75 * button_size, 0,
|
||||||
m_screensize.X - (1.5*button_size), 0.75*button_size),
|
1.5 * button_size, 0.75*button_size),
|
||||||
L"far", false, SLOW_BUTTON_REPEAT);
|
L"far", false, SLOW_BUTTON_REPEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue