Component to render an image to the screen.
More...
#include <TextureComponent.hpp>
|
| void | CreateTexture (std::string filepath) |
| |
| void | SelectSourceRect (float x, float y, float w, float h) |
| |
|
void | ClearSourceRect () |
| | Selects the entire texture to render to the screen.
|
| |
| void | Input () override |
| | Called once per frame to handle any new input.
|
| |
| void | Update (float dt) override |
| |
| void | Render () override |
| |
|
void | SetGameObject (std::weak_ptr< GameObject > ent) |
| | Sets the GameObject this component is attached to.
|
| |
|
std::shared_ptr< GameObject > | GetGameObject () |
| | Retrieves the GameObject this component is attached to, behind a shared pointer.
|
| |
|
template<typename T > |
| std::shared_ptr< T > | GetComponent () |
| | Alias for GetGameObject()->GetComponent<T>(), for easier scripting.
|
| |
|
| static ComponentType | GetType () |
| | Returns the type of this component to make querying GetComponent easier.
|
| |
|
static ComponentType | GetType () |
| | Returns the type of this component to make querying GetComponent easier.
|
| |
|
|
std::shared_ptr< SDL_Texture > | mTexture |
| |
|
SDL_FRect * | mSrcRect |
| |
|
std::weak_ptr< GameObject > | mGameObject |
| |
Component to render an image to the screen.
◆ CreateTexture()
| void TextureComponent::CreateTexture |
( |
std::string | filepath | ) |
|
Loads the texture to be rendered from a file
- Parameters
-
| filepath | The location of the texture on disk. |
◆ GetType()
| ComponentType TextureComponent::GetType |
( |
| ) |
|
|
static |
Returns the type of this component to make querying GetComponent easier.
◆ Input()
| void TextureComponent::Input |
( |
| ) |
|
|
overridevirtual |
Called once per frame to handle any new input.
Reimplemented from Component.
◆ Render()
| void TextureComponent::Render |
( |
| ) |
|
|
overridevirtual |
Called once per frame to render any necessary parts of this component to the screen
Reimplemented from Component.
◆ SelectSourceRect()
| void TextureComponent::SelectSourceRect |
( |
float | x, |
|
|
float | y, |
|
|
float | w, |
|
|
float | h ) |
Selects the region of the texture to render to the screen. Useful for interfacing with spritesheets.
◆ Update()
| void TextureComponent::Update |
( |
float | dt | ) |
|
|
overridevirtual |
Called once per frame for any timing specific logic
- Parameters
-
| deltaTime | The tick rate of the game, in seconds. Useful for things like velocity calculations |
Reimplemented from Component.
The documentation for this struct was generated from the following files: