1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

better fullscreen in online version

This commit is contained in:
Zeno Rogue 2018-02-11 22:11:28 +01:00
parent 1781554684
commit 09631c5f6e

View File

@ -115,13 +115,17 @@ void showDemo() {
EM_BOOL fsc_callback(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData) { EM_BOOL fsc_callback(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData) {
if(fullscreenChangeEvent->isFullscreen) { if(fullscreenChangeEvent->isFullscreen) {
vid.xres = fullscreenChangeEvent->screenWidth; vid.xres = vid.xscr = fullscreenChangeEvent->screenWidth;
vid.yres = fullscreenChangeEvent->screenHeight; vid.yres = vid.yscr = fullscreenChangeEvent->screenHeight;
vid.full = true;
printf("set to %d x %d\n", vid.xres, vid.yres);
setvideomode(); setvideomode();
} }
else { else {
vid.xres = 800; vid.xres = vid.xres = 800;
vid.yres = 600; vid.yres = vid.yres = 600;
vid.full = true;
printf("reset to %d x %d\n", vid.xres, vid.yres);
setvideomode(); setvideomode();
} }
return true; return true;
@ -130,6 +134,7 @@ EM_BOOL fsc_callback(int eventType, const EmscriptenFullscreenChangeEvent *fulls
void initweb() { void initweb() {
rug::renderonce = true; rug::renderonce = true;
// toggleanim(false); // toggleanim(false);
emscripten_set_fullscreenchange_callback(0, NULL, false, fsc_callback);
pushScreen(showDemo); pushScreen(showDemo);
} }
@ -138,7 +143,6 @@ transmatrix getOrientation() {
alpha = EM_ASM_DOUBLE({ return rotation_alpha; }); alpha = EM_ASM_DOUBLE({ return rotation_alpha; });
beta = EM_ASM_DOUBLE({ return rotation_beta; }); beta = EM_ASM_DOUBLE({ return rotation_beta; });
gamma = EM_ASM_DOUBLE({ return rotation_gamma; }); gamma = EM_ASM_DOUBLE({ return rotation_gamma; });
printf("getOrientation %lf %lf %lf\n", alpha, beta, gamma);
return return
rotmatrix(0, 1, alpha * M_PI / 180) * rotmatrix(0, 1, alpha * M_PI / 180) *
rotmatrix(1, 2, beta * M_PI / 180) * rotmatrix(1, 2, beta * M_PI / 180) *