An AbstractTask to display the framerate and other information. More...
#include <ShowInfoTask.h>
Public Member Functions | |
ShowInfoTask (ptr< Font > font, ptr< Program > p, int color, float size, vec3i pos) | |
Creates a new ShowInfoTask. | |
virtual | ~ShowInfoTask () |
Deletes this ShowInfoTask. | |
virtual ptr< Task > | getTask (ptr< Object > context) |
Creates a new task. | |
Static Public Member Functions | |
static void | setInfo (const string &topic, const string &info) |
Adds an information to display. | |
Protected Member Functions | |
ShowInfoTask () | |
Creates an uninitialized ShowInfoTask. | |
virtual void | init (ptr< Font > font, ptr< Program > p, int color, float size, vec3i pos) |
Initializes this ShowInfoTask. | |
virtual void | swap (ptr< ShowInfoTask > t) |
Swaps this ShowInfoTask with another one. | |
virtual void | drawLine (const vec4f &vp, float xs, float ys, int color, const string &s) |
Draws a line of text. | |
virtual void | draw (ptr< Method > context) |
Draws the framerate and the information messages. | |
Protected Attributes | |
ptr< Program > | fontProgram |
The program use to draw characters. | |
ptr< UniformSampler > | fontU |
The uniform in fontProgram used to control the font texture. | |
ptr< Font > | font |
The Font used to display Text. | |
int | fontColor |
The font color in RGBA8 format. | |
float | fontHeight |
The used font height. | |
vec3i | position |
The x,y position and the maximum number of lines of text to be displayed. | |
Static Protected Attributes | |
static static_ptr< Mesh < Font::Vertex, unsigned int > > | fontMesh |
The mesh used to draw character quads, in order to display text. | |
static map< string, string > | infos |
The current information messages, associated with their topic. |
An AbstractTask to display the framerate and other information.
ork::ShowInfoTask::ShowInfoTask | ( | ptr< Font > | font, | |
ptr< Program > | p, | |||
int | color, | |||
float | size, | |||
vec3i | pos | |||
) |
Creates a new ShowInfoTask.
font | the Font used to display Text. | |
p | the program to be used to draw characters. | |
color | the font color in RGBA8 format. | |
size | the font height. | |
pos | x,y position and maximum number of lines of text to display. |
virtual ork::ShowInfoTask::~ShowInfoTask | ( | ) | [virtual] |
Deletes this ShowInfoTask.
ork::ShowInfoTask::ShowInfoTask | ( | ) | [protected] |
Creates an uninitialized ShowInfoTask.
Draws the framerate and the information messages.
context | the method to which this task belongs. |
Reimplemented in ork::ShowLogTask.
virtual void ork::ShowInfoTask::drawLine | ( | const vec4f & | vp, | |
float | xs, | |||
float | ys, | |||
int | color, | |||
const string & | s | |||
) | [protected, virtual] |
Draws a line of text.
vp | the framebuffer viewport, in pixels. | |
xs | the x coordinate of the first character to display. | |
ys | the y coordinate of the first character to display. | |
color | the color of this line of text, in RGBA8 format. | |
s | the line of text to display. |
Creates a new task.
context | an optional parameter to control the task creation. |
Implements ork::TaskFactory.
virtual void ork::ShowInfoTask::init | ( | ptr< Font > | font, | |
ptr< Program > | p, | |||
int | color, | |||
float | size, | |||
vec3i | pos | |||
) | [protected, virtual] |
Initializes this ShowInfoTask.
font | the Font used to display Text. | |
p | the program to be used to draw characters. | |
color | the font color in RGBA8 format. | |
size | the font height. | |
pos | x,y position and maximum number of lines of text to display. |
static void ork::ShowInfoTask::setInfo | ( | const string & | topic, | |
const string & | info | |||
) | [static] |
Adds an information to display.
The information has a topic and replaces the previous information in this topic. All the topics are cleared after each frame (you have to set them at each frame if you want them to persist on screen).
topic | the topic of the information. | |
info | an information message. |
virtual void ork::ShowInfoTask::swap | ( | ptr< ShowInfoTask > | t | ) | [protected, virtual] |
Swaps this ShowInfoTask with another one.
t | a ShowInfoTask. |
ptr<Font> ork::ShowInfoTask::font [protected] |
The Font used to display Text.
int ork::ShowInfoTask::fontColor [protected] |
The font color in RGBA8 format.
float ork::ShowInfoTask::fontHeight [protected] |
The used font height.
static_ptr< Mesh<Font::Vertex, unsigned int> > ork::ShowInfoTask::fontMesh [static, protected] |
The mesh used to draw character quads, in order to display text.
ptr<Program> ork::ShowInfoTask::fontProgram [protected] |
The program use to draw characters.
ptr<UniformSampler> ork::ShowInfoTask::fontU [protected] |
The uniform in fontProgram used to control the font texture.
map<string, string> ork::ShowInfoTask::infos [static, protected] |
The current information messages, associated with their topic.
vec3i ork::ShowInfoTask::position [protected] |
The x,y position and the maximum number of lines of text to be displayed.