1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-15 15:42:49 +00:00

fixed some issues with commandline arguments (svg shots made correctly from cli)

This commit is contained in:
Zeno Rogue 2019-01-24 14:48:53 +01:00
parent 40aea82374
commit 8ac1cf8731
5 changed files with 18 additions and 5 deletions

View File

@ -142,7 +142,7 @@ int arg::readCommon() {
PHASE(3); drawscreen(); PHASE(3); drawscreen();
} }
else if(argis("-rotate")) { else if(argis("-rotate")) {
PHASE(3); PHASE(3); start_game();
shift(); ld a = argf(); shift(); ld a = argf();
shift(); ld b = argf(); shift(); ld b = argf();
View = View * spin(M_PI * 2 * a / b); View = View * spin(M_PI * 2 * a / b);

View File

@ -1761,18 +1761,23 @@ int read_config_args() {
shift(); vid.aurasmoothen = argi(); shift(); vid.aurasmoothen = argi();
} }
else if(argis("-nofps")) { else if(argis("-nofps")) {
PHASEFROM(2);
nofps = true; nofps = true;
} }
else if(argis("-nohud")) { else if(argis("-nohud")) {
PHASEFROM(2);
nohud = true; nohud = true;
} }
else if(argis("-nomenu")) { else if(argis("-nomenu")) {
PHASEFROM(2);
nomenukey = true; nomenukey = true;
} }
else if(argis("-nohelp")) { else if(argis("-nohelp")) {
PHASEFROM(2);
nohelp = true; nohelp = true;
} }
else if(argis("-dont_face_pc")) { else if(argis("-dont_face_pc")) {
PHASEFROM(2);
dont_face_pc = true; dont_face_pc = true;
} }

View File

@ -443,7 +443,7 @@ void glflush() {
if(isize(text_vertices)) { if(isize(text_vertices)) {
// printf("%08X | %d texts, %d vertices\n", text_color, texts_merged, isize(text_vertices)); // printf("%08X | %d texts, %d vertices\n", text_color, texts_merged, isize(text_vertices));
current_display->set_projection(0, false); if(!svg::in) current_display->set_projection(0, false);
glhr::be_textured(); glhr::be_textured();
glBindTexture(GL_TEXTURE_2D, text_texture); glBindTexture(GL_TEXTURE_2D, text_texture);
glhr::color2(text_color); glhr::color2(text_color);
@ -462,7 +462,7 @@ void glflush() {
GLERR("print"); GLERR("print");
} }
if(current_display->stereo_active() && text_shift) current_display->set_mask(0); if(current_display->stereo_active() && text_shift && !svg::in) current_display->set_mask(0);
texts_merged = 0; texts_merged = 0;
text_vertices.clear(); text_vertices.clear();

View File

@ -181,7 +181,7 @@ namespace svg {
x.document.close(); x.document.close();
}, f.s.c_str()); }, f.s.c_str());
#else #else
fclose(f.f); fclose(f.f); f.f = NULL;
#endif #endif
} }
@ -203,7 +203,8 @@ int read_args() {
else if(argis("-svgshot")) { else if(argis("-svgshot")) {
PHASE(3); shift(); start_game(); PHASE(3); shift(); start_game();
printf("saving SVG screenshot to %s\n", argcs()); printf("saving SVG screenshot to %s\n", argcs());
svg::render(argcs()); shot::make_svg = true;
shot::take(argcs());
} }
else return 1; else return 1;
return 0; return 0;
@ -321,6 +322,7 @@ void take(string fname, const function<void()>& what) {
vid.xres = shotx * multiplier; vid.xres = shotx * multiplier;
vid.yres = shoty * multiplier; vid.yres = shoty * multiplier;
calcparam(); calcparam();
conformal::configure();
if(make_svg) { if(make_svg) {
#if CAP_SVG #if CAP_SVG
@ -378,6 +380,9 @@ int png_read_args() {
else if(argis("-pngformat")) { else if(argis("-pngformat")) {
shift(); shotformat = argi(); shift(); shotformat = argi();
} }
else if(argis("-shotxy")) {
shift(); shotformat = -1; shotx = argi(); shift(); shoty = argi();
}
else if(argis("-shott")) { else if(argis("-shott")) {
shift(); shot::transparent = argi(); shift(); shot::transparent = argi();
} }

View File

@ -305,6 +305,7 @@ bool operator != (const glmatrix& m1, const glmatrix& m2) {
} }
void set_modelview(const glmatrix& modelview) { void set_modelview(const glmatrix& modelview) {
if(!current) return;
if(current_shader_projection != shader_projection::standard) { if(current_shader_projection != shader_projection::standard) {
if(modelview != current_modelview) { if(modelview != current_modelview) {
current_modelview = modelview; current_modelview = modelview;
@ -328,6 +329,7 @@ void set_modelview(const glmatrix& modelview) {
} }
void id_modelview() { void id_modelview() {
if(!current) return;
if(current_shader_projection != shader_projection::standard) { set_modelview(id); return; } if(current_shader_projection != shader_projection::standard) { set_modelview(id); return; }
#if MINIMIZE_GL_CALLS #if MINIMIZE_GL_CALLS
if(projection == current_matrix) return; if(projection == current_matrix) return;
@ -344,6 +346,7 @@ void color2(color_t color, ld part) {
for(int i=0; i<4; i++) cols[i] = c[3-i] / 255.0 * part; for(int i=0; i<4; i++) cols[i] = c[3-i] / 255.0 * part;
#if CAP_SHADER #if CAP_SHADER
// glUniform4fv(current->uFog, 4, cols); // glUniform4fv(current->uFog, 4, cols);
if(!current) return;
glUniform4f(current->uColor, cols[0], cols[1], cols[2], cols[3]); glUniform4f(current->uColor, cols[0], cols[1], cols[2], cols[3]);
#else #else
glColor4f(cols[0], cols[1], cols[2], cols[3]); glColor4f(cols[0], cols[1], cols[2], cols[3]);