| Home
| Previous
| Next
| Up

GM_init

initializes the Game Framework

Declaration

GMDC * MGLAPI GM_init(
const char *windowTitle)

Prototype In

gm/gm.h

Parameters

windowTitle | Title for window in windowed modes and on task bar

Return Value

Pointer to the game framework context object

Description

This function initializes the Game Framework and must be called before you attempt to set a graphics mode. Once this function has been called, the Game Framework will have enumerated all the available graphics modes and stored this information into the modeList field of the GMDC structure returned from this function. It is then up to the application to find a suitable mode and initialized it with a call to GM_setMode.

Before you can do anything useable with the Game Framework, after you have called the GM_init function, you must then register a number of function callbacks with the Game Framework that it will call to implement the 'body' of the game (similar to C++ virtual functions, but in C). Two of the most important are GM_setDrawFunc and GM_setGameLogicFunc. If you want to respond to keyboard commands you will probably also want to call GM_setKeyDownFunc as well.

Note: The Game Framework is responsible for creating the main window used by the game. Hence the value you pass in for windowTitle will be the main title for your games window in windows modes, as well as the title that the user will see when your game is minimised to the task bar in Windows 95 and Windows NT 4.0.

Note: The Game Framework only creates and maintains a single window for the life of the game, and on switches between windowed and fullscreen modes will automatically change the attributes of the main window for the appropriate mode. This way your game only needs to register a single main window with DirectSound and other DirectX components during initialization time, and avoids the problems of re-starting DirectSound during mode switches (and hence you sound can continue to play as you switch on the fly between resolutions and fullscreen and windowed modes).

See Also

GM_setDriverOptions, GM_setMode, GM_setDrawFunc, GM_setGameLogicFunc

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