#include <eosim/graphic/Display.hpp>
To synchronize the display with the simulation Display::advance is implemented. We have to invoke this operation every time the simulation advance the time, which is the responsibility of RefreshGraphic Event.
During the run many objects and messages should appear in order to see how the simulation is running, for that there are Sprite y TextSprite (for graphics and text). These elements are linked to a display (in the constructor), and they will appear in the display until there are no references to them, excepting those from the display.
Public Member Functions | |
Display (int width, int height) | |
The constructor creates a Display with a window with the specified size. | |
~Display () | |
The destructor of Display. | |
void | setTitle (const char *title) |
This operation sets the title of the window where the simulation is displayed. | |
void | setBackground (const char *file) |
This operation sets the background image in the simulation. The supported file formats are BMP, PNM, XPM, XCF, PCX, GIF, JPG, TIF, PNG y LBM. Otherwise the background is black. | |
void | setSpeed (double sp) |
This operation changes the rate between real time and simulation time. Real time is measure in miliseconds. | |
double | getSpeed () const |
This operation returns the rate between real time and simulation time. | |
int | width () const |
This operation returns the width of the window where the simulation is displayed. | |
int | height () const |
This operation returns the height of the window where the simulation is displayed. | |
void | advance (double offsetTime) |
This operation advance simulation the simulation time in the graphical simulation. | |
Friends | |
class | Sprite |
class | TextSprite |
void eosim::graphic::Display::advance | ( | double | offsetTime | ) |
This operation advance simulation the simulation time in the graphical simulation.
This operation advances the simulation time in offsetTime time unit. It must be called on each time beat, so that the moves of the sprites is synchronized with the simulation time.