mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-12-14 18:18:05 +00:00
touch interface
This commit is contained in:
@@ -1103,6 +1103,7 @@ EX void initConfig() {
|
||||
qm = false;
|
||||
separate_status = true;
|
||||
multi::multi_autojoy = false;
|
||||
touch_interface = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1230,6 +1231,9 @@ EX void initConfig() {
|
||||
->set_sets(sets_sfx_volume);
|
||||
#endif
|
||||
|
||||
param_b(touch_interface, "touch_interface")
|
||||
->editable("a button for easier touching", 't');
|
||||
|
||||
param_enum(dialog::display_keys, "dialog_display_keys")
|
||||
->editable({{"never", ""}, {"when using keyboard", ""}, {"always", ""}, {"SteamDeck controls", ""}}, "display keys in dialogs", 'K');
|
||||
|
||||
|
||||
30
control.cpp
30
control.cpp
@@ -194,6 +194,14 @@ EX void calcMousedest() {
|
||||
cwt = bcwt;
|
||||
}
|
||||
|
||||
#if HDR
|
||||
enum class tmode { move, info, drag, fire, ranged };
|
||||
#endif
|
||||
|
||||
EX bool touch_interface;
|
||||
EX tmode touchmode;
|
||||
EX vector<string> touch_description = { "touch to move", "touch for info", "touch to drag", "touch to aim", "touch for ranged" };
|
||||
|
||||
EX void mousemovement() {
|
||||
|
||||
#if CAP_VR
|
||||
@@ -690,11 +698,31 @@ EX void handleKeyNormal(int sym, int uni) {
|
||||
if(sym == PSEUDOKEY_NOHINT)
|
||||
no_find_player = true;
|
||||
|
||||
if(sym == PSEUDOKEY_TOUCH) {
|
||||
bool invalid;
|
||||
do {
|
||||
touchmode = (tmode) gmod(1 + int(touchmode), 5);
|
||||
invalid = touchmode == tmode::fire && !bow::crossbow_mode();
|
||||
}
|
||||
while(invalid);
|
||||
}
|
||||
|
||||
if(sym == '-' || sym == PSEUDOKEY_WHEELDOWN) {
|
||||
actonrelease = false;
|
||||
|
||||
|
||||
multi::cpid = 0;
|
||||
if(bow::fire_mode) {
|
||||
if(touchmode == tmode::drag) {
|
||||
panning(mouseoh, mouseh);
|
||||
holdmouse = true;
|
||||
}
|
||||
else if(touchmode == tmode::info)
|
||||
gotoHelp(help);
|
||||
else if(touchmode == tmode::ranged) {
|
||||
if(shmup::on ? numplayers() == 1 && !shmup::pc[0]->dead : true)
|
||||
targetRangedOrb(mouseover, roMouseForce);
|
||||
}
|
||||
else if(bow::fire_mode || (touchmode == tmode::fire && bow::crossbow_mode())) {
|
||||
if(mouseover) bow::add_fire(mouseover);
|
||||
}
|
||||
else if(mouseover &&
|
||||
|
||||
@@ -1833,6 +1833,9 @@ EX void show_menu_button() {
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("menu"), SDLK_ESCAPE, 16);
|
||||
else
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("(v) menu"), 'v', 16);
|
||||
|
||||
if(touch_interface)
|
||||
displayButton(vid.xres - 8, vid.yres - 3 * vid.fsize, XLAT(touch_description[(int) touchmode]), PSEUDOKEY_TOUCH, 16);
|
||||
}
|
||||
|
||||
EX void normalscreen() {
|
||||
|
||||
@@ -250,6 +250,7 @@
|
||||
#define PSEUDOKEY_LIST_SLIDER 2507
|
||||
#define PSEUDOKEY_SELECT 2508
|
||||
#define PSEUDOKEY_ONSCREEN_KEYBOARD 2509
|
||||
#define PSEUDOKEY_TOUCH 2510
|
||||
|
||||
#define PSEUDOKEY_JOY 4096
|
||||
#define JOY_ID 128
|
||||
|
||||
Reference in New Issue
Block a user