Route live reload policy through platform services
This commit is contained in:
25
src/app.cpp
25
src/app.cpp
@@ -1014,22 +1014,23 @@ void App::ui_thread_main()
|
||||
rendered_frames = 0;
|
||||
}
|
||||
|
||||
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
|
||||
t_reloader += dt;
|
||||
if (t_reloader > 1.0)
|
||||
if (platform_enables_live_asset_reloading())
|
||||
{
|
||||
t_reloader = 0;
|
||||
if (ShaderManager::reload())
|
||||
t_reloader += dt;
|
||||
if (t_reloader > 1.0)
|
||||
{
|
||||
stroke->update_controls();
|
||||
redraw = true;
|
||||
t_reloader = 0;
|
||||
if (ShaderManager::reload())
|
||||
{
|
||||
stroke->update_controls();
|
||||
redraw = true;
|
||||
}
|
||||
if (layout.reload())
|
||||
redraw = true;
|
||||
if (layout_designer.reload())
|
||||
redraw = true;
|
||||
}
|
||||
if (layout.reload())
|
||||
redraw = true;
|
||||
if (layout_designer.reload())
|
||||
redraw = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
tick(dt);
|
||||
|
||||
|
||||
@@ -200,6 +200,7 @@ public:
|
||||
void end_render_capture_frame();
|
||||
[[nodiscard]] bool platform_deletes_recorded_files_on_clear();
|
||||
void clear_platform_recorded_files(std::string path);
|
||||
[[nodiscard]] bool platform_enables_live_asset_reloading();
|
||||
void update_platform_frame(float delta_time_seconds);
|
||||
void report_rendered_frames(int frames);
|
||||
void save_prepared_file(
|
||||
|
||||
@@ -269,6 +269,11 @@ void App::clear_platform_recorded_files(std::string path)
|
||||
active_platform_services().clear_recorded_files(path);
|
||||
}
|
||||
|
||||
bool App::platform_enables_live_asset_reloading()
|
||||
{
|
||||
return active_platform_services().enables_live_asset_reloading();
|
||||
}
|
||||
|
||||
void App::update_platform_frame(float delta_time_seconds)
|
||||
{
|
||||
active_platform_services().update_platform_frame(delta_time_seconds);
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
virtual void end_render_capture_frame() = 0;
|
||||
[[nodiscard]] virtual bool deletes_recorded_files_on_clear() = 0;
|
||||
virtual void clear_recorded_files(std::string_view recording_path) = 0;
|
||||
[[nodiscard]] virtual bool enables_live_asset_reloading() = 0;
|
||||
virtual void update_platform_frame(float delta_time_seconds) = 0;
|
||||
virtual void report_rendered_frames(int frames) = 0;
|
||||
virtual void display_file(std::string_view path) = 0;
|
||||
|
||||
@@ -230,6 +230,15 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
[[nodiscard]] bool enables_live_asset_reloading() override
|
||||
{
|
||||
#if defined(__OSX__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void update_platform_frame(float delta_time_seconds) override
|
||||
{
|
||||
(void)delta_time_seconds;
|
||||
|
||||
@@ -261,6 +261,11 @@ public:
|
||||
(void)recording_path;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool enables_live_asset_reloading() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void update_platform_frame(float delta_time_seconds) override
|
||||
{
|
||||
win32_update_stylus(delta_time_seconds);
|
||||
|
||||
Reference in New Issue
Block a user