/** \file * * Standalone example for usage of the save manager */ #include #include #include #include #include using namespace crepe; // unrelated setup code int _ = [] () { // make sure all log messages get printed auto & cfg = Config::get_instance(); cfg.log.level = LogLevel::TRACE; return 0; // satisfy compiler } (); int main() { const char * key = "mygame.test"; SaveManager & mgr = SaveManager::get_instance(); dbg_logf("has key = %s", mgr.has(key) ? "true" : "false"); ValueBroker prop = mgr.get(key, 0); Proxy val = mgr.get(key, 0); dbg_logf("val = %d", mgr.get(key).get()); prop.set(1); dbg_logf("val = %d", mgr.get(key).get()); val = 2; dbg_logf("val = %d", mgr.get(key).get()); mgr.set(key, 3); dbg_logf("val = %d", mgr.get(key).get()); dbg_logf("has key = %s", mgr.has(key) ? "true" : "false"); assert(true == mgr.has(key)); return 0; }