Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
SpriteCustomizer.hpp
Go to the documentation of this file.
1
8#ifndef RTYPE_CLIENT_GAME_SPRITECUSTOMIZER_HPP_
9 #define RTYPE_CLIENT_GAME_SPRITECUSTOMIZER_HPP_
10
11 #include <string>
12 #include <unordered_map>
13 #include <filesystem>
15
16namespace rtp::client {
17
26 public:
32
37 bool loadMappings();
38
43 void reloadMappings();
44
50 bool hasCustomSprite(const std::string& entityName) const;
51
57 static void clearTextureCaches();
58
65 static void setRenderSystems(void* worldRenderSystem, void* uiRenderSystem);
66
73 std::string getSpritePath(const std::string& entityName, const std::string& defaultPath) const;
74
85 std::string getSpriteInfo(const std::string& entityName,
86 const std::string& defaultPath,
87 int& outLeft, int& outTop,
88 int& outWidth, int& outHeight) const;
89
90 private:
92 ~SpriteCustomizer() = default;
93
94 // Delete copy/move constructors and assignment operators
99
100 std::filesystem::path _spriteMappingPath;
101 std::unordered_map<std::string, std::string> _customSpriteMappings;
102 };
103
104} // namespace rtp::client
105
106#endif // RTYPE_CLIENT_GAME_SPRITECUSTOMIZER_HPP_
Singleton class to manage custom sprite mappings globally.
SpriteCustomizer & operator=(const SpriteCustomizer &)=delete
std::filesystem::path _spriteMappingPath
static void clearTextureCaches()
Clear all texture caches in render systems This should be called when sprites are modified to ensure ...
SpriteCustomizer(const SpriteCustomizer &)=delete
void reloadMappings()
Reload sprite mappings (useful after modifications) This clears the cache and reloads from disk.
bool loadMappings()
Load sprite mappings from config file.
std::unordered_map< std::string, std::string > _customSpriteMappings
static void setRenderSystems(void *worldRenderSystem, void *uiRenderSystem)
Set render system pointers for cache clearing Called internally by Application during initialization.
SpriteCustomizer(SpriteCustomizer &&)=delete
std::string getSpriteInfo(const std::string &entityName, const std::string &defaultPath, int &outLeft, int &outTop, int &outWidth, int &outHeight) const
Get custom sprite info (path and coordinates for full sprite)
bool hasCustomSprite(const std::string &entityName) const
Check if an entity has a custom sprite.
std::string getSpritePath(const std::string &entityName, const std::string &defaultPath) const
Get the custom sprite path for an entity.
SpriteCustomizer & operator=(SpriteCustomizer &&)=delete
static SpriteCustomizer & getInstance()
Get the singleton instance.
R-Type client namespace.