SPR_mgrInit

Initializes the Game Framework Sprite Manager

Declaration

SPR_bitmapManager * MGLAPI SPR_mgrInit(
    MGLDC *dc)

Prototype In

gm/sprite.h

Parameters

dc

MGL device context to use

 

Return Value

Pointer to the bitmap manager for the device context.

Description

This function initializes the Sprite Manager library and sets up for storing bitmaps with the sprite manager. The device context you pass in can be any MGL device context, but usually it should be an MGL display device context or an MGL memory device context. The Sprite Manager will automatically integrogate the capabilities of the device context, and if the device context supports the creation of an offscreen device context for storing sprites in video memory, an offscreen device context will be created and managed by the sprite manager.

The sprite manager automatically does all the work to keep track of which bitmaps are loaded in video memory and which are loaded in system memory. If there is not enough video memory left to store a sprite when you add it to the Sprite Manager, that sprite is stored in system memory automatically.

Note:    When you add bitmaps to the Sprite Manager, those bitmaps are copied into the allocated buffer, so you should destroy the bitmaps when you are done. You can also optionally add bitmaps from another device context, which allows you to use a common device context to do conversion of bitmaps to the hardware color depth.

Note:    If you switch fullscreen graphics modes or you switch from fullscreen modes to windowed modes, you must call SPR_mgrExit to destroy the bitmap manager and re-initialize it with the newly created device contexts. This is necessary because the capabilities of the new device context and the amount of available offscreen video memory (if any) will be different in the new graphics mode and all the sprites will have to be re-loaded into the Sprite Manager.

See Also

SPR_mgrExit

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com