Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine.
GitHub | Vesper Updates | Creator
Loading...
Searching...
No Matches
Vesper::SubTextureComponent Struct Reference

Component that holds sub-texture data for sprites. More...

#include <Components.h>

Public Member Functions

 SubTextureComponent ()=default
 SubTextureComponent (const Ref< Texture2D > &texture)
 Constructor that initializes the sub-texture from a full texture.
 SubTextureComponent (const Ref< SubTexture2D > &subTexture)
 Constructor that initializes the sub-texture directly.
void SetTexture (const Ref< Texture2D > &texture)
 Copy constructor.
void SetTilingFactor (const glm::vec2 &tiling)
 Sets the tiling factor for the sub-texture.
void SetOffset (const glm::vec2 &offset)
 Sets the offset for the sub-texture.
 operator Ref< SubTexture2D > & ()
 operator const Ref< SubTexture2D > & () const
Ref< SubTexture2D > & GetSubTexture ()

Public Attributes

Ref< SubTexture2DSubTexture
 The sub-texture reference.
glm::vec2 TilingFactor = { 1.0f, 1.0f }
 Tiling factor for the sub-texture.
glm::vec2 Offset = { 0.0f, 0.0f }
 Offset for the sub-texture.

Detailed Description

Component that holds sub-texture data for sprites.

Constructor & Destructor Documentation

◆ SubTextureComponent() [1/3]

Vesper::SubTextureComponent::SubTextureComponent ( )
default

◆ SubTextureComponent() [2/3]

Vesper::SubTextureComponent::SubTextureComponent ( const Ref< Texture2D > & texture)
inline

Constructor that initializes the sub-texture from a full texture.

135 : SubTexture(SubTexture2D::CreateFromCoords(texture, { 0, 0 }, { texture->GetWidth(), texture->GetHeight() })) {
136 }
static Ref< SubTexture2D > CreateFromCoords(const Ref< Texture2D > &texture, const glm::vec2 &coords, const glm::vec2 &cellSize, const glm::vec2 &spriteSize={1, 1})
Creates a SubTexture2D from a grid of cells within the given texture.
Definition SubTexture2D.cpp:17
Ref< SubTexture2D > SubTexture
The sub-texture reference.
Definition Components.h:124

◆ SubTextureComponent() [3/3]

Vesper::SubTextureComponent::SubTextureComponent ( const Ref< SubTexture2D > & subTexture)
inline

Constructor that initializes the sub-texture directly.

139 : SubTexture(subTexture) {
140 }

Member Function Documentation

◆ GetSubTexture()

Ref< SubTexture2D > & Vesper::SubTextureComponent::GetSubTexture ( )
inline
158{ return SubTexture; }

◆ operator const Ref< SubTexture2D > &()

Vesper::SubTextureComponent::operator const Ref< SubTexture2D > & ( ) const
inline
157{ return SubTexture; }

◆ operator Ref< SubTexture2D > &()

Vesper::SubTextureComponent::operator Ref< SubTexture2D > & ( )
inline
156{ return SubTexture; }

◆ SetOffset()

void Vesper::SubTextureComponent::SetOffset ( const glm::vec2 & offset)
inline

Sets the offset for the sub-texture.

152 {
153 Offset = offset;
154 }
glm::vec2 Offset
Offset for the sub-texture.
Definition Components.h:128

◆ SetTexture()

void Vesper::SubTextureComponent::SetTexture ( const Ref< Texture2D > & texture)
inline

Copy constructor.

142 {
143 SubTexture = SubTexture2D::CreateFromCoords(texture, { 0, 0 }, { texture->GetWidth(), texture->GetHeight() });
144 }

◆ SetTilingFactor()

void Vesper::SubTextureComponent::SetTilingFactor ( const glm::vec2 & tiling)
inline

Sets the tiling factor for the sub-texture.

147 {
148 TilingFactor = tiling;
149 }
glm::vec2 TilingFactor
Tiling factor for the sub-texture.
Definition Components.h:126

Member Data Documentation

◆ Offset

glm::vec2 Vesper::SubTextureComponent::Offset = { 0.0f, 0.0f }

Offset for the sub-texture.

128{ 0.0f, 0.0f };

◆ SubTexture

Ref<SubTexture2D> Vesper::SubTextureComponent::SubTexture

The sub-texture reference.

◆ TilingFactor

glm::vec2 Vesper::SubTextureComponent::TilingFactor = { 1.0f, 1.0f }

Tiling factor for the sub-texture.

126{ 1.0f, 1.0f };

The documentation for this struct was generated from the following file: