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

Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring the world to life. More...

Classes

class  AnimatedSprite
 
class  AnimationSequence
 
class  BoxShape
 
class  Camera
 
class  CircleShape
 
class  Color
 
class  FullScreenQuad
 
class  Graphic
 
class  GraphicList
 
class  Line
 
class  LineContainer
 
class  OutlinedBoxShape
 
class  OutlinedCircleShape
 
class  OutlinedPolygonShape
 
class  PolygonShape
 
class  RenderTarget
 
class  Sprite
 
struct  SpriteFrame
 
class  SpriteManager
 
class  SpriteMap
 
class  SpriteSheet
 
class  Text
 
class  TextureManager
 

Typedefs

typedef float TexelSpace
 
typedef tbCore::uint16 PixelSpace
 
typedef unsigned int TextureHandle
 

Enumerations

enum  AnchorLocation {
  kAnchorCenter = 0, kAnchorTopLeft, kAnchorTopCenter, kAnchorTopRight,
  kAnchorCenterLeft, kAnchorCenterRight, kAnchorBottomLeft, kAnchorBottomCenter,
  kAnchorBottomRight
}
 

Functions

void SetActiveCamera (Camera &camera)
 
void SetActiveCamera (Camera *camera)
 
CameraGetActiveCamera (void)
 
void GifPerformCapture (const float deltaTime, const bool toggleCaptureState)
 
void GifCaptureCleanup (void)
 
PixelSpace ScreenWidth (void)
 
PixelSpace ScreenHeight (void)
 
float ScreenAspectRatio (void)
 
tbMath::Vector2 ScreenCenter (void)
 

Variables

SpriteManager theSpriteManager
 
const TextureHandle kInvalidTexture
 
const TextureHandlekBlankTexture
 
TextureManager theTextureManager
 

Detailed Description

TODO: TIM: Documentation: This is still early in development and the Graphics framework is still being designed.

Typedef Documentation

Represents a measurement in pixel space be it the width/height of an image in pixels, or the location on the screen or texture in pixels.

Represents a value from 0 to 1 in texture space for the width/height or location on a texture.

A TextureHandle is a unique value for each unique texture created with the TextureManager. Use the handle to access the textures properties and to destroy any resources associated.

TODO: TIM: Implementation: Maybe this should be a tiny class/object that automatically cleans up resources?

Enumeration Type Documentation

These locations are used in the Sprite::SetOrigin() which takes an AnchorLocation.

Enumerator
kAnchorCenter 

This anchor will set the origin to the center of the Sprite horizontally and vertically.

kAnchorTopLeft 

This anchor will set the origin to the top-left corner, effectively: SetOrigin(0.0f, 0.0f).

kAnchorTopCenter 

This anchor will set the origin to the top and horizontal center of the Sprite.

kAnchorTopRight 

This anchor will set the origin to the top and right most corner of the Sprite.

kAnchorCenterLeft 

This anchor will set the origin to the center vertically and left most edge of the Sprite.

kAnchorCenterRight 

This anchor will set the origin to the center vertically and right most edge of the Sprite.

kAnchorBottomLeft 

This anchor will set the origin to the bottom and left most corner of the Sprite.

kAnchorBottomCenter 

This anchor will set the origin to the bottom edge and horizontal center of the Sprite.

kAnchorBottomRight 

This anchor will set the origin to the bottom and right most corner of the Sprite.

Function Documentation

Camera& TurtleBrains::Graphics::GetActiveCamera ( void  )

Retrieves the currently active camera, which there can only ever be one active camera and there is always an active camera.

void TurtleBrains::Graphics::GifPerformCapture ( const float  deltaTime,
const bool  toggleCaptureState 
)

This is the only function that needs to be called, once per frame during Update().

Parameters
deltaTimeThe amount of time since the previous call to PerformCapture.
toggleCaptureTrue if the capture state should be toggled on/off or off/on depending on the current state. Typically this would be a value from IsKeyPressed().
float TurtleBrains::Graphics::ScreenAspectRatio ( void  )

Computes and returns the aspect ratio of the screen, width/height. 1920/1080 ~= 1.77778.

tbMath::Vector2 TurtleBrains::Graphics::ScreenCenter ( void  )

Creates and returns a Vector2 object of the location of the center of the screen, half width / height.

PixelSpace TurtleBrains::Graphics::ScreenHeight ( void  )

Returns the height of the screen/window in pixels.

PixelSpace TurtleBrains::Graphics::ScreenWidth ( void  )

Returns the width of the screen/window in pixels.

void TurtleBrains::Graphics::SetActiveCamera ( Camera camera)

Sets the current camera to be inactive and sets the provided camera as an active camera that will not be cleaned up. It is expected the camera object provided will be in existance until it is no longer the active camera.

Parameters
cameraThe newly activated camera ready to apply to the view.
void TurtleBrains::Graphics::SetActiveCamera ( Camera camera)

Sets the current camera to be inactive and sets the provided camera as an active camera that will automatically be cleaned up by calling delete on the object once a new camera becomes active.

Parameters
cameraA pointer to a camera object that was allocated with new. This object will become the active camera ready to apply to the view, and will automatically get deleted once a new camera is activated.

Variable Documentation

const TextureHandle& TurtleBrains::Graphics::kBlankTexture

This is a small, white texture that is automatically loaded for rendering Lines without a separate shader.

const TextureHandle TurtleBrains::Graphics::kInvalidTexture

This is a constant value that represents a null/invalid texture handle.

SpriteManager TurtleBrains::Graphics::theSpriteManager

Instead of creating your own SpriteManager object, this is a way to access it as a singleton. This may turn into a pointer to the object, although the SpriteManager api will remain the same.

TextureManager TurtleBrains::Graphics::theTextureManager

Instead of creating your own TextureManager object, this is a way to access it as a singleton. This may turn into a pointer to the object, although the TextureManager API will remain the same.