diff options
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/api/Animator.cpp | 2 | ||||
-rw-r--r-- | src/crepe/api/Scene.h | 2 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 3 | ||||
-rw-r--r-- | src/crepe/manager/SystemManager.cpp | 14 | ||||
-rw-r--r-- | src/crepe/manager/SystemManager.h | 8 | ||||
-rw-r--r-- | src/crepe/manager/SystemManager.hpp | 1 |
6 files changed, 21 insertions, 9 deletions
diff --git a/src/crepe/api/Animator.cpp b/src/crepe/api/Animator.cpp index 203cef3..b7eefb8 100644 --- a/src/crepe/api/Animator.cpp +++ b/src/crepe/api/Animator.cpp @@ -52,6 +52,6 @@ void Animator::set_anim(int col) { void Animator::next_anim() { Animator::Data & ctx = this->data; - ctx.row = ctx.row++ % this->grid_size.x; + ctx.row = ++ctx.row % this->grid_size.x; this->spritesheet.mask.x = ctx.row * this->spritesheet.mask.w; } diff --git a/src/crepe/api/Scene.h b/src/crepe/api/Scene.h index dcca9d4..d552a43 100644 --- a/src/crepe/api/Scene.h +++ b/src/crepe/api/Scene.h @@ -60,7 +60,7 @@ private: OptionalRef<Mediator> mediator; //! \} -protected: +public: /** * \brief Retrieve the reference to the SaveManager instance * diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 536ea43..64c1fe2 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -1,5 +1,6 @@ #include <SDL2/SDL.h> #include <SDL2/SDL_blendmode.h> +#include <SDL2/SDL_hints.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_keycode.h> #include <SDL2/SDL_pixels.h> @@ -67,6 +68,8 @@ SDLContext::SDLContext(Mediator & mediator) { throw runtime_error(format("SDL_ttf initialization failed: {}", TTF_GetError())); } + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); + mediator.sdl_context = *this; } diff --git a/src/crepe/manager/SystemManager.cpp b/src/crepe/manager/SystemManager.cpp index 5ada30f..eabc022 100644 --- a/src/crepe/manager/SystemManager.cpp +++ b/src/crepe/manager/SystemManager.cpp @@ -19,12 +19,12 @@ SystemManager::SystemManager(Mediator & mediator) : Manager(mediator) { this->load_system<InputSystem>(); this->load_system<EventSystem>(); this->load_system<ScriptSystem>(); + this->load_system<ParticleSystem>(); this->load_system<AISystem>(); this->load_system<PhysicsSystem>(); this->load_system<CollisionSystem>(); this->load_system<AudioSystem>(); this->load_system<AnimatorSystem>(); - this->load_system<ParticleSystem>(); this->load_system<RenderSystem>(); this->load_system<ReplaySystem>(); @@ -32,16 +32,16 @@ SystemManager::SystemManager(Mediator & mediator) : Manager(mediator) { } void SystemManager::fixed_update() { - for (auto & [type, system] : this->systems) { - if (!system->active) continue; - system->fixed_update(); + for (System & system : this->system_order) { + if (!system.active) continue; + system.fixed_update(); } } void SystemManager::frame_update() { - for (auto & [type, system] : this->systems) { - if (!system->active) continue; - system->frame_update(); + for (System & system : this->system_order) { + if (!system.active) continue; + system.frame_update(); } } diff --git a/src/crepe/manager/SystemManager.h b/src/crepe/manager/SystemManager.h index 50acf77..614d90c 100644 --- a/src/crepe/manager/SystemManager.h +++ b/src/crepe/manager/SystemManager.h @@ -3,6 +3,7 @@ #include <memory> #include <typeindex> #include <unordered_map> +#include <vector> #include "../system/System.h" @@ -43,6 +44,13 @@ private: */ std::unordered_map<std::type_index, std::unique_ptr<System>> systems; /** + * \brief Collection of System instances + * + * This map holds System instances indexed by the system's class typeid. It is filled in the + * constructor of \c SystemManager using SystemManager::load_system. + */ + std::vector<std::reference_wrapper<System>> system_order; + /** * \brief Initialize a system * \tparam T System type (must be derivative of \c System) */ diff --git a/src/crepe/manager/SystemManager.hpp b/src/crepe/manager/SystemManager.hpp index 3d26e4c..8d06eb1 100644 --- a/src/crepe/manager/SystemManager.hpp +++ b/src/crepe/manager/SystemManager.hpp @@ -36,6 +36,7 @@ void SystemManager::load_system() { throw runtime_error(format("SystemManager: {} is already initialized", type.name())); System * system = new T(this->mediator); this->systems[type] = unique_ptr<System>(system); + this->system_order.push_back(*this->systems[type]); } } // namespace crepe |