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

nilrider:: textures invalidating should be fixed

This commit is contained in:
Zeno Rogue 2022-05-06 13:16:20 +02:00
parent dc375ade49
commit a0058eed72
2 changed files with 12 additions and 1 deletions

View File

@ -10,6 +10,7 @@ void level::init_textures() {
for(int stepped: {0, 1}) {
auto& target = stepped ? unil_texture_stepped : unil_texture;
if(target) return;
target = new texture::texture_data;
@ -446,6 +447,7 @@ void level::draw_level(const shiftmatrix& V) {
queuepoly(V, shField, 0xFFFF00FF);
curlev->init_textures();
if(!stepped_display) {
auto& poly = queuepoly(V, shFloor, 0xFFFFFFFF); // 0xFFFFFFFF);
poly.tinf = &uniltinf;
@ -457,5 +459,13 @@ void level::draw_level(const shiftmatrix& V) {
uniltinf_stepped.texture_id = unil_texture_stepped->textureid;
}
}
void cleanup_textures() {
for(auto l: all_levels) {
if(l->unil_texture) delete(l->unil_texture);
l->unil_texture = nullptr;
if(l->unil_texture_stepped) delete(l->unil_texture_stepped);
l->unil_texture_stepped = nullptr;
}
}
}

View File

@ -428,6 +428,7 @@ void initialize() {
rv_hook(hooks_frame, 100, frame);
rv_hook(shmup::hooks_turn, 100, turn);
rv_hook(hooks_resetGL, 100, cleanup_textures);
on = true;
on_cleanup_or_next([] { on = false; });
pushScreen(run);