27#include "guillaume/ecs/component.hpp"
69 std::string _texturePath {};
70 std::string _fallbackPath {};
72 bool _usingFallback {
false };
Image(void)=default
Default constructor for the Image component.
Image & setTexturePath(const std::string &path)
Choose the texture to draw.
LoadState
Whether the texture could be loaded, as recorded by systems::ImageRender.
@ Pending
Not attempted since the path was set.
@ Loaded
The texture (or the fallback) is drawn.
@ Failed
Neither loaded; nothing is drawn.
~Image(void)=default
Default destructor for the Image component.
Image & setLoadState(LoadState state, bool usingFallback=false)
Record the outcome of a load attempt. Called by systems::ImageRender.
Image & setFallbackPath(const std::string &path)
Set the texture drawn when the main texture fails to load.
LoadState getLoadState(void) const
Get the outcome of the last load attempt.
const std::string & getTexturePath(void) const
Get the path of the texture to draw.
bool isUsingFallback(void) const
Check whether the fallback texture is drawn.
const std::string & getFallbackPath(void) const
Get the path of the fallback texture.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
State. Every class here is plain data attached to an entity.