separate global tick from draw so on tick any node can request a redraw

This commit is contained in:
2018-10-08 12:03:57 +02:00
parent c9c7b9f1c4
commit 5bb8f8845b
8 changed files with 30 additions and 19 deletions

View File

@@ -442,8 +442,6 @@ void App::update(float dt)
if (canvas && canvas->m_canvas)
canvas->m_canvas->stroke_draw();
layout[main_id]->tick(dt);
if (!(redraw || animate))
return;

View File

@@ -112,6 +112,7 @@ public:
bool request_close();
void terminate();
void clear();
void tick(float dt);
void update(float dt);
void async_start();
void async_update();

View File

@@ -11,6 +11,11 @@ std::string win32_open_file();
using namespace ui;
void App::tick(float dt)
{
layout[main_id]->tick(dt);
}
void App::resize(float w, float h)
{
redraw = true;

View File

@@ -35,6 +35,11 @@
#include "node_changelog.h"
#include "node_usermanual.h"
void Node::app_redraw()
{
App::I.redraw = true;
}
void Node::async_start()
{
App::I.async_start();

View File

@@ -211,6 +211,7 @@ public:
virtual void removed(Node* parent);
const Node* init_template(const char* id);
void tick(float dt);
void app_redraw();
void async_start();
void async_update();
void async_end();

View File

@@ -16,7 +16,10 @@ void NodeTextInput::on_tick(float dt)
{
timer = 0;
if (m_cursor)
{
m_cursor->m_display = !m_cursor->m_display;
app_redraw();
}
}
}