Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RwEngine
[Initialization & Resource Management]


Modules

PlayStation 2

Data Structures

struct   RwEngineOpenParams
struct   RwMetrics
struct   RwSubSystemInfo
struct   RwVideoMode

Enumerations

enum   RwVideoModeFlag {
  rwVIDEOMODEEXCLUSIVE = 0x0001, rwVIDEOMODEINTERLACE = 0x0002, rwVIDEOMODEFFINTERLACE = 0x0004, rwVIDEOMODE_PS2_FSAASHRINKBLIT = 0x0100,
  rwVIDEOMODE_PS2_FSAAREADCIRCUIT = 0x0200, rwVIDEOMODE_XBOX_WIDESCREEN = 0x0100, rwVIDEOMODE_XBOX_PROGRESSIVE = 0x0200, rwVIDEOMODE_XBOX_FIELD = 0x0400,
  rwVIDEOMODE_XBOX_10X11PIXELASPECT = 0x0800, rwVIDEOMODEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}
enum   RwEngineInitFlag { rwENGINEINITFREELISTS = 0, rwENGINEINITNOFREELISTS = 0x1, rwENGINEINITFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }

Functions

RwUInt32  RwEngineGetVersion (void)
RwInt32  RwEngineRegisterPlugin (RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor initCB, RwPluginObjectDestructor termCB)
RwInt32  RwEngineGetPluginOffset (RwUInt32 pluginID)
RwInt32  RwEngineGetNumSubSystems (void)
RwSubSystemInfo RwEngineGetSubSystemInfo (RwSubSystemInfo *subSystemInfo, RwInt32 subSystemIndex)
RwInt32  RwEngineGetCurrentSubSystem (void)
RwBool  RwEngineSetSubSystem (RwInt32 subSystemIndex)
RwInt32  RwEngineGetNumVideoModes (void)
RwVideoMode RwEngineGetVideoModeInfo (RwVideoMode *modeinfo, RwInt32 modeIndex)
RwInt32  RwEngineGetCurrentVideoMode (void)
RwBool  RwEngineSetVideoMode (RwInt32 modeIndex)
RwInt32  RwEngineGetTextureMemorySize (void)
RwInt32  RwEngineGetMaxTextureSize (void)
RwBool  RwEngineSetFocus (RwBool enable)
RwMetrics RwEngineGetMetrics (void)
RwBool  RwEngineStop (void)
RwBool  RwEngineStart (void)
RwBool  RwEngineClose (void)
RwBool  RwEngineOpen (RwEngineOpenParams *initParams)
RwBool  RwEngineTerm (void)
RwBool  RwEngineInit (const RwMemoryFunctions *memFuncs, RwUInt32 openFlags, RwUInt32 resArenaSize)

Detailed Description

Device handling.

RwEngine Overview

Requirements

Overview

This object exposes RenderWare Graphics engine. The engine manages:

All RenderWare Graphics applications must Initialize, Open, then Start the RenderWare Graphics Engine before entering their main loop.

All plugins must be registered - by calling their respective "PluginAttach()" functions - prior to calling RwEngineStart.


Enumeration Type Documentation

enum RwEngineInitFlag
 

RwEngineInitFlag Engine initialization flags. An application can use these to control the memory manager that RenderWare uses for dynamic memory management. By default RenderWare uses FreeLists. This is the preferred way of using RenderWare. If the application does not want RenderWare to use the memory manager, then the application can pass rwENGINEINITNOFREELISTS as the argument to RwEngineInit and RenderWare will replace freelist calls to corresponding calls to RwMalloc and RwFree. This will result in more memory management related calls.

Enumeration values:
rwENGINEINITFREELISTS  Use Freelists
rwENGINEINITNOFREELISTS  Don't use Freelists
enum RwVideoModeFlag
 

RwVideoModeFlag These flags specify the type of display that RenderWare will use. The flags may be OR'd together to build composite modes. Note that not all modes are supported on all platforms.

Enumeration values:
rwVIDEOMODEEXCLUSIVE  Exclusive (i.e. full-screen)
rwVIDEOMODEINTERLACE  Interlaced
rwVIDEOMODEFFINTERLACE  Flicker Free Interlaced
rwVIDEOMODE_PS2_FSAASHRINKBLIT  Full-screen antialiasing mode 0
rwVIDEOMODE_PS2_FSAAREADCIRCUIT  Full-screen antialiasing mode 1

Function Documentation

RwBool RwEngineClose void   
 

RwEngineClose closes the RenderWare Graphics engine by releasing the currently selected rendering subsystem (graphics device). This function must only be called after the rendering engine has been stopped.

Note the sequence of function calls used to run-up and run-down the RenderWare Graphics engine is as follows: RwEngineInit, RwEngineOpen, RwEngineStart to run-up and RwEngineStop, RwEngineClose, RwEngineTerm to run-down.

Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineInit , RwEngineOpen , RwEngineStart , RwEngineStop , RwEngineTerm
RwInt32 RwEngineGetCurrentSubSystem void   
 

RwEngineGetCurrentSubSystem retrieves the index of the currently selected rendering subsystem (graphics device). This function should only be called after the engine has been opened.

Returns:
Returns an RwInt32 value equal to the current rendering subsystem if successful or -1 if there is an error.
See also:
RwEngineGetNumSubSystems , RwEngineGetNumVideoModes , RwEngineGetCurrentVideoMode , RwEngineGetSubSystemInfo , RwEngineGetVideoModeInfo , RwEngineOpen
RwInt32 RwEngineGetCurrentVideoMode void   
 

RwEngineGetCurrentVideoMode retrieves the index of the currently selected video mode. This function should only be called after the engine has been opened.

Returns:
Returns an RwInt32 value equal to the current video mode if successful or -1 if there is an error.
See also:
RwEngineGetNumSubSystems , RwEngineGetNumVideoModes , RwEngineGetCurrentSubSystem , RwEngineGetSubSystemInfo , RwEngineGetVideoModeInfo , RwEngineOpen
RwInt32 RwEngineGetMaxTextureSize void   
 

RwEngineGetMaxTextureSize determines the maximum dimensions of textures allocatable with this device.

Returns:
Returns an RwInt32 value giving the maximum dimension (in texels) of textures that may be allocated. Returns -1 if the query failed.
See also:
RwEngineGetTextureMemorySize
RwMetrics* RwEngineGetMetrics void   
 

RwEngineGetMetrics gets metrics from RenderWare Graphics to evaluate the performance of the system. Information such as current polygon and vertex throughput, and cache swapping occurring in the resource arena and texture cache (if applicable) is available. Metrics are only available on a metrics build.

Note: The metrics structure is an accumulated value since the last RwCameraShowRaster or RwRasterShowRaster, and is most useful when examined immediately before calls to these functions.

Returns:
Returns a pointer to the metrics data block, or NULL on failure.
RwInt32 RwEngineGetNumSubSystems void   
 

RwEngineGetNumSubSystems determines the number of rendering subsystems (graphics devices) currently available on the platform the RenderWare Graphics engine is running. This function should only be called after the engine has been opened.

Returns:
Returns an RwInt32 value equal to the number of rendering subsystems if successful or -1 if there is an error.
See also:
RwEngineGetNumVideoModes , RwEngineGetCurrentSubSystem , RwEngineGetCurrentVideoMode , RwEngineGetSubSystemInfo , RwEngineGetVideoModeInfo , RwEngineOpen
RwInt32 RwEngineGetNumVideoModes void   
 

RwEngineGetNumVideoModes determines the number of video modes available in the currently selected rendering subsystem (graphics device). This function should only be called after the engine has been opened.

Returns:
Returns an RwInt32 value equal to the number of video modes if successful or -1 if there is an error.
See also:
RwEngineGetNumSubSystems , RwEngineGetCurrentSubSystem , RwEngineGetCurrentVideoMode , RwEngineGetSubSystemInfo , RwEngineOpen
RwInt32 RwEngineGetPluginOffset RwUInt32    pluginID
 

RwEngineGetPluginOffset gets the offset of a previously registered RenderWare Graphics engine plugin.

Parameters:
pluginID  An RwUInt32 value equal to the plugin ID.
Returns:
Returns an RwInt32 value equal to the data block offset if successful or -1 if the plugin is not registered.
See also:
RwEngineRegisterPlugin
RwSubSystemInfo* RwEngineGetSubSystemInfo RwSubSystemInfo   subSystemInfo,
RwInt32    subSystemIndex
 

RwEngineGetSubSystemInfo retrieves information about the rendering subsystem (graphics device) corresponding to the specified index. This function should only be called after the engine has been opened.

Parameters:
subSystemInfo  Pointer to an RwSubSystemInfo value that will receive the information.
subSystemIndex  An RwInt32 value equal to the index of the subsystem.
Returns:
Returns pointer to the RwSubSystemInfo value if successful or NULL if there is an error.
See also:
RwEngineGetNumSubSystems , RwEngineGetNumVideoModes , RwEngineGetCurrentSubSystem , RwEngineGetCurrentVideoMode , RwEngineGetVideoModeInfo , RwEngineOpen
   The sequence to print out the identifying names of all graphics devices
   on a particular platform is as follows:

   RwInt32 numSubSystems, i;
   RwSubSystemInfo ssInfo;

   numSubSystems = RwEngineGetNumSubSystems();

   for(i=0; i<numSubSystems; i++)
   {
       RwSubSystemInfo ssInfo;

       if( RwEngineGetSubSystemInfo(&ssInfo, i) )
       {
           printf("SubSystem %d: %s\n", i, ssInfo.name );
       }
   }
   
RwInt32 RwEngineGetTextureMemorySize void   
 

RwEngineGetTextureMemorySize determines the amount of available texture memory.

Returns:
Returns an RwInt32 value giving the number of bytes available for allocation to textures. Returns -1 if the query failed.
See also:
RwEngineGetMaxTextureSize
RwUInt32 RwEngineGetVersion void   
 

RwEngineGetVersion determines the version of the RenderWare Graphics engine. The version number is returned as a 5 digit hex number where the first three digits represent the RenderWare Graphics SDK release number, and the last two are binary stream format revision number (zero for an official release). For example, the version 0x31001 corresponds to 3.1.0.1 (SDK 3.1.0, binary revision 1).

Prior to version 3.1.0.1, this function returned the three digit SDK number only.

Note that the engine must be initialized before using this function.

Returns:
Returns a value containing the version number.
See also:
RwEngineGetNumSubSystems , RwEngineGetNumVideoModes , RwEngineGetCurrentSubSystem , RwEngineGetCurrentVideoMode , RwEngineGetSubSystemInfo , RwEngineGetVideoModeInfo , RwEngineInit
RwVideoMode* RwEngineGetVideoModeInfo RwVideoMode   modeinfo,
RwInt32    modeIndex
 

RwEngineGetVideoModeInfo retrieves information about the video mode in the current rendering subsystem (graphics device) corresponding to the specified index. This function should only be called after the engine has been opened.

Parameters:
modeinfo  Pointer to an RwVideoMode value that will receive the information.
modeIndex  An RwInt32 value equal to the index of the video mode.
Returns:
Returns a pointer to the RwVideoMode value if successful or NULL if there is an error.
See also:
RwEngineGetNumSubSystems , RwEngineGetNumVideoModes , RwEngineGetCurrentSubSystem , RwEngineGetCurrentVideoMode , RwEngineGetSubSystemInfo , RwEngineOpen
   The sequence to print out all the video modes for the current graphics
   device is as follows:

   RwInt32 numVideoModes, j;
   RwVideoMode vmodeInfo;

   numVideoModes = RwEngineGetNumVideoModes();

   for(j=0; j<numVideoModes; j++)
   {
       if( RwEngineGetVideoModeInfo(&vmodeInfo, j) )
       {
           printf("Video Mode %d: %dx%dx%d %s\n", j,
               vmodeInfo.width, vmodeInfo.height, vmodeInfo.depth,
              (vmodeInfo.flags & rwVIDEOMODEEXCLUSIVE ? "(EXCLUSIVE)" : "") );
       }
   }
   
RwBool RwEngineInit const RwMemoryFunctions   memFuncs,
RwUInt32    openFlags,
RwUInt32    resArenaSize
 

RwEngineInit initializes the core of the RenderWare Graphics rendering engine.

This function must be called before any other RenderWare function except functions listed in RwFreeList Overview.

This function may also be used to specify an alternative interface that RenderWare Graphics will use for memory management. If specified, RenderWare Graphics will use the supplied memory allocation routines rather than the default standard library ones. Specifying NULL for this parameter forces the default ones to be used.

Similarly, a default file system interface is initialized by RwEngineInit.

Note the sequence of function calls used to run-up and run-down the RenderWare Graphics engine is as follows: RwEngineInit, RwEngineOpen, RwEngineStart to run-up and RwEngineStop, RwEngineClose, RwEngineTerm to run-down.

Note that the purpose of FreeLists is to improve memory management performance. It is recommended that developers benchmark their applications with and without the use of FreeLists. FreeLists should be used if possible.

Note too that ultimately RenderWare Graphics FreeLists make use of the memory functions supplied as the first parameter. Most customers will want to use FreeLists as they increase performance.

Running RenderWare Graphics without Freelists is allowed purely to help developers observe memory usage since calls to RwMalloc are easily hooked.

Parameters:
memFuncs  Pointer to an RwMemoryFunctions value specifying the memory management interface (specify NULL to use the default interface).
openFlags  Additional parameters for the Initialization of RenderWare Graphics. Currently the only flag is whether to use Freelists or not. A value of rwENGINEINITNOFREELISTS can be used to tell RenderWare Graphics to use RwMalloc and RwFree in place of RwFreeListAlloc and RwFreeListFree.
resArenaSize  An RwUInt32 specifying the size of the memory block (in bytes) reserved for the resources instancing arena. Can be set to zero if no instance data will be used
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineOpen , RwEngineStart , RwEngineStop , RwEngineClose , RwEngineTerm , RwOsGetMemoryInterface , RwOsGetFileInterface
RwBool RwEngineOpen RwEngineOpenParams   initParams
 

RwEngineOpen initializes the default rendering subsystem (graphics device) and video mode. The device is opened on the specified display. Once the device has been opened use the API functions RwEngineSetSubSystem and RwEngineSetVideoMode to set the display device, as appropriate.

This function must only be called after the rendering engine has been initialized.

Note the sequence of function calls used to run-up and run-down the RenderWare Graphics engine is as follows: RwEngineInit, RwEngineOpen, RwEngineStart to run-up and RwEngineStop, RwEngineClose, RwEngineTerm to run-down.

Parameters:
initParams  A pointer to the RwEngineOpenParams value describing a device-dependent parameter (see example below)
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineInit , RwEngineStart , RwEngineStop , RwEngineClose , RwEngineTerm , RwEngineSetSubSystem , RwEngineSetVideoMode
   To open the RenderWare Graphics engine from a Windows application. The variable
   hwnd is a Windows device handle returned from CreateWindow (type HWND).
   Assume the engine has been initialized:

   RwEngineOpenParams openParams;

   openParams.displayID = hwnd;
   if( !RwEngineOpen(&openParams) )
   {
       RwEngineTerm();
       fprintf(stderr, "RwEngineOpen failed\n");
       ...
  }
  
RwInt32 RwEngineRegisterPlugin RwInt32    size,
RwUInt32    pluginID,
RwPluginObjectConstructor    initCB,
RwPluginObjectDestructor    termCB
 

The functionRwEngineRegisterPlugin registers a plugin and reserves some space within the global engine space. This must happen after the engine has been initialized but before the engine is opened and is the mechanism for adding plugins to RenderWare Graphics. The global data is initialized using the specified object constructor when RwEngineStart is called. Note that a NULL return value from the constructor will cause RwEngineStart to fail.

Parameters:
size  An RwInt32 value equal to the size of the memory block to reserve.
pluginID  An RwInt32 value equal to the plugin ID (must be unique - used to identify binary chunks).
initCB  A constructor for the plugin data block.
termCB  A destructor for the plugin data block.
Returns:
Returns an RwInt32 value equal to the byte offset within the engine global variables of memory reserved for this plugin or -1 if there is an error.
See also:
RwEngineGetPluginOffset , RwEngineInit
RwBool RwEngineSetFocus RwBool    enable
 

RwEngineSetFocus changes the focus properties of the currently selected rendering subsystem (graphics device). Use this function to grab or release the current device focus. This function is especially useful for full screen applications.

Parameters:
enable  An RwBool value equal to the focus action:
  • TRUE - Grab focus.
  • FALSE - Release focus.
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineSetVideoMode , RwEngineGetCurrentVideoMode , RwEngineGetNumVideoModes , RwEngineGetVideoModeInfo
RwBool RwEngineSetSubSystem RwInt32    subSystemIndex
 

RwEngineSetSubSystem is used to set the current rendering subsystem (graphic device) to the subsystem with the specified index. The rendering subsystem can only be set after the RenderWare Graphics engine has been opened.

Parameters:
subSystemIndex  An RwInt32 value equal to the subsystem's index
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineGetNumSubSystems , RwEngineGetNumVideoModes , RwEngineGetCurrentSubSystem , RwEngineGetCurrentVideoMode , RwEngineGetSubSystemInfo , RwEngineGetVideoModeInfo , RwEngineOpen
RwBool RwEngineSetVideoMode RwInt32    modeIndex
 

RwEngineSetVideoMode sets the current video mode to the video mode with the specified index. The video mode can only be set after the RenderWare Graphics engine has been opened.

Parameters:
modeIndex  An RwInt32 value equal to the video mode's index
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineGetNumSubSystems , RwEngineGetNumVideoModes , RwEngineGetCurrentSubSystem , RwEngineGetCurrentVideoMode , RwEngineGetSubSystemInfo , RwEngineGetVideoModeInfo , RwEngineOpen
RwBool RwEngineStart void   
 

RwEngineStart starts the RenderWare Graphics engine. This function must only be called after the rendering engine has been initialized and opened (in that order). This function also initializes the memory requested by all registered plugins.

Note the sequence of function calls used to run-up and run-down the RenderWare Graphics engine is as follows: RwEngineInit, RwEngineOpen, RwEngineStart to run-up and RwEngineStop, RwEngineClose, RwEngineTerm to run-down.

A NULL return value from any of the registered plugin object constructors will cause this function to fail.

Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineInit , RwEngineOpen , RwEngineStop , RwEngineClose , RwEngineTerm
RwBool RwEngineStop void   
 

RwEngineStop stops the RenderWare Graphics engine. This function must be called before any attempt is made to close (and then terminate, if required) the rendering engine.

Note the sequence of function calls used to run-up and run-down the RenderWare Graphics engine is as follows: RwEngineInit, RwEngineOpen, RwEngineStart to run-up and RwEngineStop, RwEngineClose, RwEngineTerm to run-down.

Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineInit , RwEngineOpen , RwEngineStart , RwEngineClose , RwEngineTerm
RwBool RwEngineTerm void   
 

RwEngineTerm terminates the RenderWare Graphics engine. Before termination, the engine must first be stopped and then closed (in that order). This function should be called before the application closes down.

Note the sequence of function calls used to run-up and run-down the RenderWare Graphics engine is as follows: RwEngineInit, RwEngineOpen, RwEngineStart to run-up and RwEngineStop, RwEngineClose, RwEngineTerm to run-down.

Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineInit , RwEngineOpen , RwEngineStart , RwEngineStop , RwEngineClose

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:13 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)