![]() |
Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
|


Public Member Functions | |
| void | clear (void) |
| Reinitialize Texture Resets texture content, size and color. More... | |
| bool | loadFromSurface (CST_Surface *surface) |
| Loads the texture from a surface Returns true if successful. More... | |
| bool | loadFromCache (std::string &key) |
| Loads the texture from caches Returns true if successful. More... | |
| bool | loadFromSurfaceSaveToCache (std::string &key, CST_Surface *surface) |
| Loads the texture from a surface and saves the results in caches Returns true if successful. More... | |
| void | render (Element *parent) |
| Renders the texture. More... | |
| void | resize (int w, int h) |
| Resizes the texture. More... | |
| void | setScaleMode (TextureScaleMode mode) |
| Sets texture scaling mode. More... | |
| void | getTextureSize (int *w, int *h) |
| Return texture's original size. More... | |
| Texture * | setSize (int w, int h) |
| bool | saveTo (std::string &path) |
| save this texture to the given file path as a PNG More... | |
| void | loadPath (std::string &path, bool forceReload=false) |
| update and load or reload the texture More... | |
Public Member Functions inherited from Chesto::Element | |
| virtual bool | process (InputEvents *event) |
| process any input that is received for this element More... | |
| virtual void | render (Element *parent) |
| display the current state of the display More... | |
| bool | onTouchDown (InputEvents *event) |
| bool | onTouchDrag (InputEvents *event) |
| bool | onTouchUp (InputEvents *event) |
| void | hide () |
| void | unhide () |
| void | renderBackground (bool fill=true) |
| void | addNode (std::unique_ptr< Element > node) |
| void | remove (Element *element) |
| void | removeAll () |
| void | position (int x, int y) |
| position the element More... | |
| void | recalcPosition (Element *parent) |
| float | getEffectiveScale () const |
| CST_Rect | getBounds () |
| CST_Renderer * | getRenderer () |
| Element * | setPosition (int x, int y) |
| Element * | setAction (std::function< void()> func) |
| Element * | setAbsolute (bool isAbs) |
| template<typename T , typename... Args> | |
| T * | createNode (Args &&... args) |
| Element * | constrain (int flags, int padding=0) |
| Element * | constrainToTarget (Element *target, int flags, int padding=0) |
| Element * | animate (int durationIn, std::function< void(float)> onStep, std::function< void()> onFinish) |
| Element * | moveToFront () |
| Element * | setTouchable (bool touchable) |
| void | screenshot (std::string path) |
| Take a screenshot of this element and its children, and save it to the given path. More... | |
Static Public Member Functions | |
| static void | wipeEntireCache () |
| Wipes the entire texture cache (generally, should only be used to reload entire theme / text) More... | |
| static void | wipeTextCache () |
| Similar to wipeEntireCache, but only wipes cached text textures (made by TextElement) More... | |
Public Attributes | |
| int | cornerRadius = 0 |
| Rounded corner radius (if >0, will round) More... | |
| SDL_BlendMode | blendMode = SDL_BLENDMODE_BLEND |
| Blend mode to use for this texture. More... | |
Public Attributes inherited from Chesto::Element | |
| std::function< void()> | action = NULL |
| the action to call (from binded callback) on touch or button selection https://stackoverflow.com/questions/14189440/c-class-member-callback-simple-examples More... | |
| std::function< void(InputEvents *event)> | actionWithEvents = NULL |
| std::vector< std::unique_ptr< Element, std::function< void(Element *)> > > | elements |
| visible GUI child elements of this element More... | |
| float | scale = 1.0f |
| bool | touchable = false |
| whether or not this element can be touched (highlights bounds) More... | |
| bool | dragging = false |
| whether or not this element is currently being dragged More... | |
| bool | needsRedraw = false |
| whether or not this element needs the screen redrawn next time it's processed More... | |
| int | futureRedrawCounter = 0 |
| whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws) More... | |
| int | lastMouseY = 0 |
| the last Y, X coordinate of the mouse (from a drag probably) More... | |
| int | lastMouseX = 0 |
| bool | hasBackground = false |
| rgb | backgroundColor = {0, 0, 0} |
| int | backgroundOpacity = 0xff |
| bool | isAbsolute = false |
| Element * | parent = nullptr |
| the parent element (reference only, not owned) More... | |
| bool | hidden = false |
| whether this element should skip rendering or not More... | |
| bool | isProtected = false |
| int | elasticCounter = 0 |
| how much time is left in an elastic-type flick/scroll set by the last distance traveled in a scroll, and counts down every frame More... | |
| int | width = 0 |
| width and height of this element (must be manually set, isn't usually calculated (but is in some cases, like text or images)) More... | |
| int | height = 0 |
| int | x = 0 |
| int | y = 0 |
| int | xAbs = 0 |
| int | yAbs = 0 |
| double | angle = 0 |
| rotation angle in degrees More... | |
| int | cornerRadius = 0 |
| int | tag = 0 |
| std::vector< std::unique_ptr< Constraint > > | constraints |
| std::vector< std::unique_ptr< Animation > > | animations |
| bool | useColorMask = false |
| whether or not to overlay a color mask on top of this element More... | |
| CST_Color | maskColor = {0,0,0,0} |
| The color to overlay on top. More... | |
Static Public Attributes | |
| static const std::string | textElemPrefix = "(TextElement):" |
Protected Attributes | |
| CST_Texture * | mTexture = nullptr |
| The actual texture. More... | |
| int | texW = 0 |
| The size of the texture. More... | |
| int | texH = 0 |
| CST_Color | texFirstPixel = {0,0,0,0} |
| The color of the first pixel. More... | |
| TextureScaleMode | texScaleMode = SCALE_STRETCH |
| Texture's scaling mode. More... | |
Static Protected Attributes | |
| static std::unordered_map< std::string, TextureData > | texCache |
| Cache previously displayed textures. More... | |
Additional Inherited Members | |
Public Types inherited from Chesto::Element | |
| typedef Element | super |
Protected Member Functions inherited from Chesto::Element | |
| void | addStackMember (Element *element) |
Definition at line 28 of file Texture.hpp.
|
virtual |
Definition at line 9 of file Texture.cpp.
| void Chesto::Texture::clear | ( | void | ) |
Reinitialize Texture Resets texture content, size and color.
Definition at line 13 of file Texture.cpp.
References mTexture, texFirstPixel, and texW.
Referenced by Chesto::TextElement::update().
| void Chesto::Texture::getTextureSize | ( | int * | w, |
| int * | h | ||
| ) |
Return texture's original size.
Definition at line 230 of file Texture.cpp.
References texW.
Referenced by Chesto::TextElement::update().
| bool Chesto::Texture::loadFromCache | ( | std::string & | key | ) |
Loads the texture from caches Returns true if successful.
Definition at line 81 of file Texture.cpp.
References mTexture, texCache, texFirstPixel, and texW.
Referenced by loadPath(), Chesto::NetImageElement::NetImageElement(), and Chesto::TextElement::update().
| bool Chesto::Texture::loadFromSurface | ( | CST_Surface * | surface | ) |
Loads the texture from a surface Returns true if successful.
Definition at line 54 of file Texture.cpp.
References blendMode, mTexture, texFirstPixel, and texW.
Referenced by loadFromSurfaceSaveToCache().
| bool Chesto::Texture::loadFromSurfaceSaveToCache | ( | std::string & | key, |
| CST_Surface * | surface | ||
| ) |
Loads the texture from a surface and saves the results in caches Returns true if successful.
Definition at line 96 of file Texture.cpp.
References loadFromSurface(), mTexture, texCache, and texFirstPixel.
Referenced by loadPath(), and Chesto::TextElement::update().
| void Chesto::Texture::loadPath | ( | std::string & | path, |
| bool | forceReload = false |
||
| ) |
update and load or reload the texture
Definition at line 262 of file Texture.cpp.
References loadFromCache(), loadFromSurfaceSaveToCache(), texW, and Chesto::Element::width.
Referenced by Chesto::ImageElement::ImageElement().
|
virtual |
Renders the texture.
Reimplemented from Chesto::Element.
Definition at line 131 of file Texture.cpp.
References Chesto::Element::angle, cornerRadius, Chesto::Element::hidden, Chesto::Element::maskColor, mTexture, Chesto::Element::parent, Chesto::Element::render(), texFirstPixel, texScaleMode, texW, Chesto::Element::useColorMask, and Chesto::Element::width.
Referenced by Chesto::NetImageElement::render().
| void Chesto::Texture::resize | ( | int | w, |
| int | h | ||
| ) |
| bool Chesto::Texture::saveTo | ( | std::string & | path | ) |
save this texture to the given file path as a PNG
Definition at line 238 of file Texture.cpp.
| void Chesto::Texture::setScaleMode | ( | TextureScaleMode | mode | ) |
| Texture * Chesto::Texture::setSize | ( | int | w, |
| int | h | ||
| ) |
Definition at line 219 of file Texture.cpp.
|
static |
Wipes the entire texture cache (generally, should only be used to reload entire theme / text)
Definition at line 113 of file Texture.cpp.
References texCache.
|
static |
Similar to wipeEntireCache, but only wipes cached text textures (made by TextElement)
Definition at line 118 of file Texture.cpp.
References texCache.
| SDL_BlendMode Chesto::Texture::blendMode = SDL_BLENDMODE_BLEND |
Blend mode to use for this texture.
Definition at line 74 of file Texture.hpp.
Referenced by loadFromSurface().
| int Chesto::Texture::cornerRadius = 0 |
Rounded corner radius (if >0, will round)
Definition at line 71 of file Texture.hpp.
Referenced by render().
|
protected |
The actual texture.
Definition at line 90 of file Texture.hpp.
Referenced by clear(), loadFromCache(), loadFromSurface(), loadFromSurfaceSaveToCache(), render(), Chesto::NetImageElement::render(), and saveTo().
|
staticprotected |
Cache previously displayed textures.
Definition at line 87 of file Texture.hpp.
Referenced by loadFromCache(), loadFromSurfaceSaveToCache(), wipeEntireCache(), and wipeTextCache().
|
protected |
The color of the first pixel.
Definition at line 96 of file Texture.hpp.
Referenced by clear(), loadFromCache(), loadFromSurface(), loadFromSurfaceSaveToCache(), and render().
|
protected |
Definition at line 93 of file Texture.hpp.
|
protected |
Texture's scaling mode.
Definition at line 99 of file Texture.hpp.
Referenced by render(), and setScaleMode().
|
static |
Definition at line 77 of file Texture.hpp.
|
protected |
The size of the texture.
Definition at line 93 of file Texture.hpp.
Referenced by clear(), getTextureSize(), loadFromCache(), loadFromSurface(), loadPath(), Chesto::NetImageElement::NetImageElement(), render(), and saveTo().