mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-07 11:17:00 +00:00
a system to limit the framerate if not currently showing an animated screen
This commit is contained in:
parent
a36c4415da
commit
5fb1ff4d21
16
control.cpp
16
control.cpp
@ -395,6 +395,7 @@ EX ld camera_speed = 1;
|
||||
EX ld camera_rot_speed = 1;
|
||||
|
||||
EX void full_forward_camera(ld t) {
|
||||
if(t) currently_scrolling = true;
|
||||
if(anyshiftclick)
|
||||
zoom_or_fov(exp(-t/10.));
|
||||
else if(GDIM == 3) {
|
||||
@ -409,6 +410,7 @@ EX void full_cstrafe_camera(int dir, ld t) {
|
||||
shift_view(ctangent(dir, t * camera_speed));
|
||||
didsomething = true;
|
||||
playermoved = false;
|
||||
if(t) currently_scrolling = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,6 +426,7 @@ EX ld third_person_rotation = 0;
|
||||
|
||||
EX void full_rotate_camera(int dir, ld val) {
|
||||
if(!val) return;
|
||||
currently_scrolling = true;
|
||||
if(rug::rug_control() && lshiftclick) {
|
||||
val *= camera_rot_speed;
|
||||
hyperpoint h;
|
||||
@ -478,6 +481,7 @@ EX void full_rotate_camera(int dir, ld val) {
|
||||
}
|
||||
|
||||
EX void full_rotate_view(ld h, ld v) {
|
||||
if(v) currently_scrolling = true;
|
||||
if(history::on && !rug::rug_control())
|
||||
models::rotation = spin(h * camera_rot_speed) * models::rotation;
|
||||
else {
|
||||
@ -491,8 +495,8 @@ EX void full_rotate_view(ld h, ld v) {
|
||||
EX void handlePanning(int sym, int uni) {
|
||||
if(mousepan && dual::split([=] { handlePanning(sym, uni); })) return;
|
||||
if(GDIM == 3) {
|
||||
if(sym == PSEUDOKEY_WHEELUP) shift_view(ztangent(-0.05*shiftmul) * camera_speed), didsomething = true, playermoved = false;
|
||||
if(sym == PSEUDOKEY_WHEELDOWN) shift_view(ztangent(0.05*shiftmul) * camera_speed), didsomething = true, playermoved = false;
|
||||
if(sym == PSEUDOKEY_WHEELUP) shift_view(ztangent(-0.05*shiftmul) * camera_speed), didsomething = true, playermoved = false, currently_scrolling = true;
|
||||
if(sym == PSEUDOKEY_WHEELDOWN) shift_view(ztangent(0.05*shiftmul) * camera_speed), didsomething = true, playermoved = false, currently_scrolling = true;
|
||||
}
|
||||
|
||||
#if CAP_RUG
|
||||
@ -519,7 +523,7 @@ EX void handlePanning(int sym, int uni) {
|
||||
if(sym == PSEUDOKEY_WHEELUP && GDIM == 2) {
|
||||
ld jx = (mousex - current_display->xcenter - .0) / current_display->radius / 10;
|
||||
ld jy = (mousey - current_display->ycenter - .0) / current_display->radius / 10;
|
||||
playermoved = false;
|
||||
playermoved = false; currently_scrolling = true;
|
||||
rotate_view(gpushxto0(hpxy(jx * camera_speed, jy * camera_speed)));
|
||||
sym = 1;
|
||||
}
|
||||
@ -776,6 +780,10 @@ EX bool mouseaiming(bool shmupon) {
|
||||
|
||||
EX purehookset hooks_control;
|
||||
|
||||
EX bool stillscreen;
|
||||
|
||||
EX bool currently_scrolling;
|
||||
|
||||
EX void mainloopiter() {
|
||||
GLWRAP;
|
||||
DEBB(DF_GRAPH, ("main loop\n"));
|
||||
@ -803,7 +811,7 @@ EX void mainloopiter() {
|
||||
timetowait = lastframe + 1000 / cframelimit - ticks;
|
||||
|
||||
cframelimit = vid.framelimit;
|
||||
if(outoffocus && cframelimit > 10) cframelimit = 10;
|
||||
if(stillscreen && cframelimit > 10) cframelimit = 10;
|
||||
|
||||
bool normal = cmode & sm::NORMAL;
|
||||
|
||||
|
@ -5816,6 +5816,7 @@ EX string menu_format = "";
|
||||
EX void gamescreen() {
|
||||
|
||||
if(cmode & sm::NOSCR) {
|
||||
stillscreen = true;
|
||||
emptyscreen();
|
||||
return;
|
||||
}
|
||||
@ -5837,6 +5838,8 @@ EX void gamescreen() {
|
||||
return;
|
||||
}
|
||||
|
||||
stillscreen = false;
|
||||
|
||||
auto gx = vid.xres;
|
||||
auto gy = vid.yres;
|
||||
|
||||
|
@ -1803,7 +1803,7 @@ EX bool any_animation() {
|
||||
}
|
||||
|
||||
EX bool any_on() {
|
||||
return any_animation() || history::includeHistory;
|
||||
return any_animation() || history::includeHistory || currently_scrolling;
|
||||
}
|
||||
|
||||
EX bool center_music() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user