Main Page   Class Hierarchy   Compound List   File List   Compound Members  

KrEngine Class Reference

The core of the Kyra system. More...

#include <engine.h>

List of all members.

Public Methods

 KrEngine (SDL_Surface *screen)
 Creates an engine that renders to the entire screen. More...

 KrEngine (SDL_Surface *screen, const KrRect &bounds, const KrRGBA *extraFill)
 Sets up an engine that renders to a rectangle on the screen, instead of the entire screen. More...

 KrEngine (SDL_Surface *screen, int nWindows, const KrRect *bounds, const KrRGBA *extraFill)
 Sets up an engine that renders to multiple "windows" on the same surface. More...

KrImageTreeTree ()
 Fetch the ImageTree. More...

KrResourceVaultVault ()
 Fetch a vault. More...

int NumWindows ()
 How many windows does this engine have?

int GetWindowFromPoint (int x, int y)
 Given a point (in screen coordinates), what window is it in? -1 if none.

void Draw (bool updateRect=true, GlDynArray< KrRect > *rectangles=0)
 Once everything is ready to go, sprites and such are updated, call this method to put it all on the screen. More...

const KrRectScreenBounds (int window=0)
 Return the bounds we are drawing to. More...

const KrRectFullScreenBounds ()
 Retrun the bounds of the entire screen surface.

void InvalidateRectangle (const KrRect &rect, int window=0)
 Pass in a rectangle that should be invalidated. More...

SDL_Surface * Surface ()
 Query the surface pointer used by this engine.

void InvalidateScreen ()
 Invalidate everything and mark for repaint. Follow with call to Draw().

void QueryRenderDesc (std::string *desc)
 Get a text description of the current rendering mode.

void StartSplash (U32 msec)
 StartSplash displays the Kyra Splash screen. More...

bool UpdateSplash (U32 msec)
 Updates the splash animation. More...

void EndSplash ()
 Removes the splash screen and clears the data and resources it is using.

void FillBackground (const KrRGBA *fillColor)
 Will fill the background with the specified color before drawing Images. More...

void FillBackgroundWindow (int window, const KrRGBA *fillColor)
 Set the fill of a particular backrgound window.


Static Public Methods

void Version (int *major, int *minor, int *patch)
 Get the major, minor, and patch version of the engine.

void SetMaxOglTextureSize (int size)
 Set the maximize size of an OpenGL texture. More...

int MaxOglTextureSize ()
 Query the current max texture size. (0 is no Kyra imposed limit.).


Detailed Description

The core of the Kyra system.

Instantiate an Engine to start using the sprite engine.


Constructor & Destructor Documentation

KrEngine::KrEngine SDL_Surface *    screen
 

Creates an engine that renders to the entire screen.

Parameters:
screen  The SDL surface to use. If the surface is an OpenGL surface, Kyra will use the OpenGL library to draw with.

KrEngine::KrEngine SDL_Surface *    screen,
const KrRect   bounds,
const KrRGBA   extraFill
 

Sets up an engine that renders to a rectangle on the screen, instead of the entire screen.

Parameters:
screen  The SDL surface to use.
bounds  The area the engine will draw to.
extraFill  If this is not null, the screen not covered by the bounds will be filled with this color. This gives a background color to "extra" screen.

KrEngine::KrEngine SDL_Surface *    screen,
int    nWindows,
const KrRect   bounds,
const KrRGBA   extraFill
 

Sets up an engine that renders to multiple "windows" on the same surface.

No window may overlap another. Each window is oriented with 0,0 as its upper left hand coordinate.

Parameters:
screen  The SDL surface to use.
nWindows  The number of Kyra "windows" (viewports) to render to.
bounds  An array of rectangles that define the windows.
extraFill  If this is not null, the screen not covered by the bounds will be filled with this color. This gives a background color to "extra" screen.


Member Function Documentation

void KrEngine::Draw bool    updateRect = true,
GlDynArray< KrRect > *    rectangles = 0
 

Once everything is ready to go, sprites and such are updated, call this method to put it all on the screen.

Parameters:
updateRect  If true, SDL_UpdateRects will automatically be called in the Draw() method. Normally, this is the desired behavior. Only set to false if you will call SDL_UpdateRects, SDL_Flip, or something equivalent after you post process the buffer.
rectangles  If wish the update rectangles to be returned to the calling application, pass in a DynArray.

void KrEngine::FillBackground const KrRGBA   fillColor
 

Will fill the background with the specified color before drawing Images.

If the Images let no background screen show through, NULL should be passed in to turn this feature off for a performance improvement.

void KrEngine::InvalidateRectangle const KrRect   rect,
int    window = 0
[inline]
 

Pass in a rectangle that should be invalidated.

Only used for unusual circumstances - primarily to clear a user-draw.

const KrRect& KrEngine::ScreenBounds int    window = 0 [inline]
 

Return the bounds we are drawing to.

(Not necessarily the entire screen.) Set by the constructor.

void KrEngine::SetMaxOglTextureSize int    size [inline, static]
 

Set the maximize size of an OpenGL texture.

This is the max size of either the x or y axis, so this limits memory usage to effectively:

max texture memory used = size * size * 4

Useful to contain memory usage of large sprites. Quality, of course, will suffer if the size is constrained. Set to 0 (the default) to limit the largest size to that allowed by the driver.

Note: This is static. The effect is global.

void KrEngine::StartSplash U32    msec
 

StartSplash displays the Kyra Splash screen.

Pass in the current time in msec (can be queried from SDL_GetTicks) that is used by future calls to control the timeline.

FillBackground() needs to be on (the default) for the splash screen, unless the client provides a background screen.

KrImageTree* KrEngine::Tree   [inline]
 

Fetch the ImageTree.

Even though it lives in the Engine, the Tree will be managed by the user.

The KrImageTree returned is owned by the engine. It should not be deleted by the client code.

bool KrEngine::UpdateSplash U32    msec
 

Updates the splash animation.

The Splash is one second long, but can be displayed for any amount of time.

KrResourceVault* KrEngine::Vault   [inline]
 

Fetch a vault.

Every engine needs a vault and there is nothing special about this one, except that it is managed with the engine and will be created and deleted at the correct time.

The KrResourceVault is owned by the engine. It should not be deleted by the client code.


The documentation for this class was generated from the following file:
Generated on Mon Sep 15 12:01:11 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001