Dragonfly  4.3
A text-based game engine
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
df::DisplayManager Class Reference
Inheritance diagram for df::DisplayManager:
Inheritance graph
[legend]
Collaboration diagram for df::DisplayManager:
Collaboration graph
[legend]

Public Member Functions

int startUp ()
 
void shutDown ()
 
int drawCh (Vector world_pos, char ch, Color color) const
 
int drawCh (Vector world_pos, char ch, unsigned char r, unsigned char g, unsigned char b) const
 
int drawFrame (Vector world_pos, Frame frame, bool centered, Color color, char transparent=0) const
 
int drawString (Vector world_pos, std::string str, Justification just, Color color) const
 
int getHorizontal () const
 
int getVertical () const
 
int getHorizontalPixels () const
 
int getVerticalPixels () const
 
bool setBackgroundColor (Color new_color)
 
int swapBuffers ()
 
sf::RenderWindow * getWindow () const
 
- Public Member Functions inherited from df::Manager
std::string getType () const
 
bool isStarted () const
 
int onEvent (const Event *p_event) const
 
int registerInterest (Object *p_o, std::string event_type)
 
int unregisterInterest (Object *p_o, std::string event_type)
 

Static Public Member Functions

static DisplayManagergetInstance ()
 

Private Member Functions

 DisplayManager ()
 
 DisplayManager (DisplayManager const &)
 
void operator= (DisplayManager const &)
 

Private Attributes

sf::Font m_font
 
sf::RenderWindow * m_p_window
 
int m_window_horizontal_pixels
 
int m_window_vertical_pixels
 
int m_window_horizontal_chars
 
int m_window_vertical_chars
 
sf::RectangleShape * m_p_rectangle
 
sf::Color m_window_background_color
 
sf::Text * m_p_text
 

Additional Inherited Members

- Protected Member Functions inherited from df::Manager
void setType (std::string new_type)
 

Constructor & Destructor Documentation

df::DisplayManager::DisplayManager ( )
private

Private since a singleton.

df::DisplayManager::DisplayManager ( DisplayManager const &  )
private

Don't allow copy.

Member Function Documentation

int df::DisplayManager::drawCh ( Vector  world_pos,
char  ch,
Color  color 
) const

Draw character at window location (x,y) with color.

Return 0 if ok, else -1.

int df::DisplayManager::drawCh ( Vector  world_pos,
char  ch,
unsigned char  r,
unsigned char  g,
unsigned char  b 
) const

Draw character at window location (x,y) with custom color.

Return 0 if ok, else -1.

int df::DisplayManager::drawFrame ( Vector  world_pos,
Frame  frame,
bool  centered,
Color  color,
char  transparent = 0 
) const

Draw single sprite frame at window location (x,y) with color.

If centered true, then center frame at (x,y). Don't draw transparent characters (0 means none). Return 0 if ok, else -1.

int df::DisplayManager::drawString ( Vector  world_pos,
std::string  str,
Justification  just,
Color  color 
) const

Draw string at window location (x,y) with color.

Justified left, center or right. Return 0 if ok, else -1.

int df::DisplayManager::getHorizontal ( ) const

Return window's horizontal maximum (in characters).

int df::DisplayManager::getHorizontalPixels ( ) const

Return window's horizontal maximum (in pixels).

static DisplayManager& df::DisplayManager::getInstance ( )
static

Get the one and only instance of the DisplayManager.

int df::DisplayManager::getVertical ( ) const

Return window's vertical maximum (in characters).

int df::DisplayManager::getVerticalPixels ( ) const

Return window's vertical maximum (in pixels).

sf::RenderWindow* df::DisplayManager::getWindow ( ) const

Return pointer to SFML drawing window.

void df::DisplayManager::operator= ( DisplayManager const &  )
private

Don't allow assignment.

bool df::DisplayManager::setBackgroundColor ( Color  new_color)

Set window's background color.

Return true if ok, else false.

void df::DisplayManager::shutDown ( )
virtual

Close graphics window.

Reimplemented from df::Manager.

int df::DisplayManager::startUp ( )
virtual

Open graphics window ready for text-based display.

Return 0 if ok, else -1.

Reimplemented from df::Manager.

int df::DisplayManager::swapBuffers ( )

Render current window buffer.

Return 0 if ok, else -1.

Member Data Documentation

sf::Font df::DisplayManager::m_font
private

Font used for ASCII graphics.

sf::RectangleShape* df::DisplayManager::m_p_rectangle
private

Backing rectangle for under text.

sf::Text* df::DisplayManager::m_p_text
private

ASCII character to draw.

sf::RenderWindow* df::DisplayManager::m_p_window
private

Pointer to SFML window.

sf::Color df::DisplayManager::m_window_background_color
private

Background color of window.

int df::DisplayManager::m_window_horizontal_chars
private

Horizontal ASCII spaces in window.

int df::DisplayManager::m_window_horizontal_pixels
private

Horizontal pixels in window.

int df::DisplayManager::m_window_vertical_chars
private

Vertical ASCII spaces in window.

int df::DisplayManager::m_window_vertical_pixels
private

Vertical pixels in window.