diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-02 20:34:00 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-02 20:34:00 +0100 |
commit | 4bbc27098d5a8907ab0500ad3ccc82283cf95ddf (patch) | |
tree | faf484ea45c432d8a1e22bc51a73325a80766e97 /src/example | |
parent | eeb66130e2cb94c94e1748576f98f78ce0f1ee86 (diff) |
merge fix and review fix
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/game.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/example/game.cpp b/src/example/game.cpp index e851526..c439f5d 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -18,7 +18,7 @@ using namespace std; class MyScript : public Script { bool oncollision(const CollisionEvent& test) { - Log::logf("Box {} script on_collision()", test.info.first.collider.game_object_id); + Log::logf("Box {} script on_collision()", test.info.first_collider.game_object_id); return true; } void init() { @@ -50,8 +50,6 @@ public: .gravity_scale = 0, .body_type = Rigidbody::BodyType::STATIC, .constraints = {0, 0, 0}, - .use_gravity = false, - .bounce = false, .offset = {0,0} }); world.add_component<BoxCollider>(vec2{0, 0-(screen_size_height/2+world_collider/2)}, world_collider, world_collider);; // Top @@ -67,17 +65,14 @@ public: .body_type = Rigidbody::BodyType::DYNAMIC, .linear_velocity = {1,1}, .constraints = {0, 0, 0}, - .use_gravity = true, - .bounce = true, .elastisity = 1, .offset = {0,0}, }); game_object1.add_component<BoxCollider>(vec2{0, 0}, 20, 20); game_object1.add_component<BehaviorScript>().set_script<MyScript>(); - game_object1.add_component<Sprite>( - make_shared<Texture>("/home/jaro/crepe/asset/texture/green_square.png"), color, - FlipSettings{true, true}); - game_object1.add_component<Camera>(Color::WHITE); + auto img = Texture("asset/texture/green_square.png"); + game_object1.add_component<Sprite>(img, color, Sprite::FlipSettings{false, false}, 1, 1, 500); + game_object1.add_component<Camera>(Color::WHITE, ivec2{1080, 720},vec2{2000, 2000}, 1.0f); } string get_name() const { return "scene1"; } |