From e78a170e7efef6c13012917beb5022a4e6829aed Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 22 May 2021 01:24:28 +0200 Subject: [PATCH] added some missing CAP_SDL and CAP_GL guards --- basegraph.cpp | 10 +++++++--- config.cpp | 4 ++++ drawing.cpp | 22 +++++++++++++++++++--- graph.cpp | 4 ++++ history.cpp | 8 +++++++- models.cpp | 8 ++++++++ 6 files changed, 49 insertions(+), 7 deletions(-) diff --git a/basegraph.cpp b/basegraph.cpp index 21f7214a..22d3d681 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -243,7 +243,7 @@ EX void setcameraangle(bool b) { } EX void reset_projection() { } EX void glflush() { } EX bool model_needs_depth() { return false; } -void display_data::set_all(int ed) {} +void display_data::set_all(int ed, ld lshift) {} #endif #if CAP_GL @@ -1134,17 +1134,21 @@ EX void apply_screen_settings() { if(vrhr::state) vrhr::shutdown_vr(); #endif + #if CAP_SDL #if !CAP_SDL2 if(need_to_reopen_window()) SDL_QuitSubSystem(SDL_INIT_VIDEO); #endif + #endif graphics_on = false; android_settings_changed(); init_graph(); + #if CAP_GL if(vid.usingGL) { glhr::be_textured(); glhr::be_nontextured(); } + #endif } EX pair get_requested_resolution() { @@ -1162,10 +1166,10 @@ EX pair get_requested_resolution() { #define CUSTOM_CAPTION ("HyperRogue " VER) #endif -#if CAP_SDL - EX bool resizable = true; +#if CAP_SDL + EX int current_window_flags = -1; EX void setvideomode() { diff --git a/config.cpp b/config.cpp index 110cb678..6beb3496 100644 --- a/config.cpp +++ b/config.cpp @@ -1920,7 +1920,9 @@ EX void add_edit_fov(char key IS('f'), bool pop IS(false)) { "a quick implementation, so parameter values too close to 1 may " "be buggy (outside of raycasting); try e.g. 0.9 instead.") ); + #if CAP_GL dialog::reaction = reset_all_shaders; + #endif dialog::extra_options = [] { add_edit_fov('F', true); }; @@ -1935,7 +1937,9 @@ EX void add_edit_fov(char key IS('f'), bool pop IS(false)) { "a quick implementation, so parameter values too close to 1 may " "be buggy (outside of raycasting); try e.g. 0.9 instead.") ); + #if CAP_GL dialog::reaction = reset_all_shaders; + #endif dialog::extra_options = [] { add_edit_fov('F', true); }; diff --git a/drawing.cpp b/drawing.cpp index be1da42e..b6b763c2 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -86,7 +86,9 @@ struct dqi_poly : drawqueueitem { /** \brief temporarily cached data */ float cache; void draw(); + #if CAP_GL void gldraw(); + #endif void draw_back(); virtual color_t outline_group() { return outline; } }; @@ -606,10 +608,14 @@ void drawTexturedTriangle(SDL_Surface *s, int *px, int *py, glvertex *tv, color_ } #endif -#if CAP_GL - EX int global_projection; +#if !CAP_GL +flagtype get_shader_flags() { return 0; } +#endif + +#if CAP_GL + int min_slr, max_slr = 0; #if MAXMDIM >= 4 @@ -1368,6 +1374,7 @@ void draw_stretch(dqi_poly *p) { return sqhypot_d(3, a-b) < 2; }; + #if CAP_GL if(p->flags & POLY_TRIANGLES) { for(int i=0; icnt; i+=3) { auto &la = results[i]; @@ -1411,7 +1418,8 @@ void draw_stretch(dqi_poly *p) { npoly.cnt = isize(glcoords); npoly.gldraw(); } - } + } + #endif } EX namespace ods { @@ -1767,10 +1775,12 @@ void dqi_poly::draw() { return; } */ + #if CAP_GL if(vid.usingGL && (current_display->set_all(global_projection, V.shift), get_shader_flags() & SF_DIRECT) && sphere && (stretch::factor || ray::in_use)) { draw_stretch(this); return; } + #endif #if CAP_GL if(vid.usingGL && (current_display->set_all(global_projection, V.shift), get_shader_flags() & SF_DIRECT)) { @@ -2482,7 +2492,9 @@ EX void drawqueue() { curvedata.clear(); curvestart = 0; } + #if CAP_GL GLERR("drawqueue"); + #endif } #if HDR @@ -2619,6 +2631,7 @@ EX void queuestr(const shiftpoint& h, int size, const string& chr, color_t col, EX basic_textureinfo finf; +#if CAP_GL EX void write_in_space(const shiftmatrix& V, int fsize, double size, const string& s, color_t col, int frame IS(0), int align IS(8)) { init_glfont(fsize); glfont_t& f(*(glfont[fsize])); @@ -2672,8 +2685,10 @@ EX void write_in_space(const shiftmatrix& V, int fsize, double size, const strin curvestart = isize(curvedata); } +#endif EX void queuestr(const shiftmatrix& V, double size, const string& chr, color_t col, int frame IS(0), int align IS(8)) { + #if CAP_GL if(vid.usingGL) { shiftmatrix V1 ; if(GDIM == 3) @@ -2686,6 +2701,7 @@ EX void queuestr(const shiftmatrix& V, double size, const string& chr, color_t c write_in_space(V1, max_glfont_size, size, chr, col1, frame, align); return; } + #endif int xc, yc, sc; if(getcoord0_checked(tC0(V), xc, yc, sc)) queuestr(xc, yc, sc, scale_in_pixels(V) * size, chr, col, frame, align); diff --git a/graph.cpp b/graph.cpp index 715235fb..aa49b922 100644 --- a/graph.cpp +++ b/graph.cpp @@ -5269,7 +5269,9 @@ EX int cmode; EX void drawscreen() { DEBBI(DF_GRAPH, ("drawscreen")); + #if CAP_GL GLWRAP; + #endif if(vid.xres == 0 || vid.yres == 0) return; @@ -5373,7 +5375,9 @@ EX void drawscreen() { vrhr::submit(); #endif + #if CAP_SDL present_screen(); + #endif #if CAP_VR vrhr::handoff(); diff --git a/history.cpp b/history.cpp index f38aa2bb..294a86d5 100644 --- a/history.cpp +++ b/history.cpp @@ -399,9 +399,11 @@ EX namespace history { void restore(); void restoreBack(); - + +#if CAP_SHOT && CAP_SDL string band_format_now = "bandmodel-$DATE-$ID" IMAGEEXT; string band_format_auto = "bandmodel-$DATE-$ID" IMAGEEXT; +#endif #if CAP_SDL EX void createImage(const string& name_format, bool dospiral) { @@ -609,8 +611,10 @@ EX namespace history { } else if(uni == 'o') { autoband = !autoband; + #if CAP_SHOT && CAP_SDL if(autoband) dialog::openFileDialog(band_format_auto, XLAT("filename format to use ($ID=segment, $DATE=date)"), ".png", [] () { return true; }); + #endif } else if(uni == 'm') pushScreen(models::model_menu); @@ -725,8 +729,10 @@ EX namespace history { addsaver(autobandhistory, "automatic band history"); addsaver(dospiral, "do spiral"); + #if CAP_SHOT && CAP_SDL addsaver(band_format_auto, "band_format_auto"); addsaver(band_format_now, "band_format_now"); + #endif }); } diff --git a/models.cpp b/models.cpp index d9cefde8..2b6a8f6e 100644 --- a/models.cpp +++ b/models.cpp @@ -890,11 +890,19 @@ EX namespace models { } else if(argis("-palpha")) { PHASEFROM(2); + #if CAP_GL shift_arg_formula(panini_alpha, reset_all_shaders); + #else + shift_arg_formula(panini_alpha); + #endif } else if(argis("-salpha")) { PHASEFROM(2); + #if CAP_GL shift_arg_formula(stereo_alpha, reset_all_shaders); + #else + shift_arg_formula(stereo_alpha); + #endif } else if(argis("-zoom")) { PHASEFROM(2); shift_arg_formula(vpconf.scale);