mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-12 10:20:32 +00:00
glhr:: a more efficient stringbuilder (previous version caused stack overflow in web)
This commit is contained in:
parent
adee8aa699
commit
54a9345777
20
shaders.cpp
20
shaders.cpp
@ -412,13 +412,19 @@ GLprogram *programs[gmMAX][int(shader_projection::MAX)];
|
|||||||
|
|
||||||
string stringbuilder() { return ""; }
|
string stringbuilder() { return ""; }
|
||||||
|
|
||||||
template<class... T> string stringbuilder(bool i, const string& s, T... t) {
|
bool use_next = false;
|
||||||
if(i) return s +
|
|
||||||
#if DEBUG_GL
|
int stringbuilder_helper(string& output, bool i) { use_next = i; return 0; }
|
||||||
"\n" +
|
int stringbuilder_helper(string& output, const char *s) { if(use_next) output += s; return 0; }
|
||||||
#endif
|
int stringbuilder_helper(string& output, const string& s) { if(use_next) output += s; return 0; }
|
||||||
stringbuilder(t...);
|
|
||||||
else return stringbuilder(t...);
|
template<class... T> string stringbuilder(T... t) {
|
||||||
|
use_next = true;
|
||||||
|
string output;
|
||||||
|
std::initializer_list<int> dummy = {stringbuilder_helper(output, t)...};
|
||||||
|
ignore(dummy);
|
||||||
|
println(hlog, "output = '", output, "'");
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
glmatrix current_matrix, current_modelview, current_projection;
|
glmatrix current_matrix, current_modelview, current_projection;
|
||||||
|
Loading…
Reference in New Issue
Block a user