From 72f04cc18113785b8f57d95254d28e7d64d584aa Mon Sep 17 00:00:00 2001 From: max-001 Date: Tue, 17 Dec 2024 08:53:03 +0100 Subject: Placed every class into seperate file --- src/example/AITest.cpp | 90 -------------------------------------------------- 1 file changed, 90 deletions(-) delete mode 100644 src/example/AITest.cpp (limited to 'src/example/AITest.cpp') diff --git a/src/example/AITest.cpp b/src/example/AITest.cpp deleted file mode 100644 index 93ba500..0000000 --- a/src/example/AITest.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace crepe; -using namespace std; - -class Script1 : public Script { - bool shutdown(const ShutDownEvent & event) { - // Very dirty way of shutting down the game - throw "ShutDownEvent"; - return true; - } - - bool mousemove(const MouseMoveEvent & event) { - /*RefVector aivec = this->get_components(); - AI & ai = aivec.front().get(); - ai.flee_target - = vec2{static_cast(event.mouse_x), static_cast(event.mouse_y)};*/ - return true; - } - - void init() { - subscribe( - [this](const ShutDownEvent & ev) -> bool { return this->shutdown(ev); }); - subscribe( - [this](const MouseMoveEvent & ev) -> bool { return this->mousemove(ev); }); - } -}; - -class Scene1 : public Scene { -public: - void load_scene() override { - Mediator & mediator = this->mediator; - ComponentManager & mgr = mediator.component_manager; - - GameObject game_object1 = mgr.new_object("", "", vec2{0, 0}, 0, 1); - GameObject game_object2 = mgr.new_object("", "", vec2{0, 0}, 0, 1); - - Asset img{"asset/texture/test_ap43.png"}; - - Sprite & test_sprite = game_object1.add_component( - img, Sprite::Data{ - .color = Color::MAGENTA, - .flip = Sprite::FlipSettings{false, false}, - .sorting_in_layer = 2, - .order_in_layer = 2, - .size = {0, 100}, - .angle_offset = 0, - .position_offset = {0, 0}, - }); - - AI & ai = game_object1.add_component(3000); - // ai.arrive_on(); - // ai.flee_on(); - ai.path_follow_on(); - ai.make_oval_path(500, 1000, {0, -1000}, 1.5708, true); - ai.make_oval_path(1000, 500, {0, 500}, 4.7124, false); - game_object1.add_component(Rigidbody::Data{ - .mass = 0.1f, - .max_linear_velocity = 40, - }); - game_object1.add_component().set_script(); - - game_object2.add_component(ivec2{1080, 720}, vec2{5000, 5000}, - Camera::Data{ - .bg_color = Color::WHITE, - .zoom = 1, - }); - } - - string get_name() const override { return "Scene1"; } -}; - -int main() { - LoopManager engine; - engine.add_scene(); - engine.start(); - - return 0; -} -- cgit v1.2.3