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