mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-29 19:40:35 +00:00
touch-based rug movement in android
This commit is contained in:
parent
e5f1670702
commit
d3d6eec424
@ -5473,7 +5473,7 @@ void gamescreen(int _darken) {
|
||||
}
|
||||
else {
|
||||
if(andmode != 0) displayabutton(-1, +1, XLAT("MOVE"), andmode == 0 ? BTON : BTOFF);
|
||||
displayabutton(+1, +1, XLAT(andmode == 1 ? "BACK" : "DRAG"), andmode == 1 ? BTON : BTOFF);
|
||||
displayabutton(+1, +1, rug::rugged ? "RUG" : XLAT(andmode == 1 ? "BACK" : "DRAG"), andmode == 1 ? BTON : BTOFF);
|
||||
}
|
||||
displayabutton(-1, -1, XLAT("INFO"), andmode == 12 ? BTON : BTOFF);
|
||||
displayabutton(+1, -1, XLAT("MENU"), andmode == 3 ? BTON : BTOFF);
|
||||
|
9
init.cpp
9
init.cpp
@ -751,10 +751,17 @@ void mobile_draw(MOBPAR_FORMAL) {
|
||||
#endif
|
||||
|
||||
if(clicked && lclicked && andmode == 1 && (cmode & sm::NORMAL)) {
|
||||
if(!mouseout2() && mouseoh[2] < 50 && mouseh[2] < 50) {
|
||||
if(!mouseout2() && mouseoh[2] < 50 && mouseh[2] < 50 && !rug::rugged) {
|
||||
panning(mouseoh, mouseh);
|
||||
}
|
||||
}
|
||||
|
||||
static int lticks_rug;
|
||||
|
||||
if(andmode == 1 && !inmenu && rug::rugged && clicked)
|
||||
rug::move_forward((ticks - lticks_rug) / 2500);
|
||||
|
||||
lticks_rug = ticks;
|
||||
|
||||
if(andmode == 1 && lclicked && !clicked && !inmenu && mouseover)
|
||||
performMarkCommand(mouseover);
|
||||
|
17
rug.cpp
17
rug.cpp
@ -1315,6 +1315,11 @@ void apply_rotation(const transmatrix& t) {
|
||||
for(auto p: points) p->flat = t * p->flat;
|
||||
}
|
||||
|
||||
void move_forward(ld distance) {
|
||||
if(rug_perspective) push_all_points(2, -distance);
|
||||
else model_distance /= exp(distance);
|
||||
}
|
||||
|
||||
bool handlekeys(int sym, int uni) {
|
||||
if(uni == '4') {
|
||||
#if CAP_ODS
|
||||
@ -1344,16 +1349,8 @@ bool handlekeys(int sym, int uni) {
|
||||
return true;
|
||||
}
|
||||
#if !CAP_SDL
|
||||
else if(uni == SDLK_PAGEUP || uni == '[') {
|
||||
if(rug_perspective) push_all_points(2, -.1);
|
||||
else model_distance /= exp(.1);
|
||||
return true;
|
||||
}
|
||||
else if(uni == SDLK_PAGEDOWN || uni == ']') {
|
||||
if(rug_perspective) push_all_points(2, +.1);
|
||||
else model_distance *= exp(.1);
|
||||
return true;
|
||||
}
|
||||
else if(uni == SDLK_PAGEUP || uni == '[') move_forward(.1);
|
||||
else if(uni == SDLK_PAGEDOWN || uni == ']') move_forward(-.1);
|
||||
#endif
|
||||
else return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user