mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-09-29 06:20:41 +00:00
made it compile with RUG on emscripten (at least it should -- it does not work for me because of an emscripten bug apparently)
This commit is contained in:
parent
84b7f73920
commit
ad172724e8
@ -1074,9 +1074,11 @@ void saveHighQualityShot(const char *fname, const char *caption, int fade) {
|
|||||||
for(int i=0; i<numi; i++) {
|
for(int i=0; i<numi; i++) {
|
||||||
glbuf.clear(numi==1 ? backcolor : i ? 0xFFFFFF : 0);
|
glbuf.clear(numi==1 ? backcolor : i ? 0xFFFFFF : 0);
|
||||||
|
|
||||||
|
#if CAP_RUG
|
||||||
if(rug::rugged)
|
if(rug::rugged)
|
||||||
rug::drawRugScene();
|
rug::drawRugScene();
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
drawfullmap();
|
drawfullmap();
|
||||||
|
|
||||||
callhooks(hooks_hqshot, &glbuf);
|
callhooks(hooks_hqshot, &glbuf);
|
||||||
|
@ -268,7 +268,7 @@ void initConfig() {
|
|||||||
addsaver(geom3::highdetail, "3D highdetail");
|
addsaver(geom3::highdetail, "3D highdetail");
|
||||||
addsaver(geom3::middetail, "3D middetail");
|
addsaver(geom3::middetail, "3D middetail");
|
||||||
|
|
||||||
addsaver(memory_saving_mode, "memory_saving_mode", (ISMOBILE || ISPANDORA) ? 1 : 0);
|
addsaver(memory_saving_mode, "memory_saving_mode", (ISMOBILE || ISPANDORA || ISWEB) ? 1 : 0);
|
||||||
|
|
||||||
addsaver(rug::renderonce, "rug-renderonce");
|
addsaver(rug::renderonce, "rug-renderonce");
|
||||||
addsaver(rug::rendernogl, "rug-rendernogl");
|
addsaver(rug::rendernogl, "rug-rendernogl");
|
||||||
@ -342,7 +342,9 @@ void initConfig() {
|
|||||||
shmup::initConfig();
|
shmup::initConfig();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CAP_CONFIG
|
||||||
for(auto s: savers) s->reset();
|
for(auto s: savers) s->reset();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool inSpecialMode() {
|
bool inSpecialMode() {
|
||||||
|
@ -813,7 +813,9 @@ void displayabutton(int px, int py, string s, int col) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gmodekeys(int sym, int uni) {
|
void gmodekeys(int sym, int uni) {
|
||||||
|
#if CAP_RUG
|
||||||
if(rug::rugged) rug::handlekeys(sym, uni);
|
if(rug::rugged) rug::handlekeys(sym, uni);
|
||||||
|
#endif
|
||||||
if(uni == '1' && !rug::rugged) { vid.alpha = 999; vid.scale = 998; vid.xposition = vid.yposition = 0; }
|
if(uni == '1' && !rug::rugged) { vid.alpha = 999; vid.scale = 998; vid.xposition = vid.yposition = 0; }
|
||||||
if(uni == '2' && !rug::rugged) { vid.alpha = 1; vid.scale = 0.4; vid.xposition = vid.yposition = 0; }
|
if(uni == '2' && !rug::rugged) { vid.alpha = 1; vid.scale = 0.4; vid.xposition = vid.yposition = 0; }
|
||||||
if(uni == '3' && !rug::rugged) { vid.alpha = 1; vid.scale = 1; vid.xposition = vid.yposition = 0; }
|
if(uni == '3' && !rug::rugged) { vid.alpha = 1; vid.scale = 1; vid.xposition = vid.yposition = 0; }
|
||||||
|
@ -851,6 +851,9 @@ namespace dialog {
|
|||||||
|
|
||||||
//-- choose file dialog--
|
//-- choose file dialog--
|
||||||
|
|
||||||
|
#define CDIR 0xC0C0C0
|
||||||
|
#define CFILE forecolor
|
||||||
|
|
||||||
bool filecmp(const pair<string,int> &f1, const pair<string,int> &f2) {
|
bool filecmp(const pair<string,int> &f1, const pair<string,int> &f2) {
|
||||||
if(f1.first == "../") return true;
|
if(f1.first == "../") return true;
|
||||||
if(f2.first == "../") return false;
|
if(f2.first == "../") return false;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#define CAP_TOUR 1
|
#define CAP_TOUR 1
|
||||||
#define CAP_SDLTTF 0
|
#define CAP_SDLTTF 0
|
||||||
#define CAP_SHMUP 0
|
#define CAP_SHMUP 0
|
||||||
|
#define CAP_RUG 1
|
||||||
|
|
||||||
#ifdef FAKEWEB
|
#ifdef FAKEWEB
|
||||||
void mainloopiter();
|
void mainloopiter();
|
||||||
|
10
init.cpp
10
init.cpp
@ -299,9 +299,13 @@ void gdpush(int t);
|
|||||||
typedef int SDL_Event;
|
typedef int SDL_Event;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ISWEB
|
// #if ISWEB
|
||||||
inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; }
|
// inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; }
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
Uint8 *SDL_GetKeyState(void*);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef CAP_GLEW
|
#ifndef CAP_GLEW
|
||||||
#define CAP_GLEW (CAP_GL && !ISMOBILE && !ISMAC && !ISLINUX)
|
#define CAP_GLEW (CAP_GL && !ISMOBILE && !ISMAC && !ISLINUX)
|
||||||
|
@ -21,6 +21,36 @@ namespace mapeditor {
|
|||||||
} ew, ewsearch;
|
} ew, ewsearch;
|
||||||
bool autochoose = ISMOBILE;
|
bool autochoose = ISMOBILE;
|
||||||
|
|
||||||
|
void scaleall(ld z) {
|
||||||
|
|
||||||
|
// (mx,my) = (xcb,ycb) + ss * (xpos,ypos) + (mrx,mry) * scale
|
||||||
|
|
||||||
|
// (mrx,mry) * (scale-scale') =
|
||||||
|
// ss * ((xpos',ypos')-(xpos,ypos))
|
||||||
|
|
||||||
|
// mx = xb + ssiz*xpos + mrx * scale
|
||||||
|
// mx = xb + ssiz*xpos' + mrx * scale'
|
||||||
|
|
||||||
|
ld mrx = (.0 + mousex - vid.xcenter) / vid.scale;
|
||||||
|
ld mry = (.0 + mousey - vid.ycenter) / vid.scale;
|
||||||
|
|
||||||
|
if(vid.xres > vid.yres) {
|
||||||
|
vid.xposition += (vid.scale - vid.scale*z) * mrx / vid.scrsize;
|
||||||
|
vid.yposition += (vid.scale - vid.scale*z) * mry / vid.scrsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
vid.scale *= z;
|
||||||
|
printf("scale = " LDF "\n", vid.scale);
|
||||||
|
#if CAP_TEXTURE
|
||||||
|
texture::itt = xyscale(texture::itt, 1/z);
|
||||||
|
display(texture::itt);
|
||||||
|
if(texture::tstate) {
|
||||||
|
calcparam();
|
||||||
|
texture::perform_mapping();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if CAP_EDIT
|
#if CAP_EDIT
|
||||||
map<int, cell*> modelcell;
|
map<int, cell*> modelcell;
|
||||||
|
|
||||||
@ -427,9 +457,6 @@ namespace mapeditor {
|
|||||||
|
|
||||||
bool choosefile = false;
|
bool choosefile = false;
|
||||||
|
|
||||||
#define CDIR 0xC0C0C0
|
|
||||||
#define CFILE forecolor
|
|
||||||
|
|
||||||
void displayFunctionKeys() {
|
void displayFunctionKeys() {
|
||||||
int fs = min(vid.fsize + 5, vid.yres/26);
|
int fs = min(vid.fsize + 5, vid.yres/26);
|
||||||
displayButton(8, vid.yres-8-fs*11, XLAT("F1 = help"), SDLK_F1, 0);
|
displayButton(8, vid.yres-8-fs*11, XLAT("F1 = help"), SDLK_F1, 0);
|
||||||
@ -1348,36 +1375,6 @@ namespace mapeditor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void scaleall(ld z) {
|
|
||||||
|
|
||||||
// (mx,my) = (xcb,ycb) + ss * (xpos,ypos) + (mrx,mry) * scale
|
|
||||||
|
|
||||||
// (mrx,mry) * (scale-scale') =
|
|
||||||
// ss * ((xpos',ypos')-(xpos,ypos))
|
|
||||||
|
|
||||||
// mx = xb + ssiz*xpos + mrx * scale
|
|
||||||
// mx = xb + ssiz*xpos' + mrx * scale'
|
|
||||||
|
|
||||||
ld mrx = (.0 + mousex - vid.xcenter) / vid.scale;
|
|
||||||
ld mry = (.0 + mousey - vid.ycenter) / vid.scale;
|
|
||||||
|
|
||||||
if(vid.xres > vid.yres) {
|
|
||||||
vid.xposition += (vid.scale - vid.scale*z) * mrx / vid.scrsize;
|
|
||||||
vid.yposition += (vid.scale - vid.scale*z) * mry / vid.scrsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
vid.scale *= z;
|
|
||||||
printf("scale = " LDF "\n", vid.scale);
|
|
||||||
#if CAP_TEXTURE
|
|
||||||
texture::itt = xyscale(texture::itt, 1/z);
|
|
||||||
display(texture::itt);
|
|
||||||
if(texture::tstate) {
|
|
||||||
calcparam();
|
|
||||||
texture::perform_mapping();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
hyperpoint lstart;
|
hyperpoint lstart;
|
||||||
cell *lstartcell;
|
cell *lstartcell;
|
||||||
|
|
||||||
|
@ -1300,7 +1300,9 @@ namespace patterns {
|
|||||||
if(among(uni, PAT_EMERALD, PAT_PALACE, PAT_ZEBRA, PAT_DOWN, PAT_FIELD, PAT_COLORING, PAT_SIBLING, PAT_CHESS)) {
|
if(among(uni, PAT_EMERALD, PAT_PALACE, PAT_ZEBRA, PAT_DOWN, PAT_FIELD, PAT_COLORING, PAT_SIBLING, PAT_CHESS)) {
|
||||||
if(whichPattern == uni) whichPattern = 0;
|
if(whichPattern == uni) whichPattern = 0;
|
||||||
else whichPattern = uni;
|
else whichPattern = uni;
|
||||||
|
#if CAP_EDIT
|
||||||
mapeditor::modelcell.clear();
|
mapeditor::modelcell.clear();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(uni >= '0' && uni <= '5')
|
else if(uni >= '0' && uni <= '5')
|
||||||
|
@ -22,6 +22,8 @@ GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool glew = false;
|
||||||
|
|
||||||
renderbuffer::renderbuffer(int x, int y, bool gl) : x(x), y(y) {
|
renderbuffer::renderbuffer(int x, int y, bool gl) : x(x), y(y) {
|
||||||
|
|
||||||
valid = false;
|
valid = false;
|
||||||
|
8
rug.cpp
8
rug.cpp
@ -28,7 +28,6 @@ eGeometry gwhere = gEuclid;
|
|||||||
|
|
||||||
bool rugged = false;
|
bool rugged = false;
|
||||||
bool genrug = false;
|
bool genrug = false;
|
||||||
bool glew = false;
|
|
||||||
|
|
||||||
int vertex_limit = 20000;
|
int vertex_limit = 20000;
|
||||||
|
|
||||||
@ -1289,6 +1288,10 @@ bool handlekeys(int sym, int uni) {
|
|||||||
apply_rotation(rotmatrix(M_PI/2, 0, 2));
|
apply_rotation(rotmatrix(M_PI/2, 0, 2));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#if !CAP_SDL
|
||||||
|
else if(uni == SDLK_PAGEUP || uni == '[') rug_perspective ? push_all_points(-.1) : model_distance /= exp(.1);
|
||||||
|
else if(uni == SDLK_PAGEDOWN || uni == ']') rug_perspective ? push_all_points(+.1) : model_distance *= exp(.1);
|
||||||
|
#endif
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1305,6 +1308,8 @@ void actDraw() {
|
|||||||
if(!renderonce) prepareTexture();
|
if(!renderonce) prepareTexture();
|
||||||
physics();
|
physics();
|
||||||
drawRugScene();
|
drawRugScene();
|
||||||
|
|
||||||
|
#if CAP_SDL
|
||||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||||
int qm = 0;
|
int qm = 0;
|
||||||
double alpha = (ticks - lastticks) / 1000.0;
|
double alpha = (ticks - lastticks) / 1000.0;
|
||||||
@ -1380,6 +1385,7 @@ void actDraw() {
|
|||||||
|
|
||||||
if(qm) apply_rotation(t);
|
if(qm) apply_rotation(t);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
catch(rug_exception) {
|
catch(rug_exception) {
|
||||||
rug::close();
|
rug::close();
|
||||||
|
Loading…
Reference in New Issue
Block a user