Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members

# ptc::BaseConsole Class Reference

Console interface. More...

Class diagram for ptc::BaseConsole:

List of all members.

## Public Members

- virtual ~BaseConsole ()
- virtual void configure (const char file[]) = 0
- virtual const Mode* modes () = 0
- virtual void open (const char title[],int pages = 0) = 0
- virtual void open (const char title[],const Format &format,int pages = 0) = 0
- virtual void open (const char title[],int width,int height,const Format &format,int pages = 0) = 0
- virtual void open (const char title[],const Mode &mode,int pages = 0) = 0
- virtual void close () = 0
- virtual void flush () = 0
- virtual void finish () = 0
- virtual void update () = 0
- virtual void update (const Area &area) = 0
- virtual bool key () = 0
- virtual Key read () = 0
- virtual int pages () const = 0
- virtual const char* name () const = 0
- virtual const char* title () const = 0
- virtual const char* information () const = 0

## Detailed Description

Console interface.

This class provides the interface for accessing the display frame buffer and basic keyboard routines.

It extends the surface interface so that the display frame buffer memory may be accessed as a surface.

## Member Function Documentation

### virtual ptc::BaseConsole::~BaseConsole ()`[virtual]`

Virtual destructor.

### virtual void ptc::BaseConsole::configure (const char file[])`[pure virtual]`

Configures the console by reading option strings from the text file file.

If the configuration file does not exist or cannot be read, this function will fail silently. No exception will be thrown in this case.

todo: example configuration file plus explanation.

See also:
  BaseSurface::option()

Parameters:
  file - the configuration text file.

Exceptions:
  Error - An Error exception is thrown on failure.

Reimplemented in ptc::Console.

### virtual const Mode * ptc::BaseConsole::modes ()`[pure virtual]`

Returns a read only pointer to the list of display modes provided by the console.

This list contains only fullscreen display modes. If the console is not capable of fullscreen output then the mode list will be empty.

If the display platform does not provide a mode list then this list will be empty.

To iterate through the mode list start with the mode object at index zero and work your way through the mode list until you find a mode that is invalid. Do not make any assumptions about the size of the mode list. Any entries after the first invalid entry are undefined.

The following code shows how to iterate through the mode list:

                // get the console mode list
                const Mode *modes = console.modes();

                // mode index
                int index = 0;

                // iterate through all modes
                while (modes[index].valid())
                {
                    // get mode information
                    int width = modes[i].width();
                    int height = modes[i].height();
                    Format format = modes[i].format();

                    // do something...

                    // next mode
                    index ++;
                }

Returns:
  A const pointer to the list of display modes.

Exceptions:
  Error - An Error exception is thrown on failure.

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::open (const char title[], int pages = 0)`[pure virtual]`

Opens the console with the default width, height and pixel format.

Parameters:
  title - The title of the console.
  pages - The number of console pages.

Exceptions:
  Error - An Error exception is thrown on failure.

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::open (const char title[], const Format & format, int pages = 0)`[pure virtual]`

Opens the console with the default width and height, and the pixel format format.

Parameters:
  title - The title of the console.
  format - The pixel format of the console.
  pages - The number of console pages.

Exceptions:
  Error - An Error exception is thrown on failure.

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::open (const char title[], int width, int height, const Format & format, int pages = 0)`[pure virtual]`

Opens the console with the dimensions width by height, and the pixel format format.

Parameters:
  title - The title of the console.
  width - The width of the console in pixels.
  height - The height of the console in pixels.
  format - The pixel format of the console.
  pages - The number of console pages.

Exceptions:
  Error - An Error exception is thrown on failure.

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::open (const char title[], const Mode & mode, int pages = 0)`[pure virtual]`

Opens the console with the display mode mode.

If the console does not support the display mode then this function will fail by throwing a ptc::Error exception.

See also:
  BaseConsole::modes()

Parameters:
  title - The title of the console.
  mode - The console display mode.
  pages - The number of console pages.

Exceptions:
  Error - An Error exception is thrown on failure.

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::close ()`[pure virtual]`

Closes the console.

If the console is not open then this function will return immediately without reporting an error.

If the console is still locked then this function will throw a ptc::Error exception.

See also:
  BaseConsole::open()

Exceptions:
  Error - An Error exception is thrown on failure.

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::flush ()`[pure virtual]`

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::finish ()`[pure virtual]`

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::update ()`[pure virtual]`

Reimplemented in ptc::Console.

### virtual void ptc::BaseConsole::update (const Area & area)`[pure virtual]`

Reimplemented in ptc::Console.

### virtual bool ptc::BaseConsole::key ()`[pure virtual]`

Reimplemented in ptc::Console.

### virtual Key ptc::BaseConsole::read ()`[pure virtual]`

Reimplemented in ptc::Console.

### virtual int ptc::BaseConsole::pages () const`[pure virtual]`

Reimplemented in ptc::Console.

### virtual const char * ptc::BaseConsole::name () const`[pure virtual]`

Reimplemented in ptc::Console.

### virtual const char * ptc::BaseConsole::title () const`[pure virtual]`

Reimplemented in ptc::Console.

### virtual const char * ptc::BaseConsole::information () const`[pure virtual]`

Reimplemented in ptc::Console.

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

- ptc.h