1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 09:00:34 +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 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<int, int> get_requested_resolution() {
@ -1162,10 +1166,10 @@ EX pair<int, int> 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() {

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

View File

@ -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; i<p->cnt; i+=3) {
auto &la = results[i];
@ -1412,6 +1419,7 @@ void draw_stretch(dqi_poly *p) {
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);

View File

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

View File

@ -400,8 +400,10 @@ 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
});
}

View File

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