more work on the online version: fullscreen, orientation

This commit is contained in:
Zeno Rogue 2018-02-11 21:39:47 +01:00
parent 7ac883c1c2
commit 1781554684
4 changed files with 37 additions and 7 deletions

View File

@ -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);
}

View File

@ -75,8 +75,8 @@ struct fullnoun {
};
#if !CAP_TRANS
#define NUMEXTRA 5
const char* natchars[NUMEXTRA] = {"°","é","á", "", "δ"};
#define NUMEXTRA 7
const char* natchars[NUMEXTRA] = {"°","é","á", "", "δ", "½", ""};
#endif
#if CAP_TRANS

View File

@ -2,7 +2,7 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
#if CAP_TABFONT
// compile with -DCAP_CREATEFONT to generate this table
// compile with -DCAP_CREATEFONT=1 to generate this table
// this variant has been created for non-translated HyperRogue
unsigned char fonttable[] = {
43,13,0,255,0,255,0,49,
@ -102,14 +102,16 @@ unsigned char fonttable[] = {
43,30,0,255,0,255,0,55,6,25,0,9,40,134,198,234,250,229,198,136,67,4,0,8,67,215,88,0,7,41,180,255,9,237,163,95,41,8,10,39,104,199,255,2,88,0,6,38,251,255,21,88,0,6,48,255,22,74,0,6,48,255,2,234,134,54,17,6,36,86,153,228,255,9,203,61,0,7,48,254,142,14,0,7,1,56,126,191,226,249,239,208,148,60,0,9,35,75,0,255,0,255,0,25,
43,22,0,199,52,255,17,204,0,3,52,255,17,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,1,208,0,13,52,255,1,204,0,3,52,255,17,204,0,3,52,255,17,204,0,46,
43,18,0,131,6,111,203,243,242,195,97,3,0,9,22,203,255,6,193,17,0,7,2,196,255,8,184,0,7,88,255,2,248,116,25,24,115,248,255,2,73,0,6,174,255,2,113,0,4,112,255,2,162,0,6,213,255,2,20,0,4,17,255,2,203,0,6,214,255,2,18,0,4,16,255,2,204,0,6,177,255,2,107,0,4,106,255,2,163,0,6,94,255,2,246,111,23,22,110,246,255,2,77,0,6,4,204,255,8,189,0,8,27,211,255,6,196,19,0,9,9,117,207,245,243,198,103,4,0,255,0,182,
43,24,0,134,20,230,255,3,208,16,0,17,175,255,3,220,24,0,17,101,255,3,229,33,0,17,37,244,255,2,238,44,0,17,4,202,255,2,244,56,0,18,132,255,2,249,70,0,18,60,252,255,1,253,85,0,64,39,120,180,221,238,250,234,211,154,83,3,0,11,37,178,254,255,9,219,81,0,9,85,243,255,13,135,0,7,72,251,255,15,120,0,5,18,240,255,5,232,99,24,5,39,154,255,5,253,54,0,4,139,255,5,244,39,0,5,142,255,5,184,0,3,1,232,255,5,123,0,6,16,251,255,5,27,0,2,47,255,6,45,0,7,214,255,5,95,0,2,85,255,20,137,0,2,106,255,20,158,0,2,106,255,20,171,0,2,85,255,20,172,0,2,49,255,6,18,0,16,1,233,255,5,100,0,17,142,255,5,233,37,0,9,29,126,162,0,4,20,241,255,5,241,130,51,13,3,17,38,82,133,206,255,2,192,0,5,76,252,255,16,192,0,6,86,242,255,15,192,0,7,34,173,252,255,13,192,0,9,30,113,170,215,234,250,246,232,218,204,181,140,97,54,12,0,218,
43,24,0,133,20,230,255,3,208,16,0,17,175,255,3,220,24,0,17,101,255,3,229,33,0,17,37,244,255,2,238,44,0,17,4,202,255,2,244,56,0,18,132,255,2,249,70,0,18,60,252,255,1,253,85,0,61,12,57,103,150,191,217,238,248,252,241,228,195,150,81,6,0,9,188,255,13,235,97,0,8,188,255,15,139,0,7,188,255,16,78,0,6,188,255,1,222,133,75,30,13,3,15,49,122,240,255,5,204,0,6,149,79,1,0,8,57,255,6,25,0,17,231,255,5,80,0,7,38,115,172,209,234,245,254,255,9,102,0,5,30,176,255,16,117,0,4,34,230,255,17,120,0,4,188,255,18,120,0,3,33,255,6,228,102,32,8,0,3,225,255,5,120,0,3,88,255,6,48,0,5,2,244,255,5,120,0,3,109,255,5,241,0,6,66,255,6,120,0,3,97,255,6,33,0,4,15,212,255,6,120,0,3,48,255,6,210,67,13,13,80,215,255,7,120,0,4,206,255,18,120,0,4,55,247,255,10,158,225,255,5,120,0,5,68,235,255,7,250,131,2,224,255,5,120,0,6,17,121,198,238,250,233,203,132,38,0,2,224,255,5,120,0,218,
43,24,0,134,49,249,255,3,174,3,0,16,9,214,255,3,188,7,0,17,149,255,3,202,12,0,17,74,255,3,214,19,0,17,22,232,255,2,224,28,0,18,179,255,2,233,37,0,18,105,255,2,241,49,0,64,39,120,180,221,238,250,234,211,154,83,3,0,11,37,178,254,255,9,219,81,0,9,85,243,255,13,135,0,7,72,251,255,15,120,0,5,18,240,255,5,232,99,24,5,39,154,255,5,253,54,0,4,139,255,5,244,39,0,5,142,255,5,184,0,3,1,232,255,5,123,0,6,16,251,255,5,27,0,2,47,255,6,45,0,7,214,255,5,95,0,2,85,255,20,137,0,2,106,255,20,158,0,2,106,255,20,171,0,2,85,255,20,172,0,2,49,255,6,18,0,16,1,233,255,5,100,0,17,142,255,5,233,37,0,9,29,126,162,0,4,20,241,255,5,241,130,51,13,3,17,38,82,133,206,255,2,192,0,5,76,252,255,16,192,0,6,86,242,255,15,192,0,7,34,173,252,255,13,192,0,9,30,113,170,215,234,250,246,232,218,204,181,140,97,54,12,0,218,
43,24,0,134,182,255,3,242,51,0,17,108,255,3,247,64,0,17,42,246,255,2,252,79,0,17,6,207,255,2,254,95,0,18,139,255,3,112,0,18,65,254,255,2,131,0,18,17,227,255,2,150,0,61,12,57,103,150,191,217,238,248,252,241,228,195,150,81,6,0,9,188,255,13,235,97,0,8,188,255,15,139,0,7,188,255,16,78,0,6,188,255,1,222,133,75,30,13,3,15,49,122,240,255,5,204,0,6,149,79,1,0,8,57,255,6,25,0,17,231,255,5,80,0,7,38,115,172,209,234,245,254,255,9,102,0,5,30,176,255,16,117,0,4,34,230,255,17,120,0,4,188,255,18,120,0,3,33,255,6,228,102,32,8,0,3,225,255,5,120,0,3,88,255,6,48,0,5,2,244,255,5,120,0,3,109,255,5,241,0,6,66,255,6,120,0,3,97,255,6,33,0,4,15,212,255,6,120,0,3,48,255,6,210,67,13,13,80,215,255,7,120,0,4,206,255,18,120,0,4,55,247,255,10,158,225,255,5,120,0,5,68,235,255,7,250,131,2,224,255,5,120,0,6,17,121,198,238,250,233,203,132,38,0,2,224,255,5,120,0,218,
43,17,0,113,9,12,12,12,2,0,12,196,255,3,56,0,12,196,255,3,56,0,12,196,255,3,56,0,8,2,0,3,196,255,3,56,0,5,75,193,247,252,219,128,9,196,255,3,56,0,4,121,255,6,204,211,255,3,56,0,3,63,254,255,3,202,144,178,254,255,4,56,0,3,181,255,3,167,1,0,2,104,255,4,56,0,3,245,255,3,51,0,3,3,237,255,3,56,0,2,14,255,4,17,0,4,206,255,3,56,0,2,6,255,4,30,0,4,219,255,3,56,0,3,219,255,3,93,0,3,32,251,255,3,56,0,3,130,255,3,230,74,16,49,199,255,4,56,0,3,14,221,255,6,254,242,255,3,56,0,4,31,203,255,4,241,93,196,255,3,56,0,5,1,66,121,127,92,17,0,1,49,64,64,64,14,0,255,0,86,
43,25,0,182,62,132,185,218,239,249,250,236,214,166,104,17,0,11,55,210,255,11,248,132,8,0,8,57,249,255,14,84,0,8,200,255,15,84,0,7,10,255,16,84,0,7,20,255,5,207,52,12,2,6,12,24,46,73,119,184,79,0,8,227,255,4,235,122,64,28,5,0,15,95,255,8,253,213,159,82,10,0,12,98,240,255,10,237,128,10,0,10,100,237,255,12,220,49,0,8,145,255,15,237,47,0,6,122,255,6,225,207,250,255,8,214,4,0,4,47,252,255,5,168,7,0,1,7,60,173,255,7,101,0,4,183,255,5,212,6,0,5,121,255,6,186,0,3,21,252,255,5,101,0,7,201,255,5,248,4,0,2,77,255,6,41,0,7,118,255,6,25,0,2,103,255,6,20,0,7,87,255,6,45,0,2,99,255,6,27,0,7,91,255,6,35,0,2,78,255,6,65,0,7,128,255,6,14,0,2,36,255,6,145,0,6,1,211,255,5,225,0,4,222,255,5,248,48,0,5,112,255,6,156,0,4,126,255,6,238,106,25,5,39,143,254,255,6,56,0,4,13,234,255,17,177,0,6,64,250,255,15,221,20,0,7,79,241,255,13,212,36,0,9,35,176,254,255,9,244,142,10,0,12,38,120,182,221,240,251,236,216,168,104,19,0,232,
43,37,0,255,0,42,1,47,110,174,236,255,3,192,0,14,11,225,255,2,237,21,0,8,64,255,7,192,0,14,143,255,3,97,0,9,64,255,7,192,0,13,51,252,255,2,190,0,10,62,209,147,84,93,255,3,192,0,12,3,206,255,2,248,37,0,14,72,255,3,192,0,12,116,255,3,124,0,15,72,255,3,192,0,11,32,245,255,2,212,5,0,15,72,255,3,192,0,11,183,255,2,254,58,0,16,72,255,3,192,0,10,89,255,3,151,0,17,72,255,3,192,0,9,17,232,255,2,230,15,0,17,72,255,3,192,0,9,156,255,3,83,0,18,72,255,3,192,0,8,62,254,255,2,178,0,19,72,255,3,192,0,7,7,216,255,2,243,29,0,16,236,255,10,88,0,3,130,255,3,110,0,2,33,108,168,212,242,252,240,204,132,24,0,5,236,255,10,88,0,2,41,249,255,2,202,2,0,1,48,255,9,240,65,0,4,236,255,10,88,0,1,1,195,255,2,251,47,0,2,52,255,10,236,15,0,16,103,255,3,137,0,3,52,255,1,239,136,52,11,26,151,255,4,87,0,15,24,239,255,2,222,9,0,3,48,145,14,0,4,2,233,255,3,107,0,15,170,255,3,70,0,11,1,231,255,3,73,0,14,75,255,3,164,0,12,94,255,3,230,5,0,13,11,225,255,2,237,21,0,11,68,245,255,2,253,76,0,14,143,255,3,97,0,11,99,249,255,2,254,101,0,14,51,252,255,2,190,0,10,5,149,255,3,244,87,0,14,3,206,255,2,248,37,0,9,22,194,255,3,214,42,0,15,116,255,3,124,0,9,52,226,255,3,164,11,0,15,32,245,255,2,212,5,0,8,49,247,255,10,136,0,10,183,255,2,254,58,0,9,76,255,11,136,0,24,76,255,11,136,0,255,0,42,
43,30,0,255,0,202,2,29,38,9,0,8,7,32,20,0,13,5,121,230,255,2,247,155,15,0,4,26,167,247,255,2,219,101,1,0,9,2,175,255,6,214,21,0,2,33,230,255,6,153,0,9,111,255,8,193,1,3,202,255,8,100,0,7,7,235,255,2,201,110,112,219,255,3,104,113,255,3,196,123,124,214,255,2,232,6,0,6,78,255,2,192,3,0,2,13,196,255,2,234,239,255,2,110,0,3,7,199,255,2,76,0,6,135,255,2,60,0,4,20,227,255,4,131,0,5,60,255,2,134,0,6,163,255,1,249,2,0,5,71,255,3,214,6,0,5,3,250,255,1,161,0,6,171,255,1,234,0,7,193,255,2,221,7,0,6,234,255,1,170,0,6,155,255,2,12,0,5,42,250,255,3,134,0,5,14,255,2,154,0,6,115,255,2,109,0,4,15,207,255,4,253,71,0,4,113,255,2,112,0,6,46,255,2,239,69,0,2,49,205,255,2,198,192,255,2,244,78,0,2,54,238,255,2,43,0,7,193,255,3,230,230,255,3,252,52,47,250,255,3,215,214,255,3,191,0,8,42,245,255,7,130,0,2,120,255,7,248,44,0,9,65,236,255,5,149,1,0,3,131,254,255,4,242,76,0,11,19,117,173,185,151,62,0,6,57,154,190,182,128,27,0,255,0,111,
255
};
#define NUMEXTRA 5
#define NUMEXTRA 7
unsigned char *ftv = fonttable;

View File

@ -13,7 +13,7 @@ void glError(const char* GLcall, const char* file, const int line) {
}
}
#define CAP_VERTEXBUFFER (!ISWEB)
#define CAP_VERTEXBUFFER (ISWEB)
namespace glhr {