eosim::graphic::Display Class Reference
[Graphic Simulations]

#include <eosim/graphic/Display.hpp>

List of all members.


Detailed Description

Display window.

Author:
Bruno Martínez, Fernando Pardo and Sebastián Alaggia
Version:
1.1.1
Date:
2005
This class brings a graphical environment to the programmer so he can develop a 2D graphical simulation. To use it an instance of Display must be created as a Model's attribute. Only one instance of Display can be created per run. The window created will be opened while the instance persists.

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


Member Function Documentation

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.


Generated on Tue Oct 14 16:49:01 2008 for EOSimulator by  doxygen 1.5.2