diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-18 11:31:54 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-18 11:31:54 +0100 |
commit | ea5e62b4ca8fbe214605abdab486bf6dcc1cc540 (patch) | |
tree | db8eaad14aad977e8b5d82ff8ae1c6f4a757430e /src/example/rendering_particle.cpp | |
parent | 81404db80bbf9463c3d535ae389e7fbb753a902c (diff) |
added particle begin lifespan rendering, added world_space to sprite so that coordinates are in camera_space or world_sapce
Diffstat (limited to 'src/example/rendering_particle.cpp')
-rw-r--r-- | src/example/rendering_particle.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp index add43f4..1c8072e 100644 --- a/src/example/rendering_particle.cpp +++ b/src/example/rendering_particle.cpp @@ -13,7 +13,6 @@ #include <crepe/manager/ComponentManager.h> #include <crepe/manager/Mediator.h> #include <crepe/types.h> -#include <iostream> using namespace crepe; using namespace std; @@ -21,11 +20,7 @@ using namespace std; class TestScene : public Scene { public: void load_scene() { - - cout << "TestScene" << endl; - Mediator & mediator = this->mediator; - ComponentManager & mgr = mediator.component_manager; - GameObject game_object = mgr.new_object("", "", vec2{0, 0}, 0, 1); + GameObject game_object = new_object("", "", vec2{0, 0}, 0, 1); Color color(255, 255, 255, 255); @@ -41,25 +36,13 @@ public: .angle_offset = 0, .position_offset = {0, 0}, }); + auto & emitter = game_object.add_component<ParticleEmitter>(test_sprite, ParticleEmitter::Data{}); - //auto & anim = game_object.add_component<Animator>(test_sprite,ivec2{32, 64}, uvec2{4,1}, Animator::Data{}); - //anim.set_anim(0); - - auto & cam = game_object.add_component<Camera>(ivec2{720, 1280}, vec2{400, 400}, + auto & cam = game_object.add_component<Camera>(ivec2{1280, 720}, vec2{400, 400}, Camera::Data{ .bg_color = Color::WHITE, }); - - function<void()> on_click = [&]() { cout << "button clicked" << std::endl; }; - function<void()> on_enter = [&]() { cout << "enter" << std::endl; }; - function<void()> on_exit = [&]() { cout << "exit" << std::endl; }; - - auto & button - = game_object.add_component<Button>(vec2{200, 200}, vec2{0, 0}, on_click, false); - button.on_mouse_enter = on_enter; - button.on_mouse_exit = on_exit; - button.is_toggle = true; - button.active = true; + cam.data.postion_offset = {1000,1000}; } string get_name() const { return "TestScene"; }; |