aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/example')
-rw-r--r--src/example/AITest.cpp32
-rw-r--r--src/example/CMakeLists.txt2
2 files changed, 33 insertions, 1 deletions
diff --git a/src/example/AITest.cpp b/src/example/AITest.cpp
new file mode 100644
index 0000000..ccf5a85
--- /dev/null
+++ b/src/example/AITest.cpp
@@ -0,0 +1,32 @@
+#include <crepe/api/Camera.h>
+#include <crepe/api/Color.h>
+#include <crepe/api/Texture.h>
+#include <crepe/api/Sprite.h>
+#include <crepe/ComponentManager.h>
+#include <crepe/api/GameObject.h>
+#include <crepe/system/RenderSystem.h>
+#include <SDL2/SDL_timer.h>
+#include <chrono>
+
+using namespace crepe;
+
+int main() {
+ ComponentManager mgr;
+ GameObject game_object1 = mgr.new_object("", "", vec2{0, 0}, 0, 1);
+ GameObject game_object2 = mgr.new_object("", "", vec2{0, 0}, 0, 1);
+
+ Texture img = Texture("asset/texture/test_ap43.png");
+ game_object1.add_component<Sprite>(img, Color::MAGENTA, Sprite::FlipSettings{false, false}, 1, 1, 195);
+
+ game_object2.add_component<Camera>(Color::WHITE, ivec2{1080, 720}, vec2{1036, 780}, 1.0f);
+
+ RenderSystem sys{mgr};
+
+ auto start = std::chrono::steady_clock::now();
+ while (std::chrono::steady_clock::now() - start < std::chrono::seconds(5)) {
+ sys.update();
+ SDL_Delay(10);
+ }
+
+ return 0;
+}
diff --git a/src/example/CMakeLists.txt b/src/example/CMakeLists.txt
index 560e2bc..ef770ae 100644
--- a/src/example/CMakeLists.txt
+++ b/src/example/CMakeLists.txt
@@ -20,4 +20,4 @@ add_example(asset_manager)
add_example(savemgr)
add_example(rendering_particle)
add_example(gameloop)
-
+add_example(AITest)