adding color picking on iOS
This commit is contained in:
@@ -88,7 +88,8 @@ void App::init()
|
||||
|
||||
LOG("Screen Resolution: %dx%d", (int)width, (int)height);
|
||||
|
||||
zoom = ceilf(width / 2000.f);
|
||||
//zoom = ceilf(width / 2000.f);
|
||||
//zoom = 2;
|
||||
|
||||
#ifdef __IOS__
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
@@ -119,6 +120,9 @@ void App::update(float dt)
|
||||
// update offscreen stuff
|
||||
if (canvas && canvas->m_canvas)
|
||||
canvas->m_canvas->stroke_draw();
|
||||
|
||||
if (!redraw)
|
||||
return;
|
||||
|
||||
//glClearColor(.1f, .1f, .1f, 1.f);
|
||||
//glViewport(0, 0, (GLsizei)width, (GLsizei)height);
|
||||
@@ -129,6 +133,13 @@ void App::update(float dt)
|
||||
#endif
|
||||
if (auto* main = layout[main_id])
|
||||
main->update(width, height, zoom);
|
||||
|
||||
static glm::vec4 color_button_normal{.1, .1, .1, 1};
|
||||
static glm::vec4 color_button_hlight{ 1, .0, .0, 1};
|
||||
CanvasModePen* mode = (CanvasModePen*)canvas->m_canvas->modes[(int)Canvas::kCanvasMode::Draw][0];
|
||||
layout[main_id]->find<NodeButton>("btn-pick")->set_color(
|
||||
mode->m_picking ? color_button_hlight : color_button_normal);
|
||||
|
||||
|
||||
auto observer = [this](Node* n)
|
||||
{
|
||||
@@ -145,7 +156,9 @@ void App::update(float dt)
|
||||
if (auto* main = layout[main_id])
|
||||
main->watch(observer);
|
||||
//msgbox->watch(observer);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
redraw = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user