mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-09-27 21:58:13 +00:00
smooth_movement option (not yet in menu)
This commit is contained in:
parent
5c7fd31446
commit
1f8510bc71
35
control.cpp
35
control.cpp
@ -244,8 +244,10 @@ bool didsomething;
|
|||||||
|
|
||||||
typedef SDL_Event eventtype;
|
typedef SDL_Event eventtype;
|
||||||
|
|
||||||
|
bool smooth_movement = (DIM == 3);
|
||||||
|
|
||||||
void handlePanning(int sym, int uni) {
|
void handlePanning(int sym, int uni) {
|
||||||
if(rug::rugged) return;
|
if(rug::rugged || smooth_movement) return;
|
||||||
|
|
||||||
#if !ISPANDORA
|
#if !ISPANDORA
|
||||||
if(sym == SDLK_END && DIM == 3) {
|
if(sym == SDLK_END && DIM == 3) {
|
||||||
@ -585,6 +587,37 @@ void mainloopiter() {
|
|||||||
SDL_Event ev;
|
SDL_Event ev;
|
||||||
DEBB(DF_GRAPH, (debugfile,"polling for events\n"));
|
DEBB(DF_GRAPH, (debugfile,"polling for events\n"));
|
||||||
|
|
||||||
|
if(smooth_movement && DEFAULTNOR) {
|
||||||
|
static int lastticks;
|
||||||
|
ld t = (ticks - lastticks) * shiftmul / 1000.;
|
||||||
|
lastticks = ticks;
|
||||||
|
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||||
|
if(keystate[SDLK_END] && DIM == 3 && DEFAULTNOR(SDLK_END))
|
||||||
|
View = cpush(2, -t) * View, didsomething = true, playermoved = false;
|
||||||
|
if(keystate[SDLK_HOME] && DIM == 3 && DEFAULTNOR(SDLK_HOME))
|
||||||
|
View = cpush(2, t) * View, didsomething = true, playermoved = false;
|
||||||
|
if(keystate[SDLK_RIGHT] && DEFAULTNOR(SDLK_RIGHT))
|
||||||
|
View = cspin(0, 2, -t) * View, didsomething = true;
|
||||||
|
if(keystate[SDLK_LEFT] && DEFAULTNOR(SDLK_LEFT))
|
||||||
|
View = cspin(0, 2, t) * View, didsomething = true;
|
||||||
|
if(keystate[SDLK_UP] && DEFAULTNOR(SDLK_UP))
|
||||||
|
View = cspin(1, 2, t) * View, didsomething = true;
|
||||||
|
if(keystate[SDLK_DOWN] && DEFAULTNOR(SDLK_DOWN))
|
||||||
|
View = cspin(1, 2, -t) * View, didsomething = true;
|
||||||
|
if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) {
|
||||||
|
if(conformal::on)
|
||||||
|
conformal::rotation+=t;
|
||||||
|
else
|
||||||
|
View = spin(t) * View, didsomething = true;
|
||||||
|
}
|
||||||
|
if(keystate[SDLK_PAGEDOWN] && DEFAULTNOR(SDLK_PAGEDOWN)) {
|
||||||
|
if(conformal::on)
|
||||||
|
conformal::rotation-=t;
|
||||||
|
else
|
||||||
|
View = spin(-t) * View, didsomething = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
achievement_pump();
|
achievement_pump();
|
||||||
while(SDL_PollEvent(&ev)) handle_event(ev);
|
while(SDL_PollEvent(&ev)) handle_event(ev);
|
||||||
fix_mouseh();
|
fix_mouseh();
|
||||||
|
Loading…
Reference in New Issue
Block a user