Resource responsible for resizing a texture using the 9-slice technique, for use in UI elements.
More...
#include <nine_slice_panel.hpp>
|
| enum | ScaleMode : uint8_t { STRETCH
, TILE
} |
| | The type of texture sampling to be used on the resizable regions of the base texture.
|
| |
|
| | 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.
|
| |
|
| static std::string | getResourceTypeName () |
| | Gets the resource type string associated with this class.
|
| |
|
|
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.
◆ NineSlicePanel()
| NineSlicePanel::NineSlicePanel |
( |
std::shared_ptr< ToyMaker::Texture > | baseTexture, |
|
|
SDL_FRect | contentRegionUV ) |
Constructs a new NineSlicePanel aspect.
- Parameters
-
| baseTexture | The texture to use as the basis for the panel produced by this aspect. |
| contentRegionUV | The rectangle, in UV coordinates, of the central region of the rectangle, determining the way the base texture is sliced. |
◆ generateTexture()
| std::shared_ptr< ToyMaker::Texture > NineSlicePanel::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.
- Parameters
-
| contentDimensions | The dimensions of the central region of the resource, where content should be placed. |
- Returns
- std::shared_ptr<ToyMaker::Texture> The texture produced.
◆ getOffsetPixelBottom()
| uint32_t NineSlicePanel::getOffsetPixelBottom |
( |
| ) |
const |
Gets the height, in pixels, of the panel slices on the bottom side of this resource's base texture.
- Returns
- uint32_t The height, in pixels, of the bottom side panel texture slices.
◆ getOffsetPixelLeft()
| uint32_t NineSlicePanel::getOffsetPixelLeft |
( |
| ) |
const |
Gets the width, in pixels, of the panel slices on the left hand side of this resource's base texture.
- Returns
- uint32_t The width, in pixels, of left hand side panel texture slices.
◆ getOffsetPixelRight()
| uint32_t NineSlicePanel::getOffsetPixelRight |
( |
| ) |
const |
Gets the width, in pixels, of the panel slices on the right hand side of this resource's base texture.
- Returns
- uint32_t The width, in pixels, of the right hand side panel texture slices.
◆ getOffsetPixelTop()
| uint32_t NineSlicePanel::getOffsetPixelTop |
( |
| ) |
const |
Gets the height, in pixels, of the panel slices on the top side of this resource's base texture.
- Returns
- uint32_t The height, in pixels, of the top side panel texture slices.
◆ getResourceTypeName()
| static std::string ToyMaker::NineSlicePanel::getResourceTypeName |
( |
| ) |
|
|
inlinestatic |
Gets the resource type string associated with this class.
- Returns
- std::string This class' resource type string.
The documentation for this class was generated from the following files:
- ToyMaker_Builtins/include/toymaker/builtins/nine_slice_panel.hpp
- ToyMaker_Builtins/src/nine_slice_panel.cpp