/* Lesson 1
 *
 * first.c
 *
 * Simple program to open a window
*/

#include <gl.h>        /* the graphics library */
#include <device.h>    /* keyboard defines and others */


main()
{
    printf("\n Starting first.c \n");

    initalize_graphics();     
    
    while(!getbutton(ESCKEY)) {   /* Cycle through main loop until ESC key is pressed */

        RGBcolor(50,50,50);       /* set the color to dark Grey */
        clear();                  /* clear the window using last color */

        cmov2(170.0, 110.0);      /* change character position */
        RGBcolor(137,255,72);     /* set color to light green */
        charstr("Hello World!");  /* print text on screen */

        swapbuffers();            
    }

    printf("\n Ending first.c \n");
}

         
/*******************************************************************/
initalize_graphics()
{
   
    prefposition(400, 900, 500, 700);    /* preset the window size, the format is */
                                         /* x1,x2,y1,y2                           */
    winopen("First");      /* Open a window and name it 'First' */
    doublebuffer();        /* Use doublebuffer mode */
    RGBmode();             /* Use RGB color mode */
    gconfig();             /* Configure the window */

}
