Move android movement controls to left hand side and make space for 4 more

This commit is contained in:
OttoLidenbrock 2015-04-17 15:27:39 +10:00
parent 603715c987
commit 90a3a06974

View File

@ -191,40 +191,53 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
3 * button_size, m_screensize.Y); 3 * button_size, m_screensize.Y);
/* /*
draw control pad draw control pad
0 1 2 0 3 6
3 4 5 1 4 7
for now only 0, 1, 2, and 4 are used 2 5 8
*/ */
int number = 0; int number = 0;
for (int y = 0; y < 2; ++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( rect<s32> button_rect(
x * button_size, m_screensize.Y - button_size * (2 - y), y * button_size, m_screensize.Y - button_size * (3 - x),
(x + 1) * button_size, m_screensize.Y - button_size * (1 - y) (y + 1) * button_size, m_screensize.Y - button_size * (2 - x)
); );
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) {
case 0: case 0:
break;
case 1:
id = left_id; id = left_id;
caption = L"<"; caption = L"<";
break; break;
case 1: case 2:
break;
case 3:
id = forward_id; id = forward_id;
caption = L"^"; caption = L"^";
break; break;
case 2:
id = right_id;
caption = L">";
break;
case 4: case 4:
id = jump_id;
caption = L"x";
break;
case 5:
id = backward_id; id = backward_id;
caption = L"v"; caption = L"v";
break; break;
case 6:
break;
case 7:
id = right_id;
caption = L">";
break;
case 8:
break;
} }
if (id != after_last_element_id) { if (id != after_last_element_id) {
initButton(id, button_rect, caption, false); initButton(id, button_rect, caption, false);
} }
} }
/* init inventory button */ /* init inventory button */
@ -237,20 +250,12 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
rect<s32>(2.5*button_size, m_screensize.Y - (button_size/2), rect<s32>(2.5*button_size, m_screensize.Y - (button_size/2),
3*button_size, m_screensize.Y), L"drop", true); 3*button_size, m_screensize.Y), L"drop", true);
/* init jump button */ /* init crunch button */
initButton(jump_id, initButton(crunch_id,
rect<s32>(m_screensize.X-(1.75*button_size), rect<s32>(m_screensize.X-(1.75*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-(0.25*button_size),
m_screensize.Y), m_screensize.Y),
L"x",false);
/* init crunch button */
initButton(crunch_id,
rect<s32>(m_screensize.X-(3.25*button_size),
m_screensize.Y - (0.5*button_size),
m_screensize.X-(1.75*button_size),
m_screensize.Y),
L"H",false); L"H",false);
/* init fly button */ /* init fly button */