Angel 3.2
A 2D Game Prototyping Engine
Public Member Functions | List of all members
GridActor Class Reference

An Actor to draw lines at regular intervals. More...

#include <GridActor.h>

+ Inheritance diagram for GridActor:

Public Member Functions

 GridActor ()
 
 GridActor (const Color &lines, const Color &axis, float interval, const Vector2 &minCoord, const Vector2 &maxCoord)
 
void SetLineColor (const Color &lineCol)
 
const ColorGetLineColor () const
 
void SetAxisColor (const Color &axisCol)
 
const ColorGetAxisColor () const
 
void SetInterval (float interval)
 
const float GetInterval () const
 
void SetMinCoord (const Vector2 &minCoord)
 
const Vector2 GetMinCoord () const
 
void SetMaxCoord (const Vector2 &maxCoord)
 
const Vector2 GetMaxCoord () const
 
virtual void Render ()
 
virtual void Update (float dt)
 
- Public Member Functions inherited from Renderable
 Renderable ()
 
virtual ~Renderable ()
 
void Destroy ()
 
bool IsDestroyed ()
 
int GetLayer ()
 

Additional Inherited Members

- Protected Member Functions inherited from Renderable
virtual void PreDestroy ()
 
- Protected Attributes inherited from Renderable
bool _deleteMe
 
int _layer
 

Detailed Description

A GridActor just makes it easy to draw grids in your game. This can be useful for placing objects while you're creating the world, or to just look cool. :-)

Definition at line 41 of file GridActor.h.

Constructor & Destructor Documentation

GridActor::GridActor ( )

The default constructor creates the "Angel grid." An interval of 1.0 GL units, drawing from (-100, -100) to (100, 100), with light blue lines and red axis lines.

Definition at line 35 of file GridActor.cpp.

GridActor::GridActor ( const Color lines,
const Color axis,
float  interval,
const Vector2 minCoord,
const Vector2 maxCoord 
)

If you have something else in mind for your grid, you can specify its visual appearance with this constructor.

Parameters
linesthe color of the lines in the grid
axisthe color of the lines drawn at the X and Y axes
intervalthe amount of space (in GL units) between each line
minCoordthe bottom-left coordinate from which to start drawing
maxCoordthe top-right coordinate at which to stop drawing

Definition at line 47 of file GridActor.cpp.

Member Function Documentation

void GridActor::SetLineColor ( const Color lineCol)

Set the color of the non-axis lines of the grid.

Parameters
lineColthe color of the lines

Definition at line 58 of file GridActor.cpp.

const Color & GridActor::GetLineColor ( ) const

Return the current line color of this GridActor.

Returns
the current line color as a Color object

Definition at line 63 of file GridActor.cpp.

void GridActor::SetAxisColor ( const Color axisCol)

Set the color of the axis lines of the grid.

Parameters
axisColthe color of the axis lines

Definition at line 68 of file GridActor.cpp.

const Color & GridActor::GetAxisColor ( ) const

Return the current axis line color of this GridActor.

Returns
the current axis line color as a Color object

Definition at line 73 of file GridActor.cpp.

void GridActor::SetInterval ( float  interval)

Set the spacing of the lines.

Parameters
intervalthe amount of space between each line in GL units

Definition at line 78 of file GridActor.cpp.

const float GridActor::GetInterval ( ) const

Return the line spacing interval for this GridActor.

Returns
the current interval in GL units

Definition at line 83 of file GridActor.cpp.

void GridActor::SetMinCoord ( const Vector2 minCoord)

Set the bottom-left coordinate at which to start drawing the grid.

Parameters
minCoordthe bottom-left X and Y position in GL units

Definition at line 88 of file GridActor.cpp.

const Vector2 GridActor::GetMinCoord ( ) const

Return the bottom-left start coordinate of the grid.

Returns
the bottom-left X and Y position in GL unites

Definition at line 94 of file GridActor.cpp.

void GridActor::SetMaxCoord ( const Vector2 maxCoord)

Set the top-right coordinate at which to stop drawing the grid.

Parameters
maxCoordthe top-right X and Y position in GL units

Definition at line 99 of file GridActor.cpp.

const Vector2 GridActor::GetMaxCoord ( ) const

Return the top-right coordinate of the grid.

Returns
the top-right X and Y position in GL units

Definition at line 105 of file GridActor.cpp.

void GridActor::Render ( )
virtual

Override of the normal Renderable::Render function. Draws the lines that have been specified.

Reimplemented from Renderable.

Definition at line 140 of file GridActor.cpp.

virtual void GridActor::Update ( float  dt)
inlinevirtual

Override of the normal Renderable::Update function. Does nothing, here to satisfy the abstract base class.

Reimplemented from Renderable.

Definition at line 143 of file GridActor.h.


The documentation for this class was generated from the following files: