mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 08:07:17 +07:00
add new frame_finalize stage to game loop
This commit is contained in:
@@ -53,6 +53,7 @@ namespace e2d
|
||||
virtual void shutdown() noexcept;
|
||||
virtual bool frame_tick();
|
||||
virtual void frame_render();
|
||||
virtual void frame_finalize();
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace e2d::systems
|
||||
struct pre_render_event {};
|
||||
struct post_render_event {};
|
||||
|
||||
struct frame_finalize_event {};
|
||||
|
||||
using update_system = ecs::system<update_event>;
|
||||
using post_update_system = ecs::system<post_update_event>;
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ namespace e2d
|
||||
void engine::application::frame_render() {
|
||||
}
|
||||
|
||||
void engine::application::frame_finalize() {
|
||||
}
|
||||
|
||||
//
|
||||
// engine::debug_parameters
|
||||
//
|
||||
@@ -501,6 +504,7 @@ namespace e2d
|
||||
the<window>().swap_buffers();
|
||||
}
|
||||
|
||||
app->frame_finalize();
|
||||
state_->calculate_end_frame_timers();
|
||||
} catch ( ... ) {
|
||||
app->shutdown();
|
||||
|
||||
@@ -51,10 +51,10 @@ namespace
|
||||
.add_system<flipbook_system>())
|
||||
.feature<struct label_feature>(ecs::feature()
|
||||
.add_system<label_system>())
|
||||
.feature<struct spine_feature>(ecs::feature()
|
||||
.add_system<spine_system>())
|
||||
.feature<struct render_feature>(ecs::feature()
|
||||
.add_system<render_system>());
|
||||
.add_system<render_system>())
|
||||
.feature<struct spine_feature>(ecs::feature()
|
||||
.add_system<spine_system>());
|
||||
return !application_ || application_->initialize();
|
||||
}
|
||||
|
||||
@@ -84,6 +84,13 @@ namespace
|
||||
registry.process_event(systems::render_event{});
|
||||
registry.process_event(systems::post_render_event{});
|
||||
}
|
||||
|
||||
void frame_finalize() final {
|
||||
world& w = the<world>();
|
||||
ecs::registry& registry = w.registry();
|
||||
registry.process_event(systems::frame_finalize_event{});
|
||||
w.finalize_instances();
|
||||
}
|
||||
private:
|
||||
starter::application_uptr application_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user