|
The Game Engine
1
|
On-screen text. More...
#include <Text.h>
Inheritance diagram for Text:
Collaboration diagram for Text:Public Member Functions | |
| Text (string name, string t, int size=24, Color c=Color::WHITE, int w=600, int h=150, Point2D pos=Point2D()) | |
| Creates a Text with the given name and text with the correct color and size. More... | |
| Text (string filename, string sectionName, FontType t, int size=24, Color c=Color::WHITE, int w=600, int h=150, Point2D pos=Point2D()) | |
| Creates a Text with the given name and text with the correct color and size. More... | |
| ~Text () | |
| void | draw () |
| Draw the object. More... | |
| void | update () |
| What the text should do on update (currently unimplemented) More... | |
| void | setStartLine (unsigned int line) |
| Sets the start line if possible. More... | |
| int | getLastLine () |
| Gets the last line that was drawn. More... | |
| Point2D | getBasePos () |
| Obtain Base Pos for drawing. More... | |
| Point2D | getCenterPos () |
| Obtain Center Pos for Collisions. More... | |
| virtual WorldObjectType | getType () |
| This provides a simple interface to determine types of objects. More... | |
| void | wrap () |
| This wraps the text as well as I can guess. More... | |
Public Member Functions inherited from WorldObject | |
| WorldObject (std::string name, Point2D pos=Point2D(), int z=0) | |
| virtual void | drawCollisions () |
| Draws CollisionObject data for the Object. More... | |
| void | drawCollisions (vector< CollisionObject * > &vec, const Point2D &pos) |
| Draws CollisionObject data for the Object. More... | |
| virtual void | runBehavior () |
| Behavior that WorldObject follows. More... | |
| void | setPosition (double x, double y) |
| Sets the WorldObject's x an y coordinate. More... | |
| void | setPosition (Point2D pos) |
| Sets the WorldObject's x an y coordinate. More... | |
| void | setBasePosition (double x, double y) |
| Sets the WorldObject's x an y coordinate relative to base pos. More... | |
| void | setBasePosition (Point2D pos) |
| Sets the WorldObject's x an y coordinate relative to base pos. More... | |
| void | setCenterPosition (double x, double y) |
| Sets the WorldObject's x an y coordinate relative to base pos. More... | |
| void | setCenterPosition (Point2D pos) |
| Sets the WorldObject's x an y coordinate relative to base pos. More... | |
| void | move (double dx=0.0, double dy=0.0) |
| Move by given amount NOTE: This is an instantaneous movement by a given amount and does not correspond to physics which is set to do the updated amount per second. More... | |
| virtual void | move (Point2D direction) |
| Moves the WorldObject relative to the current pos. More... | |
| virtual void | moveTowards (Point2D direction) |
| Move towards a given coordinate (path finding) More... | |
| Point2D | getPosition () |
| Gets the WorldObject's position. More... | |
| void | setTransparency (float f) |
| Sets the WorldObject's transparency. More... | |
| float | getTransparency () |
| Gets the WorldObject's transparency. More... | |
| void | setAngle (float a) |
| Sets the WorldObject's angle in degrees. More... | |
| float | getAngle () |
| Gets the WorldObject's angle. More... | |
| void | setVelocity (Point2D vel) |
| Sets the WorldObject's velocity as a vector (will set MaxVelocity if needed) More... | |
| void | setVelocity (double xVel, double yVel) |
| Sets the WorldObject's velocity from coordinates (will set MaxVelocity if needed) More... | |
| Point2D | getVelocity () |
| Gets the WorldObject's Velocity. More... | |
| void | setMaxVelocity (Point2D vel) |
| Sets the WorldObject's MaxVelocity (magnitude) from (x,y) and transforms into a magnitude. More... | |
| void | setMaxVelocity (double vel, Point2D dir) |
| Sets the WorldObject's MaxVelocity (magnitude) value in the direction specified. More... | |
| void | setMaxSpeed (double vel) |
| Sets the WorldObject's MaxVelocity (magnitude) value in the direction specified. More... | |
| Point2D | getMaxVelocity () |
| Gets the WorldObject's Max Velocity. More... | |
| double | getMaxSpeed () |
| Gets the WorldObject's Max Speed. More... | |
| double | getMaxSpeedSquared () |
| Gets the WorldObject's Max Speed Squared (cheaper operation). More... | |
| void | setAcceleration (Point2D accel) |
| Sets the WorldObject's Acceleration in (x,y) coords. More... | |
| Point2D | getAcceleration () |
| Gets the WorldObject's Acceleration. More... | |
| void | setZOrder (int i) |
| int | getZOrder () |
| std::string | getName () |
| returns the WorldObject's name More... | |
| bool | operator< (WorldObject &rhs) |
| Sort worldObjects. More... | |
Public Attributes | |
| Font * | mFont |
| Pointer to the font that this text uses. More... | |
| vector< string > | lines |
| The lines of text to be rendered. More... | |
| Color | color |
| Color to displaty the text. More... | |
| int | width |
| The width to draw the text. More... | |
| int | height |
| Height of the text object. More... | |
Protected Attributes | |
| int | startline |
| The first line to draw when rendering. More... | |
| int | lastline |
| The last line drawn (for scrolling text boxes) More... | |
Protected Attributes inherited from WorldObject | |
| std::string | mName |
| WorldObject's name. More... | |
| Point2D | mPos |
| The current (x,y) position. More... | |
| Point2D | mVelocity |
| The current velocity vector. More... | |
| Point2D | mMaxVelocity |
| The max velocity is the max possible velocity where lengthis the speed. More... | |
| double | mMaxSpeed |
| The max Speed if MaxVelocity is 0 to store val. More... | |
| Point2D | mAcceleration |
| The current acceleration vector. More... | |
| bool | mVisible |
| Determine if Object should be visible. More... | |
| float | mTransparency |
| Transparency! More... | |
| float | mAngle |
| Angle of rotation. More... | |
| float | mScale |
| Scale for the sprit. More... | |
| int | ZOrder |
| Stacking order. Determines what draws on top. (subsorted by position) More... | |
| long | mLastUpdate |
| Number that indicates when the Object has last updated. Overflows in about 24 days so no worries. More... | |
| long | mLastDraw |
| Number that indicates when the Object has last updated. Overflows in about 24 days so no worries. More... | |
| bool | mUnused |
| Determines whether or not this object's update function should run. More... | |
| Behavior | mBehavior |
| Behavior to act each loop if !mUnused. More... | |
Additional Inherited Members | |
Public Types inherited from WorldObject | |
| enum | WorldObjectType { SPRITE, BACKGROUND, MENU, TEXT, PARTICLESYSTEM } |
| This is to be used for Type checking so as to make no need for dynamic_cast and it's inefficiency. More... | |
On-screen text.
This class is tasked with the following:
displaying text on screen.
Note: This should always be created and destroyed by some object.
| Text::Text | ( | string | name, |
| string | t, | ||
| int | size = 24, |
||
| Color | c = Color::WHITE, |
||
| int | w = 600, |
||
| int | h = 150, |
||
| Point2D | pos = Point2D() |
||
| ) |
Creates a Text with the given name and text with the correct color and size.
| name | Name for the text |
| t | text to be drawn to the screen |
| size | Size of the font |
| c | Color for the font |
| w | Width of the text box |
| h | Height of the text box |
| pos | Position of the top left of the text |
Definition at line 73 of file Text.cpp.
Here is the call graph for this function:| Text::Text | ( | string | filename, |
| string | sectionName, | ||
| FontType | t, | ||
| int | size = 24, |
||
| Color | c = Color::WHITE, |
||
| int | w = 600, |
||
| int | h = 150, |
||
| Point2D | pos = Point2D() |
||
| ) |
Creates a Text with the given name and text with the correct color and size.
| filename | The name of the yaml file to parse w/o path nor extension |
| sectionName | Name of the section within a yaml doc |
| t | text to be drawn to the screen |
| size | Size of the font |
| c | Color for the font |
| w | Width of the text box |
| h | Height of the text box |
| pos | Position of the top left of the text |
Definition at line 13 of file Text.cpp.
Here is the call graph for this function:
|
virtual |
Draw the object.
Implements WorldObject.
Definition at line 93 of file Text.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinevirtual |
|
inlinevirtual |
| int Text::getLastLine | ( | ) |
|
inlinevirtual |
This provides a simple interface to determine types of objects.
Returns the name of the Class and Descendants i.e. Something inheriting from Sprite would look like Sprite:Thing
Implements WorldObject.
| void Text::setStartLine | ( | unsigned int | line | ) |
|
virtual |
What the text should do on update (currently unimplemented)
Reimplemented from WorldObject.
Definition at line 166 of file Text.cpp.
Here is the call graph for this function:| void Text::wrap | ( | ) |
This wraps the text as well as I can guess.
Definition at line 182 of file Text.cpp.
Here is the caller graph for this function:
|
protected |
|
protected |