mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-11-09 10:14:16 +00:00
more work on the online version: fullscreen, orientation
This commit is contained in:
28
hyperweb.cpp
28
hyperweb.cpp
@@ -11,6 +11,8 @@
|
||||
#define CAP_SDLTTF 0
|
||||
#define CAP_SHMUP 0
|
||||
#define CAP_RUG 1
|
||||
#define CAP_ORIENTATION 1
|
||||
#define CAP_INV 0
|
||||
#define GLES_ONLY
|
||||
|
||||
#ifdef FAKEWEB
|
||||
@@ -18,6 +20,7 @@ void mainloopiter();
|
||||
template<class A, class B, class C> void emscripten_set_main_loop(A a, B b, C c) { while(true) mainloopiter(); }
|
||||
#else
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
#endif
|
||||
|
||||
void initweb();
|
||||
@@ -110,9 +113,34 @@ void showDemo() {
|
||||
};
|
||||
}
|
||||
|
||||
EM_BOOL fsc_callback(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData) {
|
||||
if(fullscreenChangeEvent->isFullscreen) {
|
||||
vid.xres = fullscreenChangeEvent->screenWidth;
|
||||
vid.yres = fullscreenChangeEvent->screenHeight;
|
||||
setvideomode();
|
||||
}
|
||||
else {
|
||||
vid.xres = 800;
|
||||
vid.yres = 600;
|
||||
setvideomode();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void initweb() {
|
||||
rug::renderonce = true;
|
||||
// toggleanim(false);
|
||||
pushScreen(showDemo);
|
||||
}
|
||||
|
||||
transmatrix getOrientation() {
|
||||
ld alpha, beta, gamma;
|
||||
alpha = EM_ASM_DOUBLE({ return rotation_alpha; });
|
||||
beta = EM_ASM_DOUBLE({ return rotation_beta; });
|
||||
gamma = EM_ASM_DOUBLE({ return rotation_gamma; });
|
||||
printf("getOrientation %lf %lf %lf\n", alpha, beta, gamma);
|
||||
return
|
||||
rotmatrix(0, 1, alpha * M_PI / 180) *
|
||||
rotmatrix(1, 2, beta * M_PI / 180) *
|
||||
rotmatrix(0, 2, gamma * M_PI / 180);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user