Supported Browsers Home   
MGL_putMonoImage Previous   
MGL_random Next   
External Functions Up   

MGL_quickInit

Quick initialisation function for first time MGL users.

Declaration

MGLDC * MGLAPI MGL_quickInit(
    int xRes,
    int yRes,
    int bitsPerPixel,
    int numPages)

Prototype In

mgraph.h

Parameters

xRes

Horizontal resolution for the display mode in pixels

yRes

Vertical resolution for the display mode in lines

bitsPerPixel

Color depth for the display mode

numPages

Number of display pages to use

 

Return Value

Pointer to a fullscreen display device context.

Description

This function is intended to help first time MGL users get up and running quickly. Using this utility function you can initialise the MGL for use in a fullscreen display mode with a single line of code. Note that this function will automatically bail out with an error message if any of the initialisation code fails, so you don't need to check for error conditions on return from this function.

A small 'Hello World' type application using the MGL might be coded as follows:

int main(void)
{
    MGLDC   *dc;
    event_t evt;
    font_t  *font;

    dc = MGL_quickInit(640,480,8,1);
    if ((font = MGL_loadFont("pc8x8.fnt")) == NULL)
        MGL_fatalError(MGL_errorMsg(MGL_result()));
    MGL_useFont(font);
    MGL_drawStrXY(0,0,"Hello World!");
    EVT_halt(&evt,EVT_KEYDOWN);
    MGL_exit();
}

Note:    Once you are more familiar with the MGL, we highly recommend you add proper initialisation code to your program usin MGL_init and related functions. Unless your application is running on a dedicated system, it is not usually a good idea to hard code a resolution and color depth into the application, but rather allow the user to select the mode to be used via configuration files or menus.

Note:    This function

See Also

MGL_init, MGL_exit

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