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

Configuration options

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

Detailed Description

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

Definition at line 74 of file prefs.h.

Constructor & Destructor Documentation

◆ config()

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 36 of file prefs.cc.

Member Function Documentation

◆ parse_arguments()

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 106 of file prefs.cc.

◆ write_adonthellrc()

void config::write_adonthellrc ( )

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

See also
config::config ()

Definition at line 253 of file prefs.cc.

◆ read_adonthellrc()

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 290 of file prefs.cc.

◆ get_adonthellrc()

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 247 of file prefs.cc.

Member Data Documentation

◆ language

string config::language

Language to use if NLS was compiled in.

Definition at line 130 of file prefs.h.

◆ game_name

string config::game_name

Name of the game that is running at present.

Definition at line 135 of file prefs.h.

◆ gamedir

string config::gamedir

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

Definition at line 139 of file prefs.h.

◆ screen_mode

u_int8 config::screen_mode

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

Definition at line 143 of file prefs.h.

◆ display

u_int8 config::display

Index of the display to use for fullscreen mode.

Definition at line 147 of file prefs.h.

◆ quick_load

u_int8 config::quick_load

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

Definition at line 151 of file prefs.h.

◆ audio_channels

u_int8 config::audio_channels

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

Definition at line 155 of file prefs.h.

◆ audio_resolution

u_int8 config::audio_resolution

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

Definition at line 159 of file prefs.h.

◆ audio_sample_rate

u_int8 config::audio_sample_rate

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

Definition at line 163 of file prefs.h.

◆ audio_volume

u_int8 config::audio_volume

The volume: a value betwen 0 and 100.

0 means that audio is completely off.

Definition at line 168 of file prefs.h.


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