aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 15:40:01 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 15:40:01 +0100
commit7ec392eda3345606f0de75a432954b221cee82ce (patch)
tree48689f986a3c4042ec6b7704dad053f25ef898bf /src/example
parent202725f481e64c4d95e370102ab93d4f8cf4af93 (diff)
add doxygen + check const correctness
Diffstat (limited to 'src/example')
-rw-r--r--src/example/audio_internal.cpp4
-rw-r--r--src/example/components_internal.cpp2
-rw-r--r--src/example/db.cpp8
-rw-r--r--src/example/proxy.cpp9
-rw-r--r--src/example/rendering.cpp2
-rw-r--r--src/example/savemgr.cpp16
-rw-r--r--src/example/script.cpp6
7 files changed, 23 insertions, 24 deletions
diff --git a/src/example/audio_internal.cpp b/src/example/audio_internal.cpp
index 1ea839d..ff55a59 100644
--- a/src/example/audio_internal.cpp
+++ b/src/example/audio_internal.cpp
@@ -5,7 +5,7 @@
#include <crepe/api/Config.h>
#include <crepe/facade/Sound.h>
-#include <crepe/util/log.h>
+#include <crepe/util/Log.h>
#include <thread>
@@ -18,7 +18,7 @@ using std::make_unique;
int _ = []() {
// Show dbg_trace() output
auto & cfg = Config::get_instance();
- cfg.log.level = LogLevel::TRACE;
+ cfg.log.level = Log::Level::TRACE;
return 0; // satisfy compiler
}();
diff --git a/src/example/components_internal.cpp b/src/example/components_internal.cpp
index ea1eaad..f7e395b 100644
--- a/src/example/components_internal.cpp
+++ b/src/example/components_internal.cpp
@@ -13,7 +13,7 @@
#include <crepe/api/Rigidbody.h>
#include <crepe/api/Sprite.h>
-#include <crepe/util/log.h>
+#include <crepe/util/Log.h>
using namespace crepe;
using namespace std;
diff --git a/src/example/db.cpp b/src/example/db.cpp
index 8c06a84..ee4e8fc 100644
--- a/src/example/db.cpp
+++ b/src/example/db.cpp
@@ -1,6 +1,6 @@
#include <crepe/api/Config.h>
#include <crepe/facade/DB.h>
-#include <crepe/util/log.h>
+#include <crepe/util/Log.h>
using namespace crepe;
using namespace std;
@@ -8,7 +8,7 @@ using namespace std;
// run before main
static auto _ = []() {
auto & cfg = Config::get_instance();
- cfg.log.level = LogLevel::TRACE;
+ cfg.log.level = Log::Level::TRACE;
return 0;
}();
@@ -20,11 +20,11 @@ int main() {
const char * test_key = "test-key";
string test_data = "Hello world!";
- dbg_logf("DB has key = %d", db.has(test_key));
+ dbg_logf("DB has key = {}", db.has(test_key));
db.set(test_key, test_data);
- dbg_logf("key = \"%s\"", db.get(test_key).c_str());
+ dbg_logf("key = \"{}\"", db.get(test_key));
return 0;
}
diff --git a/src/example/proxy.cpp b/src/example/proxy.cpp
index 0afff41..ca68d9a 100644
--- a/src/example/proxy.cpp
+++ b/src/example/proxy.cpp
@@ -6,7 +6,7 @@
#include <crepe/ValueBroker.h>
#include <crepe/api/Config.h>
#include <crepe/util/Proxy.h>
-#include <crepe/util/log.h>
+#include <crepe/util/Log.h>
using namespace std;
using namespace crepe;
@@ -17,18 +17,17 @@ void test_ro_val(int val) {}
int main() {
auto & cfg = Config::get_instance();
- cfg.log.level = LogLevel::DEBUG;
+ cfg.log.level = Log::Level::DEBUG;
int real_value = 0;
ValueBroker<int> broker{
[&real_value](const int & target) {
- dbg_logf("set %s to %s", to_string(real_value).c_str(),
- to_string(target).c_str());
+ dbg_logf("set {} to {}", real_value, target);
real_value = target;
},
[&real_value]() -> const int & {
- dbg_logf("get %s", to_string(real_value).c_str());
+ dbg_logf("get {}", real_value);
return real_value;
},
};
diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp
index d554a8a..cbd7de7 100644
--- a/src/example/rendering.cpp
+++ b/src/example/rendering.cpp
@@ -1,7 +1,7 @@
#include <crepe/ComponentManager.h>
#include <crepe/api/GameObject.h>
#include <crepe/system/RenderSystem.h>
-#include <crepe/util/log.h>
+#include <crepe/util/Log.h>
#include <crepe/api/AssetManager.h>
#include <crepe/api/Color.h>
diff --git a/src/example/savemgr.cpp b/src/example/savemgr.cpp
index 436fb5a..5a415b7 100644
--- a/src/example/savemgr.cpp
+++ b/src/example/savemgr.cpp
@@ -7,7 +7,7 @@
#include <crepe/api/Config.h>
#include <crepe/api/SaveManager.h>
#include <crepe/util/Proxy.h>
-#include <crepe/util/log.h>
+#include <crepe/util/Log.h>
using namespace crepe;
@@ -15,7 +15,7 @@ using namespace crepe;
int _ = []() {
// make sure all log messages get printed
auto & cfg = Config::get_instance();
- cfg.log.level = LogLevel::TRACE;
+ cfg.log.level = Log::Level::TRACE;
return 0; // satisfy compiler
}();
@@ -25,19 +25,19 @@ int main() {
SaveManager & mgr = SaveManager::get_instance();
- dbg_logf("has key = %s", mgr.has(key) ? "true" : "false");
+ dbg_logf("has key = {}", mgr.has(key));
ValueBroker<int> prop = mgr.get<int>(key, 0);
Proxy<int> val = mgr.get<int>(key, 0);
- dbg_logf("val = %d", mgr.get<int>(key).get());
+ dbg_logf("val = {}", mgr.get<int>(key).get());
prop.set(1);
- dbg_logf("val = %d", mgr.get<int>(key).get());
+ dbg_logf("val = {}", mgr.get<int>(key).get());
val = 2;
- dbg_logf("val = %d", mgr.get<int>(key).get());
+ dbg_logf("val = {}", mgr.get<int>(key).get());
mgr.set<int>(key, 3);
- dbg_logf("val = %d", mgr.get<int>(key).get());
+ dbg_logf("val = {}", mgr.get<int>(key).get());
- dbg_logf("has key = %s", mgr.has(key) ? "true" : "false");
+ dbg_logf("has key = {}", mgr.has(key));
assert(true == mgr.has(key));
return 0;
diff --git a/src/example/script.cpp b/src/example/script.cpp
index 9e8b147..d1388b5 100644
--- a/src/example/script.cpp
+++ b/src/example/script.cpp
@@ -5,7 +5,7 @@
#include <crepe/ComponentManager.h>
#include <crepe/system/ScriptSystem.h>
-#include <crepe/util/log.h>
+#include <crepe/util/Log.h>
#include <crepe/api/BehaviorScript.h>
#include <crepe/api/Config.h>
@@ -20,7 +20,7 @@ using namespace std;
int _ = []() {
// Show dbg_trace() output
auto & cfg = Config::get_instance();
- cfg.log.level = LogLevel::TRACE;
+ cfg.log.level = Log::Level::TRACE;
return 0; // satisfy compiler
}();
@@ -30,7 +30,7 @@ class MyScript : public Script {
void update() {
// Retrieve component from the same GameObject this script is on
Transform & test = get_component<Transform>();
- dbg_logf("Transform(%.2f, %.2f)", test.position.x, test.position.y);
+ dbg_logf("Transform({:.2f}, {:.2f})", test.position.x, test.position.y);
}
};