diff --git a/basegraph.cpp b/basegraph.cpp index 74a3501c..ce14be29 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -1074,9 +1074,11 @@ void saveHighQualityShot(const char *fname, const char *caption, int fade) { for(int i=0; ireset(); +#endif } bool inSpecialMode() { diff --git a/control.cpp b/control.cpp index 944104af..0564ea9d 100644 --- a/control.cpp +++ b/control.cpp @@ -813,7 +813,9 @@ void displayabutton(int px, int py, string s, int col) { #endif void gmodekeys(int sym, int uni) { + #if CAP_RUG 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 == '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; } diff --git a/dialogs.cpp b/dialogs.cpp index b4e07ecd..5491f595 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -851,6 +851,9 @@ namespace dialog { //-- choose file dialog-- + #define CDIR 0xC0C0C0 + #define CFILE forecolor + bool filecmp(const pair &f1, const pair &f2) { if(f1.first == "../") return true; if(f2.first == "../") return false; diff --git a/hyperweb.cpp b/hyperweb.cpp index c893d15e..366c745d 100644 --- a/hyperweb.cpp +++ b/hyperweb.cpp @@ -6,6 +6,7 @@ #define CAP_TOUR 1 #define CAP_SDLTTF 0 #define CAP_SHMUP 0 +#define CAP_RUG 1 #ifdef FAKEWEB void mainloopiter(); diff --git a/init.cpp b/init.cpp index 9d58ba47..7dfffcef 100644 --- a/init.cpp +++ b/init.cpp @@ -299,9 +299,13 @@ void gdpush(int t); typedef int SDL_Event; #endif -#if ISWEB -inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; } -#endif +// #if ISWEB +// inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; } +// #endif + +extern "C" { + Uint8 *SDL_GetKeyState(void*); +} #ifndef CAP_GLEW #define CAP_GLEW (CAP_GL && !ISMOBILE && !ISMAC && !ISLINUX) diff --git a/mapeditor.cpp b/mapeditor.cpp index 16d42e48..2344fc77 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -21,6 +21,36 @@ namespace mapeditor { } ew, ewsearch; 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 map modelcell; @@ -427,9 +457,6 @@ namespace mapeditor { bool choosefile = false; - #define CDIR 0xC0C0C0 - #define CFILE forecolor - void displayFunctionKeys() { int fs = min(vid.fsize + 5, vid.yres/26); displayButton(8, vid.yres-8-fs*11, XLAT("F1 = help"), SDLK_F1, 0); @@ -1348,36 +1375,6 @@ namespace mapeditor { 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; cell *lstartcell; diff --git a/pattern2.cpp b/pattern2.cpp index 3f8a118e..9ef912d0 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -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(whichPattern == uni) whichPattern = 0; else whichPattern = uni; + #if CAP_EDIT mapeditor::modelcell.clear(); + #endif } else if(uni >= '0' && uni <= '5') diff --git a/renderbuffer.cpp b/renderbuffer.cpp index f9a16f28..bb9a02d6 100644 --- a/renderbuffer.cpp +++ b/renderbuffer.cpp @@ -22,6 +22,8 @@ GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers) #endif #endif +bool glew = false; + renderbuffer::renderbuffer(int x, int y, bool gl) : x(x), y(y) { valid = false; diff --git a/rug.cpp b/rug.cpp index c5ede86d..27874034 100644 --- a/rug.cpp +++ b/rug.cpp @@ -28,7 +28,6 @@ eGeometry gwhere = gEuclid; bool rugged = false; bool genrug = false; -bool glew = false; int vertex_limit = 20000; @@ -1289,6 +1288,10 @@ bool handlekeys(int sym, int uni) { apply_rotation(rotmatrix(M_PI/2, 0, 2)); 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; } @@ -1305,6 +1308,8 @@ void actDraw() { if(!renderonce) prepareTexture(); physics(); drawRugScene(); + + #if CAP_SDL Uint8 *keystate = SDL_GetKeyState(NULL); int qm = 0; double alpha = (ticks - lastticks) / 1000.0; @@ -1380,6 +1385,7 @@ void actDraw() { if(qm) apply_rotation(t); } + #endif } catch(rug_exception) { rug::close();