aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/example')
-rw-r--r--src/example/asset_manager.cpp6
-rw-r--r--src/example/audio_internal.cpp13
-rw-r--r--src/example/components_internal.cpp1
-rw-r--r--src/example/db.cpp6
-rw-r--r--src/example/log.cpp9
-rw-r--r--src/example/particle.cpp14
-rw-r--r--src/example/physics.cpp8
-rw-r--r--src/example/proxy.cpp7
-rw-r--r--src/example/rendering.cpp5
-rw-r--r--src/example/savemgr.cpp4
-rw-r--r--src/example/script.cpp19
11 files changed, 40 insertions, 52 deletions
diff --git a/src/example/asset_manager.cpp b/src/example/asset_manager.cpp
index 7e15d1f..ba18b62 100644
--- a/src/example/asset_manager.cpp
+++ b/src/example/asset_manager.cpp
@@ -1,11 +1,9 @@
-
-
-#include <crepe/Sound.h>
+#include <crepe/facade/Sound.h>
#include <crepe/api/AssetManager.h>
#include <crepe/api/Texture.h>
using namespace crepe;
-using namespace crepe::api;
+
int main() {
// this needs to be called before the asset manager otherwise the destructor
diff --git a/src/example/audio_internal.cpp b/src/example/audio_internal.cpp
index f35ad9d..0b36daa 100644
--- a/src/example/audio_internal.cpp
+++ b/src/example/audio_internal.cpp
@@ -3,29 +3,26 @@
* Standalone example for usage of the internal \c Sound class.
*/
-#include <crepe/Sound.h>
-#include <crepe/util/log.h>
+#include <crepe/facade/Sound.h>
#include <crepe/api/Config.h>
+#include <crepe/util/log.h>
#include <thread>
using namespace crepe;
-using namespace crepe::api;
using namespace std;
using namespace std::chrono_literals;
using std::make_unique;
// Unrelated stuff that is not part of this POC
-int _ = [] () {
+int _ = []() {
// Show dbg_trace() output
- auto & cfg = api::Config::get_instance();
- cfg.log.level = util::LogLevel::TRACE;
+ auto & cfg = Config::get_instance();
+ cfg.log.level = LogLevel::TRACE;
return 0; // satisfy compiler
}();
-
-
int main() {
// Load a background track (Ogg Vorbis)
auto bgm = Sound("../mwe/audio/bgm.ogg");
diff --git a/src/example/components_internal.cpp b/src/example/components_internal.cpp
index 3c68974..ea1eaad 100644
--- a/src/example/components_internal.cpp
+++ b/src/example/components_internal.cpp
@@ -15,7 +15,6 @@
#include <crepe/util/log.h>
-using namespace crepe::api;
using namespace crepe;
using namespace std;
diff --git a/src/example/db.cpp b/src/example/db.cpp
index b1ab196..c046421 100644
--- a/src/example/db.cpp
+++ b/src/example/db.cpp
@@ -1,4 +1,4 @@
-#include <crepe/DB.h>
+#include <crepe/facade/DB.h>
#include <crepe/api/Config.h>
#include <crepe/util/log.h>
@@ -7,8 +7,8 @@ using namespace std;
// run before main
static auto _ = [] () {
- auto & cfg = api::Config::get_instance();
- cfg.log.level = util::LogLevel::TRACE;
+ auto & cfg = Config::get_instance();
+ cfg.log.level = LogLevel::TRACE;
return 0;
}();
diff --git a/src/example/log.cpp b/src/example/log.cpp
index 04ab9cd..db8aa48 100644
--- a/src/example/log.cpp
+++ b/src/example/log.cpp
@@ -7,16 +7,15 @@
#include <crepe/util/log.h>
using namespace crepe;
-using namespace crepe::util;
// unrelated setup code
-int _ = [] () {
+int _ = []() {
// make sure all log messages get printed
- auto & cfg = api::Config::get_instance();
- cfg.log.level = util::LogLevel::TRACE;
+ auto & cfg = Config::get_instance();
+ cfg.log.level = LogLevel::TRACE;
return 0; // satisfy compiler
-} ();
+}();
int main() {
dbg_trace();
diff --git a/src/example/particle.cpp b/src/example/particle.cpp
index 53fa213..83b1e8a 100644
--- a/src/example/particle.cpp
+++ b/src/example/particle.cpp
@@ -1,15 +1,15 @@
-#include "Particle.h"
-#include "ParticleSystem.h"
-#include "SDLApp.h"
-#include "api/ParticleEmitter.h"
#include <chrono>
+#include <iostream>
+#include <thread>
+
#include <crepe/Component.h>
#include <crepe/ComponentManager.h>
+#include <crepe/Particle.h>
+#include <crepe/facade/SDLApp.h>
#include <crepe/api/GameObject.h>
-#include <iostream>
-#include <thread>
+#include <crepe/api/ParticleEmitter.h>
+#include <crepe/system/ParticleSystem.h>
-using namespace crepe::api;
using namespace crepe;
using namespace std;
diff --git a/src/example/physics.cpp b/src/example/physics.cpp
index db69b9b..2dbddc2 100644
--- a/src/example/physics.cpp
+++ b/src/example/physics.cpp
@@ -1,15 +1,15 @@
-#include "PhysicsSystem.h"
#include <chrono>
+#include <iostream>
+#include <thread>
+
#include <crepe/Component.h>
#include <crepe/ComponentManager.h>
#include <crepe/api/Force.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Rigidbody.h>
#include <crepe/api/Transform.h>
-#include <iostream>
-#include <thread>
+#include <crepe/system/PhysicsSystem.h>
-using namespace crepe::api;
using namespace crepe;
using namespace std;
diff --git a/src/example/proxy.cpp b/src/example/proxy.cpp
index 0be4fac..9f54f96 100644
--- a/src/example/proxy.cpp
+++ b/src/example/proxy.cpp
@@ -3,22 +3,21 @@
* Standalone example for usage of the proxy type
*/
-#include "ValueBroker.h"
+#include <crepe/ValueBroker.h>
#include <crepe/api/Config.h>
#include <crepe/util/log.h>
#include <crepe/util/Proxy.h>
using namespace std;
using namespace crepe;
-using namespace crepe::util;
void test_ro_ref(const int & val) { }
void test_rw_ref(int & val) { }
void test_ro_val(int val) { }
int main() {
- auto & cfg = api::Config::get_instance();
- cfg.log.level = util::LogLevel::DEBUG;
+ auto & cfg = Config::get_instance();
+ cfg.log.level = LogLevel::DEBUG;
int real_value = 0;
diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp
index 1bf448c..b0ab60a 100644
--- a/src/example/rendering.cpp
+++ b/src/example/rendering.cpp
@@ -1,8 +1,6 @@
-
-
#include <crepe/ComponentManager.h>
-#include <crepe/RenderSystem.h>
#include <crepe/api/GameObject.h>
+#include <crepe/system/RenderSystem.h>
#include <crepe/util/log.h>
#include <crepe/api/AssetManager.h>
@@ -17,7 +15,6 @@
using namespace std;
using namespace crepe;
-using namespace crepe::api;
int main() {
diff --git a/src/example/savemgr.cpp b/src/example/savemgr.cpp
index 6d011e5..c8dd2bc 100644
--- a/src/example/savemgr.cpp
+++ b/src/example/savemgr.cpp
@@ -10,14 +10,12 @@
#include <crepe/api/Config.h>
using namespace crepe;
-using namespace crepe::api;
-using namespace crepe::util;
// unrelated setup code
int _ = [] () {
// make sure all log messages get printed
auto & cfg = Config::get_instance();
- cfg.log.level = util::LogLevel::TRACE;
+ cfg.log.level = LogLevel::TRACE;
return 0; // satisfy compiler
} ();
diff --git a/src/example/script.cpp b/src/example/script.cpp
index cda9591..dac7af3 100644
--- a/src/example/script.cpp
+++ b/src/example/script.cpp
@@ -4,7 +4,7 @@
*/
#include <crepe/ComponentManager.h>
-#include <crepe/ScriptSystem.h>
+#include <crepe/system/ScriptSystem.h>
#include <crepe/util/log.h>
#include <crepe/api/BehaviorScript.h>
@@ -14,20 +14,17 @@
#include <crepe/api/Transform.h>
using namespace crepe;
-using namespace crepe::api;
using namespace std;
// Unrelated stuff that is not part of this POC
-int _ = [] () {
+int _ = []() {
// Show dbg_trace() output
- auto & cfg = api::Config::get_instance();
- cfg.log.level = util::LogLevel::TRACE;
+ auto & cfg = Config::get_instance();
+ cfg.log.level = LogLevel::TRACE;
return 0; // satisfy compiler
}();
-
-
// User-defined script:
class MyScript : public Script {
void update() {
@@ -40,7 +37,12 @@ class MyScript : public Script {
int main() {
// Create game object with Transform and BehaviorScript components
auto obj = GameObject(0, "name", "tag", 0);
- obj.add_component<Transform>(Point { .x = 1.2, .y = 3.4, }, 0, 0);
+ obj.add_component<Transform>(
+ Point{
+ .x = 1.2,
+ .y = 3.4,
+ },
+ 0, 0);
obj.add_component<BehaviorScript>().set_script<MyScript>();
// Get ScriptSystem singleton instance (this would normally be done from the
@@ -51,4 +53,3 @@ int main() {
return EXIT_SUCCESS;
}
-