diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-06 11:13:01 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-12-06 11:13:01 +0100 |
commit | 0c1cd46d22d9006ab46442c92bc7bd8858079ea8 (patch) | |
tree | 5e83fde792aade105080238cf4b2bdd1730aa750 /src | |
parent | d5f63024ebed7df2fff8e016bd1c7c26f8fdfa27 (diff) |
merged master
Diffstat (limited to 'src')
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 4 | ||||
-rw-r--r-- | src/crepe/system/InputSystem.cpp | 4 | ||||
-rw-r--r-- | src/doc/feature/animator_creation.dox | 0 | ||||
-rw-r--r-- | src/example/rendering_particle.cpp | 28 |
4 files changed, 10 insertions, 26 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 72b4e42..0097070 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -11,7 +11,6 @@ #include <cstddef> #include <cstdint> #include <functional> -#include <iostream> #include <memory> #include <stdexcept> @@ -19,7 +18,6 @@ #include "../api/Config.h" #include "../api/Sprite.h" #include "../api/Texture.h" -#include "../manager/EventManager.h" #include "../util/Log.h" #include "SDLContext.h" @@ -273,7 +271,7 @@ void SDLContext::draw(const RenderContext & ctx) { double angle = ctx.angle + data.angle_offset; - this->set_color_texture(ctx.sprite.sprite_image, ctx.sprite.color); + this->set_color_texture(ctx.sprite.texture, ctx.sprite.data.color); SDL_RenderCopyExF(this->game_renderer.get(), ctx.sprite.texture.texture.get(), &srcrect, &dstrect, angle, NULL, render_flip); } diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index 7cc8d30..56a40b7 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -25,9 +25,9 @@ void InputSystem::update() { = mgr.get_components_by_id<Transform>(current_cam.game_object_id); Transform & cam_transform = transform_vec.front().get(); int camera_origin_x - = cam_transform.position.x + current_cam.offset.x - (current_cam.viewport_size.x / 2); + = cam_transform.position.x + current_cam.data.offset.x - (current_cam.viewport_size.x / 2); int camera_origin_y - = cam_transform.position.y + current_cam.offset.y - (current_cam.viewport_size.y / 2); + = cam_transform.position.y + current_cam.data.offset.y - (current_cam.viewport_size.y / 2); for (const SDLContext::EventData & event : event_list) { int world_mouse_x = event.mouse_position.x + camera_origin_x; diff --git a/src/doc/feature/animator_creation.dox b/src/doc/feature/animator_creation.dox new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/doc/feature/animator_creation.dox diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp index 07e43a1..9d6b537 100644 --- a/src/example/rendering_particle.cpp +++ b/src/example/rendering_particle.cpp @@ -1,21 +1,16 @@ -#include "api/Animator.h" -#include "api/Camera.h" -#include "api/LoopManager.h" -#include "api/LoopTimer.h" -#include "system/AnimatorSystem.h" -#include "system/ParticleSystem.h" -#include <SDL2/SDL_timer.h> -#include <crepe/ComponentManager.h> - #include <crepe/Component.h> +#include <crepe/api/Animator.h> +#include <crepe/api/Camera.h> #include <crepe/api/Color.h> #include <crepe/api/GameObject.h> +#include <crepe/api/LoopManager.hpp> #include <crepe/api/ParticleEmitter.h> #include <crepe/api/Rigidbody.h> #include <crepe/api/Sprite.h> #include <crepe/api/Texture.h> #include <crepe/api/Transform.h> -#include <crepe/system/RenderSystem.h> +#include <crepe/manager/ComponentManager.h> +#include <crepe/manager/Mediator.h> #include <crepe/types.h> using namespace crepe; @@ -46,7 +41,8 @@ using namespace std; class TestScene : public Scene { public: void load_scene() { - ComponentManager & mgr = this->component_manager; + Mediator & mediator = this->mediator; + ComponentManager & mgr = mediator.component_manager; GameObject game_object = mgr.new_object("", "", vec2{0, 0}, 0, 1); Color color(255, 255, 255, 255); @@ -84,15 +80,5 @@ int main(int argc, char * argv[]) { LoopManager engine; engine.add_scene<TestScene>(); engine.start(); - - /* - game_object - .add_component<Sprite>(make_shared<Texture>("asset/texture/img.png"), color, - .add_component<Sprite>(make_shared<Texture>("asset/texture/img.png"), color, - FlipSettings{false, false}) - .order_in_layer - = 6; - */ - return 0; } |