App::I static singleton to pointer

This commit is contained in:
2019-07-11 18:08:17 +02:00
parent 92dd00d910
commit b89274e7a6
33 changed files with 417 additions and 412 deletions

View File

@@ -121,7 +121,7 @@ void NodeCanvas::draw()
{
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(c.x + App::I.off_x, c.y + App::I.off_y, c.z, c.w);
glViewport(c.x + App::I->off_x, c.y + App::I->off_y, c.z, c.w);
}
// NOTE: draw_merge has been disabled for worst performance
@@ -481,7 +481,7 @@ void NodeCanvas::draw()
for (auto& mode : Canvas::modes[(int)kCanvasMode::Grid])
mode->on_Draw(ortho_proj, proj, camera);
App::I.grid->draw_heightmap(proj, camera, false);
App::I->grid->draw_heightmap(proj, camera, false);
for (auto& mode : *m_canvas->m_mode)
mode->on_Draw(ortho_proj, proj, camera);
@@ -492,7 +492,7 @@ void NodeCanvas::draw()
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(c.x + App::I.off_x, c.y + App::I.off_y, c.z, c.w);
glViewport(c.x + App::I->off_x, c.y + App::I->off_y, c.z, c.w);
// draw the canvas
m_sampler_nearest.bind(0);
@@ -567,12 +567,12 @@ kEventResult NodeCanvas::handle_event(Event* e)
break;
case kEventType::MouseUnfocus:
(*m_canvas->m_mode)[0]->m_draw_tip = false;
App::I.show_cursor();
App::I->show_cursor();
break;
case kEventType::MouseFocus:
(*m_canvas->m_mode)[0]->hide_curor &&
!App::I.keys[(int)kKey::KeyAlt] ?
App::I.hide_cursor() : App::I.show_cursor();
!App::I->keys[(int)kKey::KeyAlt] ?
App::I->hide_cursor() : App::I->show_cursor();
break;
case kEventType::KeyDown:
if (ke->m_key == kKey::KeyE)
@@ -581,40 +581,40 @@ kEventResult NodeCanvas::handle_event(Event* e)
if (!ActionManager::empty())
ActionManager::undo();
if (ke->m_key == kKey::KeyAlt && m_mouse_focus)
App::I.show_cursor();
App::I->show_cursor();
for (auto& mode : *m_canvas->m_mode)
mode->on_KeyEvent(ke);
break;
case kEventType::KeyUp:
if (ke->m_key == kKey::KeyAlt && m_mouse_focus)
(*m_canvas->m_mode)[0]->hide_curor ?
App::I.hide_cursor() : App::I.show_cursor();
App::I->hide_cursor() : App::I->show_cursor();
if (ke->m_key == kKey::KeyE)
Canvas::set_mode(kCanvasMode::Draw);
if (ke->m_key == kKey::KeyTab)
App::I.toggle_ui();
if (ke->m_key == kKey::KeyZ && App::I.keys[(int)kKey::KeyCtrl])
App::I.keys[(int)kKey::KeyShift] ? ActionManager::redo() : ActionManager::undo();
if (ke->m_key == kKey::KeyS && App::I.keys[(int)kKey::KeyCtrl] && !App::I.keys[(int)kKey::KeyShift])
App::I->toggle_ui();
if (ke->m_key == kKey::KeyZ && App::I->keys[(int)kKey::KeyCtrl])
App::I->keys[(int)kKey::KeyShift] ? ActionManager::redo() : ActionManager::undo();
if (ke->m_key == kKey::KeyS && App::I->keys[(int)kKey::KeyCtrl] && !App::I->keys[(int)kKey::KeyShift])
{
if (Canvas::I->m_newdoc)
{
App::I.dialog_save();
App::I->dialog_save();
}
else if (Canvas::I->m_unsaved)
{
Canvas::I->project_save();
}
}
if (ke->m_key == kKey::KeyS && App::I.keys[(int)kKey::KeyCtrl] && App::I.keys[(int)kKey::KeyShift])
if (ke->m_key == kKey::KeyS && App::I->keys[(int)kKey::KeyCtrl] && App::I->keys[(int)kKey::KeyShift])
{
if (Canvas::I->m_newdoc)
{
App::I.dialog_save();
App::I->dialog_save();
}
else if (Canvas::I->m_unsaved)
{
App::I.dialog_save_ver();
App::I->dialog_save_ver();
}
}
for (auto& mode : *m_canvas->m_mode)