1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 13:07:16 +00:00

rogueviz/presentation:: refactured get_texture

This commit is contained in:
Zeno Rogue 2024-06-16 17:00:08 +02:00
parent 3daaaa6c6f
commit e9fe9013dc

View File

@ -159,23 +159,23 @@ void draw_texture(texture::texture_data& tex, ld dx, ld dy, ld scale1) {
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
void sub_picture(string s, flagtype flags, ld dx, ld dy, ld scale) {
texture::texture_data& get_texture(string s, flagtype flags = 0) {
if(!textures.count(s)) {
auto& tex = textures[s];
println(hlog, "rt = ", tex.readtexture(s));
println(hlog, "gl = ", tex.loadTextureGL());
}
auto& tex = textures[s];
return textures[s];
}
void sub_picture(string s, flagtype flags, ld dx, ld dy, ld scale) {
auto& tex = get_texture(s);
flat_model_enabler fme;
draw_texture(tex, dx, dy, scale);
}
void show_picture(presmode mode, string s, flagtype flags) {
if(mode == pmStartAll) {
auto& tex = textures[s];
println(hlog, "rt = ", tex.readtexture(s));
println(hlog, "gl = ", tex.loadTextureGL());
}
if(mode == pmStartAll) get_texture(s);
add_stat(mode, [s, flags] { sub_picture(s, flags); return false; });
}