mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-07 09:44:08 +00:00
faster reaction to mouse_movement in rug
This commit is contained in:
parent
0db0a77dcf
commit
6ac1bc0707
26
control.cpp
26
control.cpp
@ -413,6 +413,18 @@ void handleKeyNormal(int sym, int uni) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool need_mouseh = false;
|
||||||
|
|
||||||
|
void fix_mouseh() {
|
||||||
|
if(!need_mouseh) ;
|
||||||
|
#if CAP_RUG
|
||||||
|
else if(rug::rugged)
|
||||||
|
mouseh = rug::gethyper(mousex, mousey);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
mouseh = gethyper(mousex, mousey);
|
||||||
|
}
|
||||||
|
|
||||||
void handlekey(int sym, int uni) {
|
void handlekey(int sym, int uni) {
|
||||||
|
|
||||||
if(callhandlers(false, hooks_handleKey, sym, uni)) return;
|
if(callhandlers(false, hooks_handleKey, sym, uni)) return;
|
||||||
@ -519,6 +531,7 @@ void mainloopiter() {
|
|||||||
DEBB(DF_GRAPH, (debugfile,"polling for events\n"));
|
DEBB(DF_GRAPH, (debugfile,"polling for events\n"));
|
||||||
|
|
||||||
achievement_pump();
|
achievement_pump();
|
||||||
|
|
||||||
while(SDL_PollEvent(&ev)) {
|
while(SDL_PollEvent(&ev)) {
|
||||||
DEBB(DF_GRAPH, (debugfile,"got event type #%d\n", ev.type));
|
DEBB(DF_GRAPH, (debugfile,"got event type #%d\n", ev.type));
|
||||||
int sym = 0;
|
int sym = 0;
|
||||||
@ -660,6 +673,8 @@ void mainloopiter() {
|
|||||||
bool anyctrl = keystate[SDLK_LCTRL] || keystate[SDLK_RCTRL];
|
bool anyctrl = keystate[SDLK_LCTRL] || keystate[SDLK_RCTRL];
|
||||||
bool anyshift = keystate[SDLK_LSHIFT] || keystate[SDLK_RSHIFT];
|
bool anyshift = keystate[SDLK_LSHIFT] || keystate[SDLK_RSHIFT];
|
||||||
|
|
||||||
|
if(ev.type != SDL_MOUSEMOTION) fix_mouseh();
|
||||||
|
|
||||||
if(!act) ;
|
if(!act) ;
|
||||||
|
|
||||||
else if(ev.button.button==SDL_BUTTON_RIGHT || leftclick)
|
else if(ev.button.button==SDL_BUTTON_RIGHT || leftclick)
|
||||||
@ -711,14 +726,9 @@ void mainloopiter() {
|
|||||||
mousemoved = true;
|
mousemoved = true;
|
||||||
mousex = ev.motion.x;
|
mousex = ev.motion.x;
|
||||||
mousey = ev.motion.y;
|
mousey = ev.motion.y;
|
||||||
|
|
||||||
|
need_mouseh = true;
|
||||||
|
|
||||||
#if CAP_RUG
|
|
||||||
if(rug::rugged)
|
|
||||||
mouseh = rug::gethyper(mousex, mousey);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
mouseh = gethyper(mousex, mousey);
|
|
||||||
|
|
||||||
if(holdmouse && getcstat == '-') sym = uni = getcstat;
|
if(holdmouse && getcstat == '-') sym = uni = getcstat;
|
||||||
|
|
||||||
if((rightclick || (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2() &&
|
if((rightclick || (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2() &&
|
||||||
@ -746,6 +756,8 @@ void mainloopiter() {
|
|||||||
|
|
||||||
handlekey(sym, uni);
|
handlekey(sym, uni);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fix_mouseh();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user