From 90a3a06974b3ae0c17664aaec6ec74d547979228 Mon Sep 17 00:00:00 2001 From: OttoLidenbrock Date: Fri, 17 Apr 2015 15:27:39 +1000 Subject: [PATCH] Move android movement controls to left hand side and make space for 4 more --- src/touchscreengui.cpp | 49 +++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/touchscreengui.cpp b/src/touchscreengui.cpp index bea266e5c..e7e39a1e3 100644 --- a/src/touchscreengui.cpp +++ b/src/touchscreengui.cpp @@ -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 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(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(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(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 */