souleng
Game engine providing full Python scripting support
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
TextureComponent Struct Reference

Component to render an image to the screen. More...

#include <TextureComponent.hpp>

Inheritance diagram for TextureComponent:
Component TextTexture

Public Member Functions

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
 
- Public Member Functions inherited from Component
void SetGameObject (std::weak_ptr< GameObject > ent)
 Sets the GameObject this component is attached to.
 
std::shared_ptr< GameObjectGetGameObject ()
 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 Public Member Functions

static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 
- Static Public Member Functions inherited from Component
static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 

Protected Attributes

std::shared_ptr< SDL_Texture > mTexture
 
SDL_FRect * mSrcRect
 
- Protected Attributes inherited from Component
std::weak_ptr< GameObjectmGameObject
 

Detailed Description

Component to render an image to the screen.

Member Function Documentation

◆ CreateTexture()

void TextureComponent::CreateTexture ( std::string filepath)

Loads the texture to be rendered from a file

Parameters
filepathThe 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
deltaTimeThe 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: