1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-26 15:13:19 +00:00

control:: sc_ticks exported so that visualizations can perfectly synchronize

This commit is contained in:
Zeno Rogue 2020-05-25 02:23:55 +02:00
parent 5654e632ce
commit d35e2ebb30

View File

@ -616,6 +616,8 @@ EX void resize_screen_to(int x, int y) {
int lastframe; int lastframe;
EX int sc_ticks;
EX void mainloopiter() { EX void mainloopiter() {
DEBB(DF_GRAPH, ("main loop\n")); DEBB(DF_GRAPH, ("main loop\n"));
@ -748,9 +750,9 @@ EX void mainloopiter() {
#endif #endif
} }
if(smooth_scrolling && !shmup::on) { if(smooth_scrolling && !shmup::on && (cmode & sm::NORMAL)) {
rug::using_rugview urv; rug::using_rugview urv;
static int lastticks; auto& lastticks = sc_ticks;
ld t = (ticks - lastticks) * shiftmul / 1000.; ld t = (ticks - lastticks) * shiftmul / 1000.;
lastticks = ticks; lastticks = ticks;
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
@ -764,6 +766,7 @@ EX void mainloopiter() {
if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) full_rotate_view(t * 180 / M_PI, t); if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) full_rotate_view(t * 180 / M_PI, t);
if(keystate[SDLK_PAGEDOWN] && DEFAULTNOR(SDLK_PAGEDOWN)) full_rotate_view(-t * 180 / M_PI, t); if(keystate[SDLK_PAGEDOWN] && DEFAULTNOR(SDLK_PAGEDOWN)) full_rotate_view(-t * 180 / M_PI, t);
} }
else sc_ticks = ticks;
achievement_pump(); achievement_pump();
while(SDL_PollEvent(&ev)) handle_event(ev); while(SDL_PollEvent(&ev)) handle_event(ev);