diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-23 22:26:05 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-23 22:26:05 +0200 |
commit | 95171100beba7bc36ae4421652f6c4fbb34774a8 (patch) | |
tree | b00be299c17415ed1101ccb6c2a34f5cdb76655a /src/crepe | |
parent | 6e2c5e1b57210b10f8781f103e5c46308544339f (diff) |
rename SdlContext -> SDLContext
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/crepe/RenderSystem.cpp | 4 | ||||
-rw-r--r-- | src/crepe/SDLContext.cpp (renamed from src/crepe/SdlContext.cpp) | 22 | ||||
-rw-r--r-- | src/crepe/SDLContext.h (renamed from src/crepe/SdlContext.h) | 16 | ||||
-rw-r--r-- | src/crepe/api/Texture.cpp | 4 | ||||
-rw-r--r-- | src/crepe/api/Texture.h | 4 |
6 files changed, 28 insertions, 28 deletions
diff --git a/src/crepe/CMakeLists.txt b/src/crepe/CMakeLists.txt index fcd169c..d938eb8 100644 --- a/src/crepe/CMakeLists.txt +++ b/src/crepe/CMakeLists.txt @@ -11,7 +11,7 @@ target_sources(crepe PUBLIC PhysicsSystem.cpp CollisionSystem.cpp Collider.cpp - SdlContext.cpp + SDLContext.cpp RenderSystem.cpp ) @@ -20,7 +20,7 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES Asset.h Sound.h SoundContext.h - SdlContext.h + SDLContext.h ComponentManager.h ComponentManager.hpp Component.h @@ -29,7 +29,7 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES PhysicsSystem.h CollisionSystem.h Collider.h - SdlContext.h + SDLContext.h RenderSystem.h ) diff --git a/src/crepe/RenderSystem.cpp b/src/crepe/RenderSystem.cpp index 1139359..fae93f0 100644 --- a/src/crepe/RenderSystem.cpp +++ b/src/crepe/RenderSystem.cpp @@ -7,7 +7,7 @@ #include "ComponentManager.h" #include "RenderSystem.h" -#include "SdlContext.h" +#include "SDLContext.h" using namespace crepe; using namespace crepe::api; @@ -28,7 +28,7 @@ void RenderSystem::update() { std::vector<std::reference_wrapper<Sprite>> sprites = mgr.get_components_by_type<Sprite>(); - SdlContext & render = SdlContext::get_instance(); + SDLContext & render = SDLContext::get_instance(); render.clear_screen(); for (const Sprite & sprite : sprites) { diff --git a/src/crepe/SdlContext.cpp b/src/crepe/SDLContext.cpp index 2b49283..5a93679 100644 --- a/src/crepe/SdlContext.cpp +++ b/src/crepe/SDLContext.cpp @@ -12,16 +12,16 @@ #include "api/Transform.h" #include "util/log.h" -#include "SdlContext.h" +#include "SDLContext.h" using namespace crepe; -SdlContext & SdlContext::get_instance() { - static SdlContext instance; +SDLContext & SDLContext::get_instance() { + static SDLContext instance; return instance; } -void SdlContext::handle_events(bool & running) { +void SDLContext::handle_events(bool & running) { SDL_Event event; while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { @@ -30,7 +30,7 @@ void SdlContext::handle_events(bool & running) { } } -SdlContext::~SdlContext() { +SDLContext::~SDLContext() { dbg_trace(); if (this->game_renderer != nullptr) @@ -44,9 +44,9 @@ SdlContext::~SdlContext() { SDL_Quit(); } -void SdlContext::clear_screen() { SDL_RenderClear(this->game_renderer); } +void SDLContext::clear_screen() { SDL_RenderClear(this->game_renderer); } -SdlContext::SdlContext() { +SDLContext::SDLContext() { dbg_trace(); if (SDL_Init(SDL_INIT_VIDEO) < 0) { @@ -79,9 +79,9 @@ SdlContext::SdlContext() { } } -void SdlContext::present_screen() { SDL_RenderPresent(this->game_renderer); } +void SDLContext::present_screen() { SDL_RenderPresent(this->game_renderer); } -void SdlContext::draw(const api::Sprite & sprite, +void SDLContext::draw(const api::Sprite & sprite, const api::Transform & transform) { static SDL_RendererFlip render_flip @@ -104,7 +104,7 @@ void SdlContext::draw(const api::Sprite & sprite, } /* -SDL_Texture * SdlContext::setTextureFromPath(const char * path, SDL_Rect & clip, +SDL_Texture * SDLContext::setTextureFromPath(const char * path, SDL_Rect & clip, const int row, const int col) { dbg_trace(); @@ -130,7 +130,7 @@ SDL_Texture * SdlContext::setTextureFromPath(const char * path, SDL_Rect & clip, } */ -SDL_Texture * SdlContext::texture_from_path(const char * path) { +SDL_Texture * SDLContext::texture_from_path(const char * path) { dbg_trace(); SDL_Surface * tmp = IMG_Load(path); diff --git a/src/crepe/SdlContext.h b/src/crepe/SDLContext.h index 31ba3a6..4d9c1bc 100644 --- a/src/crepe/SdlContext.h +++ b/src/crepe/SDLContext.h @@ -14,15 +14,15 @@ class Texture; namespace crepe { -class SdlContext { +class SDLContext { public: // singleton - static SdlContext & get_instance(); - SdlContext(const SdlContext &) = delete; - SdlContext(SdlContext &&) = delete; - SdlContext & operator=(const SdlContext &) = delete; - SdlContext & operator=(SdlContext &&) = delete; + static SDLContext & get_instance(); + SDLContext(const SDLContext &) = delete; + SDLContext(SDLContext &&) = delete; + SDLContext & operator=(const SDLContext &) = delete; + SDLContext & operator=(SDLContext &&) = delete; //TODO decide events wouter? @@ -30,8 +30,8 @@ private: void handle_events(bool & running); private: - SdlContext(); - virtual ~SdlContext(); + SDLContext(); + virtual ~SDLContext(); private: friend class api::Texture; diff --git a/src/crepe/api/Texture.cpp b/src/crepe/api/Texture.cpp index 7791b5b..481ef7c 100644 --- a/src/crepe/api/Texture.cpp +++ b/src/crepe/api/Texture.cpp @@ -3,7 +3,7 @@ #include "util/log.h" #include "Asset.h" -#include "SdlContext.h" +#include "SDLContext.h" #include "Texture.h" using namespace crepe::api; @@ -27,6 +27,6 @@ Texture::~Texture() { } void Texture::load(unique_ptr<Asset> res) { - SdlContext & ctx = SdlContext::get_instance(); + SDLContext & ctx = SDLContext::get_instance(); this->texture = ctx.texture_from_path(res->canonical()); } diff --git a/src/crepe/api/Texture.h b/src/crepe/api/Texture.h index 993f72b..7a2c755 100644 --- a/src/crepe/api/Texture.h +++ b/src/crepe/api/Texture.h @@ -6,7 +6,7 @@ #include "Asset.h" namespace crepe { -class SdlContext; +class SDLContext; } namespace crepe::api { @@ -24,7 +24,7 @@ private: private: SDL_Texture * texture = nullptr; - friend class crepe::SdlContext; + friend class crepe::SDLContext; }; } // namespace crepe::api |