MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
Mezzanine::crossplatform Namespace Reference

All functionality that needs different implemenations per platform will go in here. More...

Functions

Whole GetCPUCount ()
 Get the amount of logical processors, a reasononable amount to use for thread creation. More...
 
String GetPlatform ()
 Gets the platform currently being run on. More...
 
MaxInt GetTimeStamp ()
 Get a timestamp. More...
 
Whole GetTimeStampResolution ()
 Get the resolution of the timestamp in microseconds. More...
 
void SanitizeWindowedRes (const Whole &Width, const Whole &Height, Whole &ActualWidth, Whole &ActualHeight)
 Gets cleaned dimensions for a game window. More...
 

Detailed Description

All functionality that needs different implemenations per platform will go in here.

If we did our jobs right You not need to change anything to compile on different platforms exvept the build target. If you want, the platform can be manually defined in this section and this should be the only place that you need to change to compile this on a supported platform. Just remark all the lines that are not your platform using "//" and unremark your platform.

Should you choose to port this to your platform, make sure that all the required libraries are installed, then make sure to write an implementation for each of the functions in crossplatform.cpp, then you should get to the nitty gritty of making the minor platforms inconsistencies work.

For most games there will be no need to directly call these functions, however if you decide you game is an exception, there is one key thing to remember about all of these functions. All of these may perform/behave slightly differently.

Function Documentation

Whole Mezzanine::crossplatform::GetCPUCount ( )

Get the amount of logical processors, a reasononable amount to use for thread creation.

This returns whatever your OS thinks is the count of CPUs. This could include Hyperthreading unit on Intel's chip, or it might not, it could include the threads from Niagra CPUs or it might not, it could return just about any value on a given piece of and should return a reasonable value for how many threads should be used.

Returns
A Whole containing the amount of processors.

Definition at line 111 of file crossplatform.cpp.

String Mezzanine::crossplatform::GetPlatform ( )

Gets the platform currently being run on.

Returns
Returns a string based on the platform. "Windows", "Linux", or "MacOSX".

Definition at line 78 of file crossplatform.cpp.

MaxInt Mezzanine::crossplatform::GetTimeStamp ( )

Get a timestamp.

Warning
On some platforms this requires a static initialization, an can cause undefined behavior if called before static initializations are complete
Returns
The largest size integer containing a timestamp that can be compared to other timestamps, but hads no guarantees for external value.

Definition at line 105 of file crossplatform.cpp.

Whole Mezzanine::crossplatform::GetTimeStampResolution ( )

Get the resolution of the timestamp in microseconds.

Returns
A Whole which returns in millionths of a second the smallest unit of time that GetTimeStamp can measure.

Definition at line 108 of file crossplatform.cpp.

void Mezzanine::crossplatform::SanitizeWindowedRes ( const Whole &  Width,
const Whole &  Height,
Whole &  ActualWidth,
Whole &  ActualHeight 
)

Gets cleaned dimensions for a game window.

Parameters
WidthThe desired width of the window area.
HeightThe desired height of the window area.
ActualWidthThe modified value of the rendering width, after window decorations have been taken into account.
ActualHeightThe modified value of the rendering height, after window decorations have been taken into account.

Definition at line 91 of file crossplatform.cpp.