separate global tick from draw so on tick any node can request a redraw
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user