config Class Reference

This class contains the engine's configuration read either from the config file or from the command line. More...

#include <prefs.h>

Collaboration diagram for config:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 config ()
 Constructor.
void parse_arguments (int argc, char *argv[])
 See whether any options have been specified on the command line.
void write_adonthellrc ()
 Writes a default configuration file with the values set in the constructor.
bool read_adonthellrc ()
 Reads the configuration file.
char * get_adonthellrc ()
 Returns the path to the user's private Adonthell directory.

Public Attributes

Configuration options
string language
 Language to use if NLS was compiled in.
string font
string game_name
 Name of the game that is running at present.
string gamedir
 Path of the directory that contains the game running at present.
u_int8 screen_mode
 Whether the engine shall run in window (0) or fullscreen (1) mode.
u_int8 double_screen
u_int8 quick_load
 Whether the quick-load feature is enabled (1) or not (0).
u_int8 audio_channels
 The number of channels: mono (0) or stereo (1).
u_int8 audio_resolution
 The resolution: 8 bit (0) or 16 bit (1).
u_int8 audio_sample_rate
 The sample rate: 11025 Hz (0), 22050 Hz (1) or 44100 Hz (2).
u_int8 audio_volume
 The volume: a value betwen 0 and 100.


Detailed Description

This class contains the engine's configuration read either from the config file or from the command line.

Definition at line 70 of file prefs.h.


Constructor & Destructor Documentation

config::config (  ) 

Constructor.

Initializes all configuration options with default values.

  • Language: English
  • Screen mode: windowed
  • Quick load: enabled
  • Audio: High quality (44.1kHz, 16 bit, stereo)
  • Volume: 100%
  • Config file: $HOME/.adonthell/adonthellrc

Definition at line 35 of file prefs.cc.


Member Function Documentation

void config::parse_arguments ( int  argc,
char *  argv[] 
)

See whether any options have been specified on the command line.

Possible command line options are

  • \-h Print help message
  • \-d Print the data directory
  • \-v Print the version number
  • \-l List games found in the gamedir
  • \-g dir Play game contained in dir
  • \-c Byte-compile all Python scripts in the current directory

Parameters:
argc argument count
argv argument vector

Definition at line 117 of file prefs.cc.

void config::write_adonthellrc (  ) 

Writes a default configuration file with the values set in the constructor.

See also:
config::config ()

Definition at line 257 of file prefs.cc.

bool config::read_adonthellrc (  ) 

Reads the configuration file.

If it cannot find the file, it tries to write a default one.

Returns:
true on success, false otherwise.

Definition at line 295 of file prefs.cc.

char * config::get_adonthellrc (  ) 

Returns the path to the user's private Adonthell directory.

Usually this is $HOME/.adonthell/ and will contain his personal configuration as well as all saved games.

Definition at line 251 of file prefs.cc.


Member Data Documentation

Language to use if NLS was compiled in.

Definition at line 126 of file prefs.h.

Name of the game that is running at present.

Definition at line 131 of file prefs.h.

Path of the directory that contains the game running at present.

Definition at line 135 of file prefs.h.

Whether the engine shall run in window (0) or fullscreen (1) mode.

Definition at line 139 of file prefs.h.

Whether the quick-load feature is enabled (1) or not (0).

Definition at line 144 of file prefs.h.

The number of channels: mono (0) or stereo (1).

Definition at line 148 of file prefs.h.

The resolution: 8 bit (0) or 16 bit (1).

Definition at line 152 of file prefs.h.

The sample rate: 11025 Hz (0), 22050 Hz (1) or 44100 Hz (2).

Definition at line 156 of file prefs.h.

The volume: a value betwen 0 and 100.

0 means that audio is completely off.

Definition at line 161 of file prefs.h.


The documentation for this class was generated from the following files:

Generated on Wed Jun 18 16:27:17 2008 for Adonthell by  doxygen 1.5.6