|
| SpriteString (SpriteFont *sf) |
| Creates an empty text with a given font.
|
|
| SpriteString (SpriteFont *sf, std::string s, float x, float y, float kern=5) |
| Creates a text at a given location with default kerning of 5.
|
|
float | GetHeight () |
| Returns width of entire text minus kerning.
|
|
float | GetWidth () |
| Returns height of tallest letter in string.
|
|
float | GetKerning () |
| Returns kerning.
|
|
void | SetKerning (float k) |
| Sets Kerning.
|
|
void | Set (float x, float y) |
| Sets the top left starting point.
|
|
void | Set (std::string s) |
| Sets the string to be printed.
|
|
void | Set (std::string s, float x, float y) |
| Sets the string to be printed and the top left starting point.
|
|
void | Set (std::string s, float x, float y, float kern) |
| Sets the string to be printed, the top left starting point, and the kerning.
|
|
void | Set (SpriteFont *sf, std::string s, float x, float y) |
| Sets the font, the string to be printed, and the top left starting point.
|
|
void | Set (SpriteFont *sf, std::string s, float x, float y, float kern) |
| Sets the font, the string to be printed, the top left starting point, and the kerning.
|
|
void | Render () |
| Renders the text to the screen.
|
|
Responsible for writing text to the screen.
Example:
StringDemo.h
class SpriteFont;
public:
StringDemo();
StringDemo(const StringDemo&) = default;
StringDemo& operator=(const StringDemo&) = default;
~StringDemo();
private:
int counter;
};
virtual void Draw2D()
Fill this with code that occurs during the Draw2D phase.
Definition Drawable2D.h:51
Responsible for GameObject centralization.
Definition GameObject.h:179
Extra feature of ScreenLog.
Definition Panel.h:15
Responsible for Sprite Creation and Positioning.
Definition Sprite.h:129
SpriteString(SpriteFont *sf)
Creates an empty text with a given font.
Definition SpriteString.cpp:5
virtual void Update()
Fill this with code that occurs during the Update phase.
Definition Updatable.h:54
StringDemo.cpp
#include "StringDemo.h"
StringDemo::StringDemo(){
counter = 0;
demoStringOne->SetKerning(4.0f);
}
StringDemo::~StringDemo(){
delete demoStringOne;
delete demoStringTwo;
}
void StringDemo::Update(){
demoStringOne->Set("Counter: " + std::to_string(counter));
counter++;
}
void StringDemo::Draw2D(){
demoStringOne->Render();
demoStringTwo->Render();
}
void SubmitRegistration()
Called when wanting to show sprites on screen.
Definition Drawable2D.cpp:37
static SpriteFont * GetFont(const MapKey &key)
Returns Font pointer with given KEY.
Definition FontManager.h:68
static int GetHeight()
Returns window's height in pixels.
Definition Game.h:161
static int GetWidth()
Returns window's width in pixels.
Definition Game.h:167
void SubmitRegistration()
Called when wanting to make changes every frame.
Definition Updatable.cpp:37