diff options
Diffstat (limited to 'src/example/AITest.cpp')
-rw-r--r-- | src/example/AITest.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/example/AITest.cpp b/src/example/AITest.cpp index 93ba500..4c4e25e 100644 --- a/src/example/AITest.cpp +++ b/src/example/AITest.cpp @@ -30,10 +30,12 @@ class Script1 : public Script { } void init() { - subscribe<ShutDownEvent>( - [this](const ShutDownEvent & ev) -> bool { return this->shutdown(ev); }); - subscribe<MouseMoveEvent>( - [this](const MouseMoveEvent & ev) -> bool { return this->mousemove(ev); }); + subscribe<ShutDownEvent>([this](const ShutDownEvent & ev) -> bool { + return this->shutdown(ev); + }); + subscribe<MouseMoveEvent>([this](const MouseMoveEvent & ev) -> bool { + return this->mousemove(ev); + }); } }; @@ -43,21 +45,23 @@ public: 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); + 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"}; + Asset img {"asset/texture/test_ap43.png"}; Sprite & test_sprite = game_object1.add_component<Sprite>( - 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}, - }); + 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<AI>(3000); // ai.arrive_on(); @@ -65,17 +69,19 @@ public: 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>(Rigidbody::Data{ + game_object1.add_component<Rigidbody>(Rigidbody::Data { .mass = 0.1f, .max_linear_velocity = 40, }); game_object1.add_component<BehaviorScript>().set_script<Script1>(); - game_object2.add_component<Camera>(ivec2{1080, 720}, vec2{5000, 5000}, - Camera::Data{ - .bg_color = Color::WHITE, - .zoom = 1, - }); + game_object2.add_component<Camera>( + ivec2 {1080, 720}, vec2 {5000, 5000}, + Camera::Data { + .bg_color = Color::WHITE, + .zoom = 1, + } + ); } string get_name() const override { return "Scene1"; } |