1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 09:30:35 +00:00

added some missing CAP_SDL and CAP_GL guards

This commit is contained in:
Zeno Rogue 2021-05-22 01:24:28 +02:00
parent 8678a2f77f
commit e78a170e7e
6 changed files with 49 additions and 7 deletions

View File

@ -243,7 +243,7 @@ EX void setcameraangle(bool b) { }
EX void reset_projection() { } EX void reset_projection() { }
EX void glflush() { } EX void glflush() { }
EX bool model_needs_depth() { return false; } EX bool model_needs_depth() { return false; }
void display_data::set_all(int ed) {} void display_data::set_all(int ed, ld lshift) {}
#endif #endif
#if CAP_GL #if CAP_GL
@ -1134,17 +1134,21 @@ EX void apply_screen_settings() {
if(vrhr::state) vrhr::shutdown_vr(); if(vrhr::state) vrhr::shutdown_vr();
#endif #endif
#if CAP_SDL
#if !CAP_SDL2 #if !CAP_SDL2
if(need_to_reopen_window()) if(need_to_reopen_window())
SDL_QuitSubSystem(SDL_INIT_VIDEO); SDL_QuitSubSystem(SDL_INIT_VIDEO);
#endif #endif
#endif
graphics_on = false; graphics_on = false;
android_settings_changed(); android_settings_changed();
init_graph(); init_graph();
#if CAP_GL
if(vid.usingGL) { if(vid.usingGL) {
glhr::be_textured(); glhr::be_nontextured(); glhr::be_textured(); glhr::be_nontextured();
} }
#endif
} }
EX pair<int, int> get_requested_resolution() { EX pair<int, int> get_requested_resolution() {
@ -1162,10 +1166,10 @@ EX pair<int, int> get_requested_resolution() {
#define CUSTOM_CAPTION ("HyperRogue " VER) #define CUSTOM_CAPTION ("HyperRogue " VER)
#endif #endif
#if CAP_SDL
EX bool resizable = true; EX bool resizable = true;
#if CAP_SDL
EX int current_window_flags = -1; EX int current_window_flags = -1;
EX void setvideomode() { EX void setvideomode() {

View File

@ -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 " "a quick implementation, so parameter values too close to 1 may "
"be buggy (outside of raycasting); try e.g. 0.9 instead.") "be buggy (outside of raycasting); try e.g. 0.9 instead.")
); );
#if CAP_GL
dialog::reaction = reset_all_shaders; dialog::reaction = reset_all_shaders;
#endif
dialog::extra_options = [] { dialog::extra_options = [] {
add_edit_fov('F', true); 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 " "a quick implementation, so parameter values too close to 1 may "
"be buggy (outside of raycasting); try e.g. 0.9 instead.") "be buggy (outside of raycasting); try e.g. 0.9 instead.")
); );
#if CAP_GL
dialog::reaction = reset_all_shaders; dialog::reaction = reset_all_shaders;
#endif
dialog::extra_options = [] { dialog::extra_options = [] {
add_edit_fov('F', true); add_edit_fov('F', true);
}; };

View File

@ -86,7 +86,9 @@ struct dqi_poly : drawqueueitem {
/** \brief temporarily cached data */ /** \brief temporarily cached data */
float cache; float cache;
void draw(); void draw();
#if CAP_GL
void gldraw(); void gldraw();
#endif
void draw_back(); void draw_back();
virtual color_t outline_group() { return outline; } virtual color_t outline_group() { return outline; }
}; };
@ -606,10 +608,14 @@ void drawTexturedTriangle(SDL_Surface *s, int *px, int *py, glvertex *tv, color_
} }
#endif #endif
#if CAP_GL
EX int global_projection; EX int global_projection;
#if !CAP_GL
flagtype get_shader_flags() { return 0; }
#endif
#if CAP_GL
int min_slr, max_slr = 0; int min_slr, max_slr = 0;
#if MAXMDIM >= 4 #if MAXMDIM >= 4
@ -1368,6 +1374,7 @@ void draw_stretch(dqi_poly *p) {
return sqhypot_d(3, a-b) < 2; return sqhypot_d(3, a-b) < 2;
}; };
#if CAP_GL
if(p->flags & POLY_TRIANGLES) { if(p->flags & POLY_TRIANGLES) {
for(int i=0; i<p->cnt; i+=3) { for(int i=0; i<p->cnt; i+=3) {
auto &la = results[i]; auto &la = results[i];
@ -1412,6 +1419,7 @@ void draw_stretch(dqi_poly *p) {
npoly.gldraw(); npoly.gldraw();
} }
} }
#endif
} }
EX namespace ods { EX namespace ods {
@ -1767,10 +1775,12 @@ void dqi_poly::draw() {
return; 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)) { 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); draw_stretch(this);
return; return;
} }
#endif
#if CAP_GL #if CAP_GL
if(vid.usingGL && (current_display->set_all(global_projection, V.shift), get_shader_flags() & SF_DIRECT)) { 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; curvedata.clear(); curvestart = 0;
} }
#if CAP_GL
GLERR("drawqueue"); GLERR("drawqueue");
#endif
} }
#if HDR #if HDR
@ -2619,6 +2631,7 @@ EX void queuestr(const shiftpoint& h, int size, const string& chr, color_t col,
EX basic_textureinfo finf; 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)) { 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); init_glfont(fsize);
glfont_t& f(*(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); 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)) { 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) { if(vid.usingGL) {
shiftmatrix V1 ; shiftmatrix V1 ;
if(GDIM == 3) 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); write_in_space(V1, max_glfont_size, size, chr, col1, frame, align);
return; return;
} }
#endif
int xc, yc, sc; int xc, yc, sc;
if(getcoord0_checked(tC0(V), xc, yc, sc)) if(getcoord0_checked(tC0(V), xc, yc, sc))
queuestr(xc, yc, sc, scale_in_pixels(V) * size, chr, col, frame, align); queuestr(xc, yc, sc, scale_in_pixels(V) * size, chr, col, frame, align);

View File

@ -5269,7 +5269,9 @@ EX int cmode;
EX void drawscreen() { EX void drawscreen() {
DEBBI(DF_GRAPH, ("drawscreen")); DEBBI(DF_GRAPH, ("drawscreen"));
#if CAP_GL
GLWRAP; GLWRAP;
#endif
if(vid.xres == 0 || vid.yres == 0) return; if(vid.xres == 0 || vid.yres == 0) return;
@ -5373,7 +5375,9 @@ EX void drawscreen() {
vrhr::submit(); vrhr::submit();
#endif #endif
#if CAP_SDL
present_screen(); present_screen();
#endif
#if CAP_VR #if CAP_VR
vrhr::handoff(); vrhr::handoff();

View File

@ -400,8 +400,10 @@ EX namespace history {
void restore(); void restore();
void restoreBack(); void restoreBack();
#if CAP_SHOT && CAP_SDL
string band_format_now = "bandmodel-$DATE-$ID" IMAGEEXT; string band_format_now = "bandmodel-$DATE-$ID" IMAGEEXT;
string band_format_auto = "bandmodel-$DATE-$ID" IMAGEEXT; string band_format_auto = "bandmodel-$DATE-$ID" IMAGEEXT;
#endif
#if CAP_SDL #if CAP_SDL
EX void createImage(const string& name_format, bool dospiral) { EX void createImage(const string& name_format, bool dospiral) {
@ -609,8 +611,10 @@ EX namespace history {
} }
else if(uni == 'o') { else if(uni == 'o') {
autoband = !autoband; autoband = !autoband;
#if CAP_SHOT && CAP_SDL
if(autoband) if(autoband)
dialog::openFileDialog(band_format_auto, XLAT("filename format to use ($ID=segment, $DATE=date)"), ".png", [] () { return true; }); dialog::openFileDialog(band_format_auto, XLAT("filename format to use ($ID=segment, $DATE=date)"), ".png", [] () { return true; });
#endif
} }
else if(uni == 'm') else if(uni == 'm')
pushScreen(models::model_menu); pushScreen(models::model_menu);
@ -725,8 +729,10 @@ EX namespace history {
addsaver(autobandhistory, "automatic band history"); addsaver(autobandhistory, "automatic band history");
addsaver(dospiral, "do spiral"); addsaver(dospiral, "do spiral");
#if CAP_SHOT && CAP_SDL
addsaver(band_format_auto, "band_format_auto"); addsaver(band_format_auto, "band_format_auto");
addsaver(band_format_now, "band_format_now"); addsaver(band_format_now, "band_format_now");
#endif
}); });
} }

View File

@ -890,11 +890,19 @@ EX namespace models {
} }
else if(argis("-palpha")) { else if(argis("-palpha")) {
PHASEFROM(2); PHASEFROM(2);
#if CAP_GL
shift_arg_formula(panini_alpha, reset_all_shaders); shift_arg_formula(panini_alpha, reset_all_shaders);
#else
shift_arg_formula(panini_alpha);
#endif
} }
else if(argis("-salpha")) { else if(argis("-salpha")) {
PHASEFROM(2); PHASEFROM(2);
#if CAP_GL
shift_arg_formula(stereo_alpha, reset_all_shaders); shift_arg_formula(stereo_alpha, reset_all_shaders);
#else
shift_arg_formula(stereo_alpha);
#endif
} }
else if(argis("-zoom")) { else if(argis("-zoom")) {
PHASEFROM(2); shift_arg_formula(vpconf.scale); PHASEFROM(2); shift_arg_formula(vpconf.scale);