Gel2D - The free/open source game creation suite

Public Member Functions | Public Attributes
gel::GelLine Class Reference

#include <gelLine.h>

Inheritance diagram for gel::GelLine:
gel::GelObject gel::GelEventReceiver

List of all members.

Public Member Functions

 GelLine ()
 Default constructor.
 GelLine (float ln_width)
 Convenience constructor.
 GelLine (const GelSprite &sprite)
 Sprite constructor.
 GelLine (float ln_width, Gel2dVec ln_pos, float ln_rot)
 Convenience constructor.
void setWidth (float w)
 Sets the width of the line.
float getWidth () const
 Gets the width of the line.
void setPointSize (float size)
float getPointSize () const
GelColor getCol (int i=0) const
 Gets the color of the specified quad's vertex.
void setCol (GelColor col, int i=-1)
 Sets the color of the specified quad's vertex.
void setRGB (float r, float g, float b, int i=-1)
 Sets the color of the specified quad's vertex in RGB values.
float getAlpha (int i=0) const
 Gets the transparency of the specified quad's vertex.
void setAlpha (float alpha, int i=-1)
 Sets the transparency of the specified quad's vertex.
void setLineMode (LineMode mode)
LineMode getLineMode () const
void drawPoints (bool state)
 Sets whether or not to render points instead of lines.
void smoothLines (bool mode)
 Enable/disable anti-aliasing.
bool isSmooth () const
 Checks whether or not the line is anti-aliased.
int getNVerts () const
 Gets the number of vertices the line contains.
void addVert (Gel2dVec v_pos)
 Adds a vertex to the line at the given position.
void removeVert (int index)
 Removes the vertex at the given index.
void render ()
 Renders the line to the screen.

Public Attributes

GelVert v [MAX_GELLINE_VERTS]

Constructor & Destructor Documentation

gel::GelLine::GelLine ( )

Default constructor.

gel::GelLine::GelLine ( float  ln_width)

Convenience constructor.

Parameters:
ln_width: The width of the line in pixels.
gel::GelLine::GelLine ( const GelSprite sprite)

Sprite constructor.

Creates a looping line with 4 vertices, tracing the perimeter of a sprite.

Parameters:
sprite: The sprite to trace.
gel::GelLine::GelLine ( float  ln_width,
Gel2dVec  ln_pos,
float  ln_rot 
)

Convenience constructor.

Parameters:
ln_width: The width of the line in pixels.
ln_pos: A Gel2dVec containing the line's x and y coordinates.
ln_rot: The rotation of the line in degrees.

Member Function Documentation

void gel::GelLine::setWidth ( float  w) [inline]

Sets the width of the line.

Parameters:
w: The new width of the line in pixels.
float gel::GelLine::getWidth ( ) const [inline]

Gets the width of the line.

Returns:
The width of the line in pixels.
void gel::GelLine::setPointSize ( float  size) [inline]
float gel::GelLine::getPointSize ( ) const [inline]
GelColor gel::GelLine::getCol ( int  i = 0) const [inline]

Gets the color of the specified quad's vertex.

Parameters:
i: The vertex to get the color of. If omitted, selects the quad's first vertex.
Returns:
The color of the specified vertex.
void gel::GelLine::setCol ( GelColor  col,
int  i = -1 
)

Sets the color of the specified quad's vertex.

Parameters:
col: The new color.
i: The vertex to apply the color to. If -1 or omitted, applies to all vertices.
void gel::GelLine::setRGB ( float  r,
float  g,
float  b,
int  i = -1 
)

Sets the color of the specified quad's vertex in RGB values.

Parameters:
r: New red value.
g: New green value.
b: New blue value.
i: The vertex to apply the color to. If -1 or omitted, applies to all vertices.
float gel::GelLine::getAlpha ( int  i = 0) const [inline]

Gets the transparency of the specified quad's vertex.

Parameters:
i: The vertex to get the alpha value of. If omitted, selects the quad's first vertex.
Returns:
The alpha of the specified vertex.
void gel::GelLine::setAlpha ( float  alpha,
int  i = -1 
)

Sets the transparency of the specified quad's vertex.

It should be in range from 0 (transparent) to 1 (opaque).

Parameters:
alpha: The new alpha value.
i: The vertex to apply the alpha to. If -1 or omitted, applies to all vertices.
void gel::GelLine::setLineMode ( LineMode  mode) [inline]
LineMode gel::GelLine::getLineMode ( ) const [inline]
void gel::GelLine::drawPoints ( bool  state) [inline]

Sets whether or not to render points instead of lines.

Parameters:
state: Either true or false.
void gel::GelLine::smoothLines ( bool  mode) [inline]

Enable/disable anti-aliasing.

Parameters:
mode: Either true or false.
bool gel::GelLine::isSmooth ( ) const [inline]

Checks whether or not the line is anti-aliased.

Returns:
True if the line is anti-aliased, else false.
int gel::GelLine::getNVerts ( ) const [inline]

Gets the number of vertices the line contains.

void gel::GelLine::addVert ( Gel2dVec  v_pos)

Adds a vertex to the line at the given position.

Parameters:
v_pos: The local coordinates of the new vertex.
void gel::GelLine::removeVert ( int  index)

Removes the vertex at the given index.

Parameters:
index: The index of the vertex to remove.
void gel::GelLine::render ( ) [virtual]

Renders the line to the screen.

Reimplemented from gel::GelObject.


Member Data Documentation

GelVert gel::GelLine::v[MAX_GELLINE_VERTS]

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