settings file and save/restore ui state

This commit is contained in:
2019-04-14 18:03:41 +02:00
parent ada1afbac2
commit a8d475fbfb
15 changed files with 596 additions and 38 deletions

View File

@@ -8,6 +8,7 @@
#ifdef __APPLE__
#include <Foundation/Foundation.h>
#endif
#include "settings.h"
#ifdef __ANDROID__
void android_async_lock(struct engine* engine);
@@ -264,6 +265,10 @@ void App::initLog()
//LogRemote::I.start();
LogRemote::I.file_init();
LOG("%s", g_version);
LOG("load preferences");
if (!Settings::load())
LOG("load preferences failed");
}
int progress_callback_download(void *clientp, curl_off_t dltotal,
@@ -439,6 +444,13 @@ void App::init()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX);
int run_counter = Settings::value<Serializer::Integer>("run_counter") + 1;
Settings::set("run_counter", Serializer::Integer(run_counter));
LOG("run_counter %d", run_counter);
if (!Settings::save())
LOG("save preferences failed");
initShaders();
initAssets();
initLayout();
@@ -537,7 +549,7 @@ void App::update(float dt)
//glClear(GL_COLOR_BUFFER_BIT);
//if (!canvas->m_mouse_captured)
#if _DEBUG && (_WIN32 || __OSX__)
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
reload_timer += dt;
if (reload_timer > 1.0)
{
@@ -678,6 +690,8 @@ void App::update(float dt)
void App::terminate()
{
LOG("App::terminate");
ui_save();
NodeStrokePreview::terminate_renderer();
rec_stop();