Introduction
Downloads
Documentation
Tutorials
Pixie Lite
Forum

Home

Platform_Win32_OS Class Reference

Inheritance diagram for Platform_Win32_OS:

Platform_OS PlatformEventListener

List of all members.


Public Member Functions

 Platform_Win32_OS (HINSTANCE hInstance, const char *commandLine)
virtual ~Platform_Win32_OS ()
virtual void SetApplicationName (const char *applicationName)
virtual const char * GetCommandLineString ()
virtual const char * GetExecutablePath ()
virtual bool HasFocus ()
virtual void OsYield ()
virtual void DisplayAssertMessage (const char *expression, const char *message, const char *file, int line)
virtual void OutputDebugText (const char *formatstr,...)
virtual void ReportFatalError (const char *message, const char *file, int line)
virtual bool ExitRequested ()
virtual void OnCustomEvent (const char *eventId, void *userData)
HWND GetWindowHandle ()

Detailed Description

Author:
Mattias Gustavsson
Todo:
Have mouse cursor revert to default when placed over the window title bar or borders

Definition at line 26 of file Platform_Win32_OS.h.


Constructor & Destructor Documentation

Platform_Win32_OS::Platform_Win32_OS ( HINSTANCE  hInstance,
const char *  commandLine 
)

Definition at line 18 of file Platform_Win32_OS.cpp.

Platform_Win32_OS::~Platform_Win32_OS (  )  [virtual]

Definition at line 68 of file Platform_Win32_OS.cpp.


Member Function Documentation

void Platform_Win32_OS::SetApplicationName ( const char *  applicationName  )  [virtual]

Sets the name of the application. This is what's displayed in the title bar of the window, if the current platform has a window. On some platforms, this method will have no effect, but it can still be called with no error. If 0 is passed to the method, the default name "Pixie Game Engine" will be used.

Implements Platform_OS.

Definition at line 112 of file Platform_Win32_OS.cpp.

const char * Platform_Win32_OS::GetCommandLineString (  )  [virtual]

If the platform supports command line parameters, and some were passed in to the application, they can be retrieved using this method. The platform specific implementation may reformat the original command line strings, such that all flags will have a dash (-) as a prefix, that long filenames containing spaces will be surrounded by quotation marks (") and that directory separators for specified paths will be forward slash (/) regardless of whatever convention was originally used on the platform. This is to make it easy to parse the command line string without knowing which platform we're currently running on.

Returns:
The command line string in platform independent format

Implements Platform_OS.

Definition at line 127 of file Platform_Win32_OS.cpp.

const char * Platform_Win32_OS::GetExecutablePath (  )  [virtual]

Sometimes, it's useful to find the path where the applications executable is stored, in case it is different from the current working directory. This method will return the full path to the executable, not including the name of the executable itself. On some platforms, this information might not be available, in which case this method will return 0.

Returns:
The path to the executable

Implements Platform_OS.

Definition at line 135 of file Platform_Win32_OS.cpp.

bool Platform_Win32_OS::HasFocus (  )  [virtual]

For windowed systems, it is possible for the app to not be the one currently receiving input. This method will return true if the application has input focus, and false if it has not. On non-windowed platforms, this method will always return true.

Returns:
True if the application has focus, false if it has not.

Implements Platform_OS.

Definition at line 143 of file Platform_Win32_OS.cpp.

void Platform_Win32_OS::OsYield (  )  [virtual]

On some platforms, it is necessary to hand control over to the OS at regular intervals (typically once per frame), for example the windows message pump. This method should be called by the game once per frame, but on some platforms, it might not do anything, while on others it might do a lot.

Not calling this method might lead to unresponsive application or unexpected side effects. When called, this method sends the "OsYield" platform event, which will be received by all platform systems which have registered for platform events.

Implements Platform_OS.

Definition at line 94 of file Platform_Win32_OS.cpp.

void Platform_Win32_OS::DisplayAssertMessage ( const char *  expression,
const char *  message,
const char *  file,
int  line 
) [virtual]

The way Assert failures are reported is different on different platforms. On some, it might be an output to stdout, on others it might be a message box providing options to abort execution or break into the debugger. This method will display the Assert message in the platform specific way. It won't test the expression, or check if this is a debug build - that's all up to the higher-level code.

Implements Platform_OS.

Definition at line 398 of file Platform_Win32_OS.cpp.

void Platform_Win32_OS::OutputDebugText ( const char *  formatstr,
  ... 
) [virtual]

It is often useful to be able to print various informational messages for debug purposes. The way this is done will be different for different platforms, so this method abstracts that functionality. OutputDebugText works just like printf, where you supply a format string, indicating where values are to be inserted using d, f etc, followed by all the values to replace those markers.

Implements Platform_OS.

Definition at line 440 of file Platform_Win32_OS.cpp.

void Platform_Win32_OS::ReportFatalError ( const char *  message,
const char *  file,
int  line 
) [virtual]

When something goes so wrong that it is impossible to continue with the execution, this method should be called. It will display the message, in whatever way makes sense for the platform, and then terminate the application. This should be reserved for really severe errors, which can't be handled by the application code.

Implements Platform_OS.

Definition at line 455 of file Platform_Win32_OS.cpp.

bool Platform_Win32_OS::ExitRequested (  )  [virtual]

Shutdown of the application is controlled by the application main-loop. But on some platforms, a request to terminate can be issued on OS-level, like when you click the Close-button on a window. When that happens, this method will return true from that point onwards, but before that, it will return false. If the application wants to handle OS-level shutdown request, it needs to check this method regularly. On some platforms, this method might never return true.

Returns:
True if the OS are requesting that the application is to be terminated, otherwise false

Implements Platform_OS.

Definition at line 390 of file Platform_Win32_OS.cpp.

void Platform_Win32_OS::OnCustomEvent ( const char *  eventId,
void *  userData 
) [virtual]

Receives a custom event, sent from a system by calling Platform::SendEvent_CustomEvent

Reimplemented from PlatformEventListener.

Definition at line 501 of file Platform_Win32_OS.cpp.

HWND Platform_Win32_OS::GetWindowHandle (  ) 

Definition at line 151 of file Platform_Win32_OS.cpp.



Pixie University and the Pixie Game Engine is created and managed by Mattias Gustavsson.
Reproduction/republishing of any material on this site without permission is strictly prohibited.