Extend app frame planning to tick and resize
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "pch.h"
|
||||
#include "app.h"
|
||||
#include "app_core/app_frame.h"
|
||||
#include "app_core/document_platform_io.h"
|
||||
#include "app_core/document_sharing.h"
|
||||
#include "platform_api/platform_services.h"
|
||||
@@ -89,19 +90,35 @@ void App::crash_test()
|
||||
|
||||
void App::tick(float dt)
|
||||
{
|
||||
if (auto* main = layout_designer[main_id])
|
||||
const auto tick_plan = pp::app::plan_app_frame_tick(
|
||||
layout_designer.get(main_id) != nullptr,
|
||||
layout.get(main_id) != nullptr);
|
||||
if (auto* main = layout_designer[main_id]; tick_plan.tick_designer_layout && main)
|
||||
main->tick(dt);
|
||||
if (auto* main = layout[main_id])
|
||||
if (auto* main = layout[main_id]; tick_plan.tick_main_layout && main)
|
||||
main->tick(dt);
|
||||
}
|
||||
|
||||
void App::resize(float w, float h)
|
||||
{
|
||||
LOG("App::resize %d %d", (int)w, (int)h);
|
||||
uirtt.create(static_cast<int>(w), static_cast<int>(h), -1, rgba8_internal_format(), true);
|
||||
redraw = true;
|
||||
width = w;
|
||||
height = h;
|
||||
const auto resize_plan = pp::app::plan_app_resize(w, h);
|
||||
if (!resize_plan) {
|
||||
LOG("App resize plan failed: %s", resize_plan.status().message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (resize_plan.value().recreate_ui_render_target) {
|
||||
uirtt.create(
|
||||
resize_plan.value().render_target_width,
|
||||
resize_plan.value().render_target_height,
|
||||
-1,
|
||||
rgba8_internal_format(),
|
||||
true);
|
||||
}
|
||||
redraw = resize_plan.value().request_redraw;
|
||||
width = resize_plan.value().width;
|
||||
height = resize_plan.value().height;
|
||||
}
|
||||
|
||||
void App::show_cursor()
|
||||
|
||||
Reference in New Issue
Block a user