diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 19:22:24 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 19:22:24 +0100 |
commit | 1d303f3a506dc7b6f68edb4af0a2043c4c53ab1e (patch) | |
tree | 6881feac4996da15834e85fb56ea3f9d84285189 /src/crepe/system | |
parent | 37f352c20cdf3c972ad99b076bb091f698132312 (diff) | |
parent | 30c17c98e54c1534664de08ca3838c40c859d166 (diff) |
mege with master
Diffstat (limited to 'src/crepe/system')
-rw-r--r-- | src/crepe/system/AISystem.cpp | 1 | ||||
-rw-r--r-- | src/crepe/system/AnimatorSystem.cpp | 2 | ||||
-rw-r--r-- | src/crepe/system/InputSystem.cpp | 5 | ||||
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 9 |
4 files changed, 15 insertions, 2 deletions
diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp index ed22203..d231c7c 100644 --- a/src/crepe/system/AISystem.cpp +++ b/src/crepe/system/AISystem.cpp @@ -13,6 +13,7 @@ using namespace std::chrono; void AISystem::update() { const Mediator & mediator = this->mediator; ComponentManager & mgr = mediator.component_manager; + LoopTimerManager & timer = mediator.loop_timer; RefVector<AI> ai_components = mgr.get_components_by_type<AI>(); LoopTimerManager & loop_timer = mediator.loop_timer; diff --git a/src/crepe/system/AnimatorSystem.cpp b/src/crepe/system/AnimatorSystem.cpp index 690b45b..31eb85c 100644 --- a/src/crepe/system/AnimatorSystem.cpp +++ b/src/crepe/system/AnimatorSystem.cpp @@ -23,7 +23,7 @@ void AnimatorSystem::update() { int last_frame = ctx.row; - int cycle_end = (ctx.cycle_end == -1) ? a.max_rows : ctx.cycle_end; + int cycle_end = (ctx.cycle_end == -1) ? a.grid_size.x : ctx.cycle_end; int total_frames = cycle_end - ctx.cycle_start; int curr_frame = static_cast<int>(elapsed_time / frame_duration) % total_frames; diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index aaa8bdf..a710ae2 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -1,6 +1,8 @@ #include "../api/Button.h" #include "../manager/ComponentManager.h" #include "../manager/EventManager.h" +#include "facade/SDLContext.h" +#include "util/Log.h" #include "InputSystem.h" @@ -9,7 +11,8 @@ using namespace crepe; void InputSystem::update() { ComponentManager & mgr = this->mediator.component_manager; EventManager & event_mgr = this->mediator.event_manager; - std::vector<SDLContext::EventData> event_list = SDLContext::get_instance().get_events(); + SDLContext & context = this->mediator.sdl_context; + std::vector<SDLContext::EventData> event_list = context.get_events(); RefVector<Button> buttons = mgr.get_components_by_type<Button>(); RefVector<Camera> cameras = mgr.get_components_by_type<Camera>(); OptionalRef<Camera> curr_cam_ref; diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index 26f2c85..51340fb 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -10,7 +10,9 @@ #include "../api/Sprite.h" #include "../api/Transform.h" #include "../facade/SDLContext.h" +#include "../facade/Texture.h" #include "../manager/ComponentManager.h" +#include "../manager/ResourceManager.h" #include "RenderSystem.h" @@ -72,6 +74,8 @@ bool RenderSystem::render_particle(const Sprite & sprite, const SDLContext::Came ComponentManager & mgr = this->mediator.component_manager; SDLContext & ctx = this->mediator.sdl_context; + ResourceManager & resource_manager = this->mediator.resource_manager; + Texture & res = resource_manager.get<Texture>(sprite.source); vector<reference_wrapper<ParticleEmitter>> emitters = mgr.get_components_by_id<ParticleEmitter>(sprite.game_object_id); @@ -88,6 +92,7 @@ bool RenderSystem::render_particle(const Sprite & sprite, const SDLContext::Came ctx.draw(SDLContext::RenderContext{ .sprite = sprite, + .texture = res, .cam = cam, .pos = p.position, .angle = p.angle, @@ -100,8 +105,12 @@ bool RenderSystem::render_particle(const Sprite & sprite, const SDLContext::Came void RenderSystem::render_normal(const Sprite & sprite, const SDLContext::CameraValues & cam, const Transform & tm) { SDLContext & ctx = this->mediator.sdl_context; + ResourceManager & resource_manager = this->mediator.resource_manager; + const Texture & res = resource_manager.get<Texture>(sprite.source); + ctx.draw(SDLContext::RenderContext{ .sprite = sprite, + .texture = res, .cam = cam, .pos = tm.position, .angle = tm.rotation, |