Resource responsible for resizing a texture using the 9-slice technique, for use in UI elements.
More...
|
| NineSlicePanel (std::shared_ptr< ToyMaker::Texture > baseTexture, SDL_FRect contentRegionUV) |
| Constructs a new NineSlicePanel aspect.
|
|
| ~NineSlicePanel () |
| Destroys the NineSlicePanel object.
|
|
std::shared_ptr< ToyMaker::Texture > | generateTexture (glm::uvec2 contentDimensions) const |
| Generates a new texture based on this panel resource, where the dimensions of the central region of the resource is specified by the caller.
|
|
uint32_t | getOffsetPixelLeft () const |
| Gets the width, in pixels, of the panel slices on the left hand side of this resource's base texture.
|
|
uint32_t | getOffsetPixelRight () const |
| Gets the width, in pixels, of the panel slices on the right hand side of this resource's base texture.
|
|
uint32_t | getOffsetPixelBottom () const |
| Gets the height, in pixels, of the panel slices on the bottom side of this resource's base texture.
|
|
uint32_t | getOffsetPixelTop () const |
| Gets the height, in pixels, of the panel slices on the top side of this resource's base texture.
|
|
std::string | getResourceTypeName_ () const override |
| Get the resource type string for this resource.
|
|
virtual | ~IResource ()=default |
| Destroy the IResource object.
|
|
|
std::shared_ptr< ToyMaker::Texture > | mTexture {} |
| The base texture used to generate new textures.
|
|
SDL_FRect | mContentRegion { .x{0.f}, .y{0.f}, .w{1.f}, .h{1.f} } |
| The central region of the texture, resized to fit any content placed within a panel generated from this resource.
|
|
std::shared_ptr< ToyMaker::ShaderProgram > | mShaderHandle { nullptr } |
| The shader responsible for producing panell textures from a base texture.
|
|
GLuint | mVertexArrayObject {} |
| The vertex array object used by this resource's panel shader.
|
|
Resource responsible for resizing a texture using the 9-slice technique, for use in UI elements.
The base texture provided to this panel is divided into 9 regions
- The 4 regions at the corners of the texture are locked, and are not resized along with the panel.
- The regions of the top and bottom edges can be stretched or tiled horizontally. Similarly, the left and right edge regions can be extended vertically.
- The region in the center can be resized arbitrarily along both axes along with the panel.
To facilitate this, this aspect computes a new albedo texture and static mesh for the StaticModel component of its SimObject whenever it receives a resize request.