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
1 changed files with 27 additions and 22 deletions

View File

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