Dragonfly 4.19
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
 
bool getNetworking () const
 
int getQuadtreeDepth () const
 
int getQuadtreeThreshold () const
 
int getGridWidth () const
 
int getGridHeight () 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 setNetworking (bool networking)
 
void setQuadtreeDepth (int quadtree_thresh)
 
void setQuadtreeThreshold (int quadtree_depth)
 
void setGridWidth (int grid_width)
 
void setGridHeight (int grid_height)
 
void writeToLog () const
 
std::string readConfig ()
 
void loadConfig (std::string str="")
 

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
 
bool m_networking
 
int m_quadtree_threshold
 
int m_quadtree_depth
 
int m_grid_width
 
int m_grid_height
 

Constructor & Destructor Documentation

◆ Config() [1/2]

df::Config::Config ( )
private

Private since a singleton.

◆ Config() [2/2]

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

Don't allow copy.

Member Function Documentation

◆ getConfig()

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

Get attributes.

◆ getInstance()

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

Get the singleton instance of the Config.

◆ match()

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

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

Return empty string if no match.

◆ operator=()

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

Don't allow assignment.

◆ setConfig()

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

Set attributes.

Member Data Documentation

◆ m_config

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

Aggregate string from config file.

◆ m_font_file

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

Filename for graphics fonts.

◆ m_font_scale

float df::Config::m_font_scale
private

Font scale multiplier.

◆ m_frame_time

int df::Config::m_frame_time
private

Target time for 1 game loop (in mlsecs).

◆ m_grid_height

int df::Config::m_grid_height
private

Grid height.

◆ m_grid_width

int df::Config::m_grid_width
private

Grid width.

◆ m_headless

bool df::Config::m_headless
private

True if run without graphics or input.

◆ m_logfile

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

Filename for dragonfly log.

◆ m_networking

bool df::Config::m_networking
private

True if networking enabled.

◆ m_quadtree_depth

int df::Config::m_quadtree_depth
private

Max depth for quadtree.

◆ m_quadtree_threshold

int df::Config::m_quadtree_threshold
private

Object threshold for quadtree split.

◆ m_random_seed

int df::Config::m_random_seed
private

Seed for random number generation.

◆ m_show_mouse

bool df::Config::m_show_mouse
private

True if should show mouse cursor.

◆ m_window_background_color

enum Color df::Config::m_window_background_color
private

Window background color.

◆ m_window_horizontal_chars

int df::Config::m_window_horizontal_chars
private

Horizontal ASCII spaces in window.

◆ m_window_horizontal_pixels

int df::Config::m_window_horizontal_pixels
private

Horizontal pixels in window.

◆ m_window_style

int df::Config::m_window_style
private

Style of window titlebar.

◆ m_window_title

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

Title of window.

◆ m_window_vertical_chars

int df::Config::m_window_vertical_chars
private

Vertical ASCII spaces in window.

◆ m_window_vertical_pixels

int df::Config::m_window_vertical_pixels
private

Vertical pixels in window.