Windows Extensions
Introduction
The core platform independent standard of OpenPTC 1.0 exposes a lot of common
functionality across a large range of different graphics platforms. However, some things,
no matter how useful, just dont make any sense in a platform independent standard so they
had to be left out.
So that users of OpenPTC can still have full access to the underlying graphics platform
functionality that they need, each distribution implements extensions to the standard.
These extensions are protected by signature defines for portability.
The signature define of OpenPTC for Windows is __PTC_WIN32__, and the signature define for
the OpenPTC for Windows extensions is __PTC_WIN32_EXTENSIONS__.
If you choose to use any of the extensions below, you should make sure that you wrap the
code with #ifdef __PTC_WIN32_EXTENSIONS__ for portability to other platforms.
You can also use the signature define __PTC_WIN32__ to wrap around the WinMain and main so
that your application is compilable on Win32 and other platforms without any changes.
Console Extensions
HWND Console::window()
- This function returns the current window handle of the console.
- This handle is only valid between open and close.
- Be careful what you do with the window handle, as you may cause problems with normal PTC
operation if you do not know what you are doing.
LPDIRECTDRAW Console::lpDD()
- This function returns a pointer to the current direct draw interface.
- This interface is only valid between open and close.
- You should in general use the lpDD, instead use the lpDD2 below.
- Be careful what you do with this interface, as you may cause problems with normal PTC
operation if you do not know what you are doing.
LPDIRECTDRAW2 Console::lpDD2()
- This function returns a pointer to the current direct draw 2 interface.
- This interface is only valid between open and close.
- You should use the lpDD2 instead of lpDD.
- Be careful what you do with this interface, as you may cause problems with normal PTC
operation if you do not know what you are doing.
LPDIRECTDRAWSURFACE Console::lpDDS()
- This function returns a pointer to the back buffer of the current direct draw primary
surface, or, if a secondary surface exists, it returns a pointer to that surface instead.
- This interface is only valid between open and close.
- Be careful what you do with this interface, as you may cause problems with normal PTC
operation if you do not know what you are doing.
LPDIRECTDRAWSURFACE Console::lpDDS_primary()
- This function returns a pointer to the primary surface (ie. the actual primary surface,
not the back buffer of the primary surface, or the secondary surface).
- This interface is only valid between open and close.
- Be careful what you do with this interface, as you may cause problems with normal PTC
operation if you do not know what you are doing.
LPDIRECTDRAWSURFACE Console::lpDDS_secondary()
- This function returns a pointer to the secondary surface the return value is NULL if a
secondary surface does not exist.
- Typically secondary surfaces exist in windowed output and in some special fullscreen
output modes.
- This interface is only valid between open and close.
- Be careful what you do with this interface, as you may cause problems with normal PTC
operation if you do not know what you are doing.
void Console::open(HWND window,int pages = 0);
void Console::open(HWND window,const Format &format,int pages = 0);
void Console::open(HWND window,int width,int height,const Format &format,int pages = 0);
void Console::open(HWND window,const Mode &mode,int pages = 0);
- This group of open functions allow you to create and manage the display window yourself
instead of having the ptc console manage the window for you.
- See the extensions example "WndProc" for an example of how to do this.
- It is highly recommended that you let the console manage the window for you unless you
absolutely need to manage the HWND yourself.