mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
SpinningObject Class Reference

Implements a simple spinning object. More...

#include <SpinningObject.h>

Inheritance diagram for SpinningObject:
GameObject Planet SpaceStation Star

Public Member Functions

 SpinningObject ()
 
 SpinningObject (Vector3 position)
 
 SpinningObject (GLfloat x, GLfloat y, GLfloat z)
 
 ~SpinningObject (void)
 
void setAxis (Vector3 axis)
 
void setAxis (float x, float y, float z)
 
void setSpeed (float speed)
 
void spin (void)
 
- Public Member Functions inherited from GameObject
 GameObject (void)
 The constructor creates the object. The position is set to zero by default.
 
 GameObject (Vector3 position)
 The constructor creates the object and gives it a position in the scene.
 
 GameObject (float x, float y, float z)
 The constructor creates the object and gives it a position in the scene.
 
 ~GameObject (void)
 Destructor. Does nothing.
 
virtual Vector3 getPos (void)
 Returns the current position as Vector3 triple.
 
void setPos (float x, float y, float z)
 Sets the current position.
 
void setPos (Vector3 position)
 Sets the current position.
 

Detailed Description

Implements a simple spinning object.

It has a position since it is derived from GameObject. To allow rotating it has an axis around which the object can rotate and a speed.

Definition at line 18 of file SpinningObject.h.

Constructor & Destructor Documentation

SpinningObject::SpinningObject ( )

Initializes the object with position in the origin and y-axis as axis of rotation.

Definition at line 12 of file SpinningObject.cpp.

SpinningObject::SpinningObject ( Vector3  position)

Initializes the object at given position and with y-axis as axis of rotation

Parameters
positionposition as Vector3

Definition at line 23 of file SpinningObject.cpp.

SpinningObject::SpinningObject ( GLfloat  x,
GLfloat  y,
GLfloat  z 
)

Initializes the object at given position and with y-axis as axis of rotation

Parameters
xthe x-position
ythe y-position
zthe z-position

Definition at line 36 of file SpinningObject.cpp.

SpinningObject::~SpinningObject ( void  )

Destructor

Definition at line 46 of file SpinningObject.cpp.

Member Function Documentation

void SpinningObject::setAxis ( Vector3  axis)

Sets the spin axis.

Parameters
axisthe axis of rotation

Definition at line 53 of file SpinningObject.cpp.

void SpinningObject::setAxis ( float  x,
float  y,
float  z 
)

Sets the spin axis.

Parameters
xthe x-coordinate of the axis of rotation
ythe y-coordinate of the axis of rotation
zthe z-coordinate of the axis of rotation

Definition at line 63 of file SpinningObject.cpp.

void SpinningObject::setSpeed ( float  speed)

Sets the rotate speed.

Parameters
speedthe speed

Definition at line 73 of file SpinningObject.cpp.

void SpinningObject::spin ( void  )

Rotates the object using the glRotate*() function.

Definition at line 80 of file SpinningObject.cpp.


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