Forums
This is the online documentation for Colossus Entertainments Pixie Game Engine

Platform_Screen Class Reference
[Platform]

Inheritance diagram for Platform_Screen:

System Platform_Win32_Screen

List of all members.


Detailed Description

Platform abstraction.

Author:
Mattias Gustavsson
This is a platform abstraction of the physical screen, the display device. This is what you use to display things, and it is really quite simple: you simply call Present, passing it the Bitmap you want to display. The idea is that you keep drawing your sprites and background to a bitmap you have created, and every frame you call the Present method of Platform_Screen to display the results.

Platform_Screen also includes functionality to set screen size and toggle fullscreen mode. It is not guaranteed that every platform makes use of this information, so consider it more of a hint than an actual directive. What you DO have control over is the size of your own bitmap, as that is what you will be drawing to.

For platform specific behavior, please refer to the header file of the platform specific implementation of Platform_Screen.

Definition at line 35 of file Platform_Screen.h.


Public Member Functions

virtual void Present (Bitmap *bitmap, unsigned short modulate=0xffff, unsigned short backgroundColor=0x0000)=0
virtual void SetFullscreen (bool fullscreen)=0
virtual bool GetFullscreen ()=0
virtual void SetSize (int width, int height)=0
virtual int GetWidth ()=0
virtual int GetHeight ()=0
virtual void SetInterpolationMode (bool enabled)=0
virtual bool GetInterpolationMode ()=0
virtual void SetRetroFilter (bool enabled)=0
virtual bool GetRetroFilter ()=0

Member Function Documentation

virtual void Platform_Screen::Present ( Bitmap bitmap,
unsigned short  modulate = 0xffff,
unsigned short  backgroundColor = 0x0000 
) [pure virtual]

Displays the specified bitmap on the screen. This is generally implemented in the fastest way possible for the platform, and the bitmap does not have to match the screen size, as it will do what it can to make it fit (stretch/shrink with or without interpolation, depending on settings and the current platform).

Parameters:
bitmap  Bitmap to display
modulate  Optional color modifier. Every pixel of the bitmap will be multiplied by this RGB565 color value, in the fastest way possible for the platform.
backgroundColor  Optional background color. In the case where the bitmap won't fit tightly on the screen, there will be borders above/below or to the left/right (or both). They will be the RGB565 color specified here

Implemented in Platform_Win32_Screen.

virtual void Platform_Screen::SetFullscreen ( bool  fullscreen  )  [pure virtual]

Enables or disables fullscreen mode. On some platforms, it is possible to run the game in a window, instead of having it cover the whole screen (which is the default behavior, unless you specify the command line parameter -window in which case the default will be to run in windowed mode).

When the game is running in windowed mode, the values set by the SetSize method are used for the size of the window (when running in fullscreen mode, those values will be ignored, and the Bitmap passed to Present will be scaled to fill the actual screen).

On some platforms, it is possible for the user to change the window size when running in windowed mode. This will be handled automatically, and the GetWidth and GetHeight methods can be used to retrieve the current window size. If you need to override the users change, you can call SetSize to adjust the window dimensions.

Note that windowed mode might not be available on all platforms, and in that case, toggling this setting will have no effect.

Parameters:
fullscreen  True if you want the game to run in fullscreen mode, false if you want it to run in windowed mode

Implemented in Platform_Win32_Screen.

virtual bool Platform_Screen::GetFullscreen (  )  [pure virtual]

This method is used to determine if the game is running in windowed or fullscreen mode. See the SetFullscreen method for an explanation of windowed and fullscreen mode.

Returns:
True if running in fullscreen mode, False if running in windowed mode

Implemented in Platform_Win32_Screen.

virtual void Platform_Screen::SetSize ( int  width,
int  height 
) [pure virtual]

Implemented in Platform_Win32_Screen.

virtual int Platform_Screen::GetWidth (  )  [pure virtual]

Implemented in Platform_Win32_Screen.

virtual int Platform_Screen::GetHeight (  )  [pure virtual]

Implemented in Platform_Win32_Screen.

virtual void Platform_Screen::SetInterpolationMode ( bool  enabled  )  [pure virtual]

Enables or disables interpolation mode. If interpolation mode is on, it means that bitmaps of a size that doesn't match the screen size, and therefor needs to be scaled, will be interpolated using some interpolation scheme available on the platform (for example, it might use bilinear interpolation) which makes the image smoother, but a bit more blurry. If interpolation mode is off, there will be no interpolation applied to the bitmap, and it will also not be scaled by fractional amounts (meaning it might be scaled x2, x3, x4 etc, but not, for example, x2.5). You're likely to get larger border areas with interpolation turned off, but your pixels will stay sharp and crisp, with no distorting.

In general, you want to turn off interpolation if the graphics for your game falls into the "pixel art" category, and leave it on (which is the default) for highres or rendered art.

Note that interpolation might not be available on all platforms, and in that case, toggling this setting will have no effect.

Parameters:
enabled  True if you want to turn on the interpolation mode, false if you want to turn it off

Implemented in Platform_Win32_Screen.

virtual bool Platform_Screen::GetInterpolationMode (  )  [pure virtual]

This method is used to determine if interpolation mode is currently on or off. See SetInterpolationMode method for an explanation of the interpolation mode

Returns:
True if interpolation mode is on, False if interpolation mode is off

Implemented in Platform_Win32_Screen.

virtual void Platform_Screen::SetRetroFilter ( bool  enabled  )  [pure virtual]

Implemented in Platform_Win32_Screen.

virtual bool Platform_Screen::GetRetroFilter (  )  [pure virtual]

Implemented in Platform_Win32_Screen.