Adonthell  0.4
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:

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
argcargument count
argvargument 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

string config::language

Language to use if NLS was compiled in.

Definition at line 126 of file prefs.h.

string config::game_name

Name of the game that is running at present.

Definition at line 131 of file prefs.h.

string config::gamedir

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

Definition at line 135 of file prefs.h.

u_int8 config::screen_mode

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

Definition at line 139 of file prefs.h.

u_int8 config::quick_load

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

Definition at line 144 of file prefs.h.

u_int8 config::audio_channels

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

Definition at line 148 of file prefs.h.

u_int8 config::audio_resolution

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

Definition at line 152 of file prefs.h.

u_int8 config::audio_sample_rate

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

Definition at line 156 of file prefs.h.

u_int8 config::audio_volume

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: