TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
TurtleBrains::Graphics::SpriteFrame Struct Reference

#include <tb_sprite.h>

Public Member Functions

PixelSpace GetPixelTop (void) const
 
PixelSpace GetPixelLeft (void) const
 
PixelSpace GetPixelRight (void) const
 
PixelSpace GetPixelBottom (void) const
 
PixelSpace GetPixelWidth (void) const
 
PixelSpace GetPixelHeight (void) const
 
TexelSpace GetTexelTop (void) const
 
TexelSpace GetTexelLeft (void) const
 
TexelSpace GetTexelRight (void) const
 
TexelSpace GetTexelBottom (void) const
 
TexelSpace GetTexelWidth (void) const
 
TexelSpace GetTexelHeight (void) const
 

Static Public Member Functions

static SpriteFrame CreateWith (const TextureHandle &textureHandle)
 
static SpriteFrame CreateWith (const TextureHandle &textureHandle, const PixelSpace &frameX, const PixelSpace &frameY, const PixelSpace &frameWidth, const PixelSpace &frameHeight)
 

Public Attributes

float x
 
float y
 
float w
 
float h
 
TexelSpace uvx
 
TexelSpace uvy
 
TexelSpace uvw
 
TexelSpace uvh
 
TextureHandle mTexture
 

Detailed Description

A sprite frame describes a location and size of a rectangle on a given texture. Although the members of this object are public, they should be considered TurtleBrains implementation details and not used as they are subject to change in the future.

Note
This may become a hidden implementation detail in future version of TurtleBrains. Don't construct or use the SpriteFrame or risk the need to change code. You've been warned.

Member Function Documentation

static SpriteFrame TurtleBrains::Graphics::SpriteFrame::CreateWith ( const TextureHandle textureHandle)
static

Creates a SpriteFrame object that fills the entire texture from 0,0 to width,height of the texture.

Parameters
textureHandlethe handle of the texture to fill with a SpriteFrame.
static SpriteFrame TurtleBrains::Graphics::SpriteFrame::CreateWith ( const TextureHandle textureHandle,
const PixelSpace frameX,
const PixelSpace frameY,
const PixelSpace frameWidth,
const PixelSpace frameHeight 
)
static

Creates a SpriteFrame object at the desired location on the texture with a size specified. An error condition will be triggered if the textureHandle is invalid or if the location/size extends beyond the boundaries of the textured.

Parameters
textureHandleMust be the handle of a valid texture or an error condition will be triggered.
frameXis the location of the left edge of the sprite frame, 0 being the left most edge of the texture.
frameYis the location of the top edge of the sprite frame, 0 being the top most edge of the texture.
frameWidthis the horizontal size of the sprite frame on the texture, in pixels.
frameHeightis the vertical size of the sprite frame on the texture, in pixels.
PixelSpace TurtleBrains::Graphics::SpriteFrame::GetPixelBottom ( void  ) const

Returns the pixel space location of the bottom edge of the sprite frame on the texture.

PixelSpace TurtleBrains::Graphics::SpriteFrame::GetPixelHeight ( void  ) const

Returns the height of the sprite frame in pixels, also number of pixels from top to bottom edges.

PixelSpace TurtleBrains::Graphics::SpriteFrame::GetPixelLeft ( void  ) const

Returns the pixel space location of the left edge of the sprite frame on the texture.

PixelSpace TurtleBrains::Graphics::SpriteFrame::GetPixelRight ( void  ) const

Returns the pixel space location of the right edge of the sprite frame on the texture.

PixelSpace TurtleBrains::Graphics::SpriteFrame::GetPixelTop ( void  ) const

Returns the pixel space location of the top edge of the sprite frame on the texture.

PixelSpace TurtleBrains::Graphics::SpriteFrame::GetPixelWidth ( void  ) const

Returns the width of the sprite frame in pixels, also number of pixels from left to right edges.

TexelSpace TurtleBrains::Graphics::SpriteFrame::GetTexelBottom ( void  ) const

Returns the texel space location of the bottom edge of the sprite frame on the texture.

TexelSpace TurtleBrains::Graphics::SpriteFrame::GetTexelHeight ( void  ) const

Returns the height of the sprite frame in texel space, also same as texels from top to bottom edges.

TexelSpace TurtleBrains::Graphics::SpriteFrame::GetTexelLeft ( void  ) const

Returns the texel space location of the left edge of the sprite frame on the texture.

TexelSpace TurtleBrains::Graphics::SpriteFrame::GetTexelRight ( void  ) const

Returns the texel space location of the right edge of the sprite frame on the texture.

TexelSpace TurtleBrains::Graphics::SpriteFrame::GetTexelTop ( void  ) const

Returns the texel space location of the top edge of the sprite frame on the texture.

TexelSpace TurtleBrains::Graphics::SpriteFrame::GetTexelWidth ( void  ) const

Returns the width of the sprite frame in texel space, also same as texels from left to right edges.

Member Data Documentation

float TurtleBrains::Graphics::SpriteFrame::h

Height of the SpriteFrame in PixelSpace. (This is an implementation detail, don't use it.)

TextureHandle TurtleBrains::Graphics::SpriteFrame::mTexture

The handle of the texture loaded from the TextureManager that the sprite frame references. (This is an implementation detail, don't use it.)

TexelSpace TurtleBrains::Graphics::SpriteFrame::uvh

Height of the SpriteFrame in TexelSpace. (This is an implementation detail, don't use it.)

TexelSpace TurtleBrains::Graphics::SpriteFrame::uvw

Width of the SpriteFrame in TexelSpace. (This is an implementation detail, don't use it.)

TexelSpace TurtleBrains::Graphics::SpriteFrame::uvx

Horizontal location of the SpriteFrame in TexelSpace. (This is an implementation detail, don't use it.)

TexelSpace TurtleBrains::Graphics::SpriteFrame::uvy

Vertical location of the SpriteFrame in TexelSpace. (This is an implementation detail, don't use it.)

float TurtleBrains::Graphics::SpriteFrame::w

Width of the SpriteFrame in PixelSpace. (This is an implementation detail, don't use it.)

float TurtleBrains::Graphics::SpriteFrame::x

Horizontal location of the SpriteFrame in PixelSpace. (This is an implementation detail, don't use it.)

float TurtleBrains::Graphics::SpriteFrame::y

Horizontal location of the SpriteFrame in PixelSpace. (This is an implementation detail, don't use it.)