Add extra buttons to Android GUI. All icons are licensed by freepik.com under CC BY 3.0

master
Kodexky 2014-12-09 23:27:25 -04:30 committed by Craig Robbins
parent 4150e533b3
commit 62feade05d
9 changed files with 86 additions and 9 deletions

View File

@ -40,10 +40,17 @@ const char** touchgui_button_imagenames = (const char*[]) {
"down_arrow.png", "down_arrow.png",
"left_arrow.png", "left_arrow.png",
"right_arrow.png", "right_arrow.png",
"inventory_btn.png",
"drop_btn.png",
"jump_btn.png", "jump_btn.png",
"down.png", "down.png",
"inventory_btn.png", "fly_btn.png",
"chat_btn.png" "noclip_btn.png",
"fast_btn.png",
"debug_btn.png",
"chat_btn.png",
"camera_btn.png",
"rangeview_btn.png"
}; };
static irr::EKEY_CODE id2keycode(touch_gui_button_id id) static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
@ -62,17 +69,38 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
case backward_id: case backward_id:
key = "backward"; key = "backward";
break; break;
case inventory_id:
key = "inventory";
break;
case drop_id:
key = "drop";
break;
case jump_id: case jump_id:
key = "jump"; key = "jump";
break; break;
case inventory_id: case crunch_id:
key = "inventory"; key = "sneak";
break;
case fly_id:
key = "freemove";
break;
case noclip_id:
key = "noclip";
break;
case fast_id:
key = "fastmove";
break;
case debug_id:
key = "toggle_debug";
break; break;
case chat_id: case chat_id:
key = "chat"; key = "chat";
break; break;
case crunch_id: case camera_id:
key = "sneak"; key = "camera_mode";
break;
case range_id:
key = "rangeselect";
break; break;
} }
assert(key != ""); assert(key != "");
@ -186,6 +214,11 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
rect<s32>(0, m_screensize.Y - (button_size/2), rect<s32>(0, m_screensize.Y - (button_size/2),
(button_size/2), m_screensize.Y), L"inv", true); (button_size/2), m_screensize.Y), L"inv", true);
/* init drop button */
initButton(drop_id,
rect<s32>(2.5*button_size, m_screensize.Y - (button_size/2),
3*button_size, m_screensize.Y), L"drop", true);
/* init jump button */ /* init jump button */
initButton(jump_id, initButton(jump_id,
rect<s32>(m_screensize.X-(1.75*button_size), rect<s32>(m_screensize.X-(1.75*button_size),
@ -202,11 +235,48 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
m_screensize.Y), m_screensize.Y),
L"H",false); L"H",false);
/* init fly button */
initButton(fly_id,
rect<s32>(m_screensize.X - (0.75*button_size),
m_screensize.Y - (2.25*button_size),
m_screensize.X, m_screensize.Y - (button_size*1.5)),
L"fly", true);
/* init noclip button */
initButton(noclip_id,
rect<s32>(m_screensize.X - (0.75*button_size), 2.25*button_size,
m_screensize.X, 3*button_size),
L"clip", true);
/* init fast button */
initButton(fast_id,
rect<s32>(m_screensize.X - (0.75*button_size), 1.5*button_size,
m_screensize.X, 2.25*button_size),
L"fast", true);
/* init debug button */
initButton(debug_id,
rect<s32>(m_screensize.X - (0.75*button_size), 0.75*button_size,
m_screensize.X, 1.5*button_size),
L"dbg", true);
/* init chat button */ /* init chat button */
initButton(chat_id, initButton(chat_id,
rect<s32>(m_screensize.X-(1.5*button_size), 0, rect<s32>(m_screensize.X - (0.75*button_size), 0,
m_screensize.X, button_size), m_screensize.X, 0.75*button_size),
L"Chat", true); L"Chat", true);
/* init camera button */
initButton(camera_id,
rect<s32>(m_screensize.X - (1.5*button_size), 0,
m_screensize.X - (0.75*button_size), 0.75*button_size),
L"cam", true);
/* init rangeselect button */
initButton(range_id,
rect<s32>(m_screensize.X - (2.25*button_size), 0,
m_screensize.X - (1.5*button_size), 0.75*button_size),
L"far", true);
} }
touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y) touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y)

View File

@ -38,10 +38,17 @@ typedef enum {
backward_id, backward_id,
left_id, left_id,
right_id, right_id,
inventory_id,
drop_id,
jump_id, jump_id,
crunch_id, crunch_id,
inventory_id, fly_id,
noclip_id,
fast_id,
debug_id,
chat_id, chat_id,
camera_id,
range_id,
after_last_element_id after_last_element_id
} touch_gui_button_id; } touch_gui_button_id;

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB