SDOM - Simple SDL Document Object Model
A lightweight, extensible Document Object Model for SDL-based applications.
|
#include <SDOM_SpriteSheet.hpp>
Classes | |
struct | InitStruct |
Public Member Functions | |
SpriteSheet ()=default | |
virtual | ~SpriteSheet ()=default |
virtual bool | onInit () override |
virtual void | onQuit () override |
virtual void | onLoad () override |
virtual void | onUnload () override |
virtual bool | onUnitTest () override |
Runs unit tests for this object. | |
void | setSpriteWidth (int width) |
void | setSpriteHeight (int height) |
void | setSpriteSize (int width, int height) |
SDL_Texture * | getTexture () const noexcept |
int | getSpriteWidth () const |
int | getSpriteHeight () const |
std::pair< int, int > | getSpriteSize () const |
int | getSpriteCount () const |
int | getSpriteX (int spriteIndex) const |
int | getSpriteY (int spriteIndex) const |
void | drawSprite (int spriteIndex, int x, int y, SDL_Color color={255, 255, 255, 255}, SDL_ScaleMode scaleMode=SDL_SCALEMODE_NEAREST) |
void | drawSprite (int spriteIndex, SDL_FRect &destRect, SDL_Color color={255, 255, 255, 255}, SDL_ScaleMode scaleMode=SDL_SCALEMODE_NEAREST) |
void | drawSprite (int spriteIndex, const SDL_FRect &srcRect, const SDL_FRect &dstRect, SDL_Color color={255, 255, 255, 255}, SDL_ScaleMode scaleMode=SDL_SCALEMODE_NEAREST) |
void | setSpriteWidth_Lua (IAssetObject *obj, int width) |
void | setSpriteHeight_Lua (IAssetObject *obj, int height) |
void | setSpriteSize_Lua (IAssetObject *obj, int width, int height) |
int | getSpriteWidth_Lua (IAssetObject *obj) |
int | getSpriteHeight_Lua (IAssetObject *obj) |
sol::table | getSpriteSize_Lua (IAssetObject *obj, sol::state_view lua) |
int | getSpriteCount_Lua (IAssetObject *obj) |
int | getSpriteX_Lua (IAssetObject *obj, int spriteIndex) |
int | getSpriteY_Lua (IAssetObject *obj, int spriteIndex) |
void | drawSprite_lua (int spriteIndex, int x, int y, SDL_Color color, SDL_ScaleMode scaleMode=SDL_SCALEMODE_NEAREST) |
void | drawSprite_dst_lua (int spriteIndex, SDL_FRect &destRect, SDL_Color color, SDL_ScaleMode scaleMode=SDL_SCALEMODE_NEAREST) |
void | drawSprite_ext_Lua (IAssetObject *obj, int spriteIndex, sol::table srcRect, sol::table dstRect, sol::object color=sol::nil, sol::object scaleMode=sol::nil) |
const std::string & | getType () const |
const std::string & | getName () const |
const std::string & | getFilename () const |
bool | isInternal () const |
bool | isLoaded () const |
void | setType (const std::string &type) |
void | setName (const std::string &name) |
void | setFilename (const std::string &filename) |
template<typename T > | |
T * | as () |
void | registerLuaBindings (const std::string &typeName, sol::state_view lua) |
Static Public Member Functions | |
static std::unique_ptr< IAssetObject > | CreateFromLua (const sol::table &config) |
static std::unique_ptr< IAssetObject > | CreateFromInitStruct (const IAssetObject::InitStruct &baseInit) |
template<typename T > | |
static T | lua_value_case_insensitive (const sol::table &tbl, const std::string &key, const T &default_value) |
Static Public Attributes | |
static constexpr const char * | TypeName = "SpriteSheet" |
Protected Member Functions | |
SpriteSheet (const InitStruct &init) | |
SpriteSheet (const sol::table &config) | |
AssetHandle | getTextureAsset () const |
virtual void | _registerLuaBindings (const std::string &typeName, sol::state_view lua) |
bool | operator== (const SpriteSheet &other) const |
Protected Attributes | |
friend | Factory |
friend | Core |
AssetHandle | textureAsset |
int | spriteWidth_ = 8 |
int | spriteHeight_ = 8 |
std::string | name_ |
std::string | type_ |
std::string | filename_ |
bool | isInternal_ |
bool | isLoaded_ = false |
sol::usertype< IAssetObject > | objHandleType_ |
|
protected |
|
protected |
|
default |
|
virtualdefault |
|
protectedvirtual |
Reimplemented from SDOM::IAssetObject.
|
inlineinherited |
|
inlinestatic |
|
inlinestatic |
void SDOM::SpriteSheet::drawSprite | ( | int | spriteIndex, |
const SDL_FRect & | srcRect, | ||
const SDL_FRect & | dstRect, | ||
SDL_Color | color = {255, 255, 255, 255} , |
||
SDL_ScaleMode | scaleMode = SDL_SCALEMODE_NEAREST |
||
) |
void SDOM::SpriteSheet::drawSprite | ( | int | spriteIndex, |
int | x, | ||
int | y, | ||
SDL_Color | color = {255, 255, 255, 255} , |
||
SDL_ScaleMode | scaleMode = SDL_SCALEMODE_NEAREST |
||
) |
void SDOM::SpriteSheet::drawSprite | ( | int | spriteIndex, |
SDL_FRect & | destRect, | ||
SDL_Color | color = {255, 255, 255, 255} , |
||
SDL_ScaleMode | scaleMode = SDL_SCALEMODE_NEAREST |
||
) |
void SDOM::SpriteSheet::drawSprite_dst_lua | ( | int | spriteIndex, |
SDL_FRect & | destRect, | ||
SDL_Color | color, | ||
SDL_ScaleMode | scaleMode = SDL_SCALEMODE_NEAREST |
||
) |
void SDOM::SpriteSheet::drawSprite_ext_Lua | ( | IAssetObject * | obj, |
int | spriteIndex, | ||
sol::table | srcRect, | ||
sol::table | dstRect, | ||
sol::object | color = sol::nil , |
||
sol::object | scaleMode = sol::nil |
||
) |
void SDOM::SpriteSheet::drawSprite_lua | ( | int | spriteIndex, |
int | x, | ||
int | y, | ||
SDL_Color | color, | ||
SDL_ScaleMode | scaleMode = SDL_SCALEMODE_NEAREST |
||
) |
|
inlineinherited |
|
inlineinherited |
int SDOM::SpriteSheet::getSpriteCount | ( | ) | const |
int SDOM::SpriteSheet::getSpriteCount_Lua | ( | IAssetObject * | obj | ) |
int SDOM::SpriteSheet::getSpriteHeight | ( | ) | const |
int SDOM::SpriteSheet::getSpriteHeight_Lua | ( | IAssetObject * | obj | ) |
std::pair< int, int > SDOM::SpriteSheet::getSpriteSize | ( | ) | const |
sol::table SDOM::SpriteSheet::getSpriteSize_Lua | ( | IAssetObject * | obj, |
sol::state_view | lua | ||
) |
int SDOM::SpriteSheet::getSpriteWidth | ( | ) | const |
int SDOM::SpriteSheet::getSpriteWidth_Lua | ( | IAssetObject * | obj | ) |
int SDOM::SpriteSheet::getSpriteX | ( | int | spriteIndex | ) | const |
int SDOM::SpriteSheet::getSpriteX_Lua | ( | IAssetObject * | obj, |
int | spriteIndex | ||
) |
int SDOM::SpriteSheet::getSpriteY | ( | int | spriteIndex | ) | const |
int SDOM::SpriteSheet::getSpriteY_Lua | ( | IAssetObject * | obj, |
int | spriteIndex | ||
) |
|
inlinenoexcept |
|
inlineprotected |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
overridevirtual |
Implements SDOM::IAssetObject.
|
overridevirtual |
Implements SDOM::IAssetObject.
|
overridevirtual |
Implements SDOM::IAssetObject.
|
overridevirtual |
Runs unit tests for this object.
Reimplemented from SDOM::IAssetObject.
|
overridevirtual |
Implements SDOM::IAssetObject.
|
protected |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
void SDOM::SpriteSheet::setSpriteHeight | ( | int | height | ) |
void SDOM::SpriteSheet::setSpriteHeight_Lua | ( | IAssetObject * | obj, |
int | height | ||
) |
void SDOM::SpriteSheet::setSpriteSize | ( | int | width, |
int | height | ||
) |
void SDOM::SpriteSheet::setSpriteSize_Lua | ( | IAssetObject * | obj, |
int | width, | ||
int | height | ||
) |
void SDOM::SpriteSheet::setSpriteWidth | ( | int | width | ) |
void SDOM::SpriteSheet::setSpriteWidth_Lua | ( | IAssetObject * | obj, |
int | width | ||
) |
|
inlineinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
staticconstexpr |