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

# ptc Namespace Reference

OpenPTC C++ namespace. More...

## Compounds

- class Key
- class Area
- class Copy
- class Mode
- class Clear
- class Color
- class Error
- class Timer
- class Format
- class Clipper
- class Palette
- class Surface
- class Console
- class BaseSurface
- class BaseConsole

## Typedefs

- typedef unsigned char char8
- typedef unsigned short short16
- typedef unsigned int int32

## Detailed Description

OpenPTC C++ namespace.

Including "ptc" will bring in the newest ANSI C++ standard interface with namespaces, and including "ptc.h" will bring all classes and typedefs into the global namespace.

ANSI C++ compilers may use the "ptc" namespace:

        #include "ptc"

        using ptc::Error;
        using ptc::Format;
        using ptc::Surface;
        using ptc::Console;

        int main()
        {
            try
            {
                // create format
                Format format(32,0x00FF0000,0x0000FF00,0x000000FF);

                // create surface
                Surface surface(320,200,format);

                // create console
                Console console;

                // open console
                console.open("Example program",320,200,format);

                // ...
            }
            catch (Error &error)
            {
                // report error
                error.report();
            }
        }

However, older compilers that do not support namespaces have to work in the global namespace:

        #include "ptc.h"

        int main()
        {
            try
            {
                // create format
                Format format(32,0x00FF0000,0x0000FF00,0x000000FF);

                // create surface
                Surface surface(320,200,format);

                // create console
                Console console;

                // open console
                console.open("Example program",320,200,format);

                // ...
            }
            catch (Error &error)
            {
                // report error
                error.report();
            }
        }

## Typedef Documentation

### ptc::char8

An unsigned 8 bit value.

### ptc::short16

An unsigned 16 bit value.

### ptc::int32

An unsigned 32 bit value.