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::Config Class Reference

Public Member Functions

std::string getConfig () const
 
int getWindowHorizontalPixels () const
 
int getWindowVerticalPixels () const
 
int getWindowHorizontalChars () const
 
int getWindowVerticalChars () const
 
enum Color getWindowBackgroundColor () const
 
int getWindowStyle () const
 
int getFrameTime () const
 
float getFontScale () const
 
std::string getWindowTitle () const
 
bool getShowMouse () const
 
bool getHeadless () const
 
std::string getFontFile () const
 
std::string getLogFile () const
 
int getRandomSeed () const
 
std::string match (std::string find) const
 
void setConfig (std::string config)
 
void setWindowHorizontalPixels (int window_horizontal_pixels)
 
void setWindowVerticalPixels (int window_vertical_pixels)
 
void setWindowHorizontalChars (int window_horizontal_chars)
 
void setWindowVerticalChars (int window_vertical_chars)
 
void setWindowBackgroundColor (enum Color window_background_color)
 
void setWindowStyle (int window_style)
 
void setFrameTime (int frame_time)
 
void setFontScale (float font_scale)
 
void setWindowTitle (std::string window_title)
 
void setHeadless (bool headless=true)
 
void setShowMouse (bool show_mouse=true)
 
void setFontFile (std::string font_file)
 
void setLogFile (std::string logfile)
 
void setRandomSeed (int random_seed)
 
void writeToLog () const
 

Static Public Member Functions

static ConfiggetInstance ()
 

Private Member Functions

 Config ()
 
 Config (Config const &)
 
void operator= (Config const &)
 

Private Attributes

std::string m_config
 
int m_window_horizontal_pixels
 
int m_window_vertical_pixels
 
int m_window_horizontal_chars
 
int m_window_vertical_chars
 
int m_window_style
 
enum Color m_window_background_color
 
int m_frame_time
 
float m_font_scale
 
std::string m_window_title
 
bool m_show_mouse
 
bool m_headless
 
std::string m_font_file
 
std::string m_logfile
 
int m_random_seed
 

Constructor & Destructor Documentation

df::Config::Config ( )
private

Private since a singleton.

df::Config::Config ( Config const &  )
private

Don't allow copy.

Member Function Documentation

std::string df::Config::getConfig ( ) const

Get attributes.

static Config& df::Config::getInstance ( )
static

Get the singleton instance of the Config.

std::string df::Config::match ( std::string  find) const

Match key:value pair in global configuration, returning value.

Return empty string if no match.

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

Don't allow assignment.

void df::Config::setConfig ( std::string  config)

Set attributes.

Member Data Documentation

std::string df::Config::m_config
private

Aggregate string from config file.

std::string df::Config::m_font_file
private

Filename for graphics fonts.

float df::Config::m_font_scale
private

Font scale multiplier.

int df::Config::m_frame_time
private

Target time for 1 game loop (in mlsecs).

bool df::Config::m_headless
private

True if run without graphics or input.

std::string df::Config::m_logfile
private

Filename for dragonfly log.

int df::Config::m_random_seed
private

Seed for random number generation.

bool df::Config::m_show_mouse
private

True if should show mouse cursor.

enum Color df::Config::m_window_background_color
private

Window background color.

int df::Config::m_window_horizontal_chars
private

Horizontal ASCII spaces in window.

int df::Config::m_window_horizontal_pixels
private

Horizontal pixels in window.

int df::Config::m_window_style
private

Style of window titlebar.

std::string df::Config::m_window_title
private

Title of window.

int df::Config::m_window_vertical_chars
private

Vertical ASCII spaces in window.

int df::Config::m_window_vertical_pixels
private

Vertical pixels in window.