Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members

Screen Class Reference

List of all members.

Detailed Description

Screen defines the application specific behavior for a single screen.


Examples could be: A highscore screen, a game play screen, a bonus level screen, a weapon shop screen, etc.
The order in which the Screens are to appear is defined by the ActionEngine.
The most important operations are the nextPeriod() operation which is invoked in regular intervals and is supposed to update the internal state of the Screen. And the drawAction() operation which is invoked right afterwards, and is responsible for drawing a visual representation of the current state onto the viewport Canvas.

Definition at line 50 of file Screen.h.

Public Member Functions

Lifecycle management
 Screen () SEC_GAME
 Construct a new Screen.

virtual ~Screen () SEC_GAME=0
 Destroy the Screen.

virtual void init (const Canvas *displayCanvas, const Canvas *viewportCanvas) SEC_GAME=0
 Initialize the internal state of the Screen, and prepare all assets (bitmaps, etc.)
CAUTION!!! All bitmaps need to be prepared for the Canvas on which they will later be painted.


Control flow
virtual Boolean nextPeriod () SEC_GAME=0
 Progress to the next period.

virtual UInt32 getAdvanceTimeInterval () SEC_GAME
 In what intervals shall this screen be updated?

virtual UInt32 getPauseLengthBeforeResuming () SEC_GAME
 How long shall the engine freeze the screen after resuming from a pause?

Visual representation
virtual void getDisplayProperties (DisplayProperties &displayProperties) const SEC_GAME
virtual void getViewportProperties (const Canvas *displayCanvas, ViewportProperties &viewport) const SEC_GAME=0
 Return the viewport properties that the screen needs to operate.

virtual void drawBackground (const Canvas *viewportCanvas) const SEC_GAME=0
 Draw the background of the viewport canvas.

virtual void drawAction (const Canvas *viewportCanvas, RectangleType *dirtyRectangle) SEC_GAME=0
 Draw the visual appearance of the action onto the viewport canvas.

virtual void drawFixedOverlays (const Canvas *displayCanvas) const SEC_GAME=0
 Draw any static imagery which lies outside the viewport region.

virtual void drawDynamicOverlays (const Canvas *displayCanvas) const SEC_GAME=0
 Draw any dynamic imagery which lies outside the viewport region.

Input management
virtual void receiveEvent (const EventType *evtPtr) SEC_GAME=0
 Receive an input event.

Screen properties
virtual bool enableMenu () const SEC_GAME
 Indicates whether the screen wants a menu.


Constructor & Destructor Documentation

Screen::Screen  
 

Construct a new Screen.


Caution: This is invoked BEFORE any Canvas or Display is properly set up! This makes it impossible to initialize graphics assets in the constructor. Use init() instead.

virtual Screen::~Screen   [pure virtual]
 

Destroy the Screen.


Member Function Documentation

virtual void Screen::init const Canvas   displayCanvas,
const Canvas   viewportCanvas
[pure virtual]
 

Initialize the internal state of the Screen, and prepare all assets (bitmaps, etc.)
CAUTION!!! All bitmaps need to be prepared for the Canvas on which they will later be painted.

No mixing is allowed!

virtual Boolean Screen::nextPeriod   [pure virtual]
 

Progress to the next period.

Update the internal state of your Screen, but DO NOT DRAW ANYTHING!. Only draw in your drawXXX() operations.

Returns:
True - if the Screen wants to be exited False - if the Screen wants to remain the active Screen

virtual UInt32 Screen::getAdvanceTimeInterval   [virtual]
 

In what intervals shall this screen be updated?

Returns:
the length of the interval in 1/100 seconds (default is 4: 100/4 = 25fps).

virtual UInt32 Screen::getPauseLengthBeforeResuming   [virtual]
 

How long shall the engine freeze the screen after resuming from a pause?

Returns:
the duration in 1/100 seconds (default is 0).

virtual void Screen::getDisplayProperties DisplayProperties   displayProperties const [virtual]
 

virtual void Screen::getViewportProperties const Canvas   displayCanvas,
ViewportProperties   viewport
const [pure virtual]
 

Return the viewport properties that the screen needs to operate.


This is invoked after the Display has been fully initialized, so it is OK to query Display properties within this operation.
About the viewport rectangle
Currently, only vertical limits are taken into account. Also, due to technical limitations, the height of the viewport needs to be a multiple of 8. Ignoring this rule will lead to crashes on greyscale devices!

Parameters:
displayCanvas the display canvas, which can be queried for information to calculate viewport properties
viewport the viewport properties, which need to be filled in.

virtual void Screen::drawBackground const Canvas   viewportCanvas const [pure virtual]
 

Draw the background of the viewport canvas.

It is assumed that this operation fills the entire viewport region with an image.

virtual void Screen::drawAction const Canvas   viewportCanvas,
RectangleType *    dirtyRectangle
[pure virtual]
 

Draw the visual appearance of the action onto the viewport canvas.

Parameters:
dirtyRectangle this needs to be filled in with the coordinates of the area that was actually modified by the paint operations.
Failing to do so will result in incomplete display updates

virtual void Screen::drawFixedOverlays const Canvas   displayCanvas const [pure virtual]
 

Draw any static imagery which lies outside the viewport region.

virtual void Screen::drawDynamicOverlays const Canvas   displayCanvas const [pure virtual]
 

Draw any dynamic imagery which lies outside the viewport region.

virtual void Screen::receiveEvent const EventType *    evtPtr [pure virtual]
 

Receive an input event.

The Screen can freely decide whether it wants to react to it, or not.

virtual bool Screen::enableMenu   const [virtual]
 

Indicates whether the screen wants a menu.

Returns:
true = menu enabled, false = menu disabled


The documentation for this class was generated from the following file:
Razor! Engine Developer's Guide. Copyright © by Tilo Christ. All Rights Reserved. Last updated: 31 May 2003