/* ********************************************************
Programma: Screen.c - Dimostrazione apertura schermo custom
******************************************************** */

#include <exec/types.h>
#include <intuition/intuition.h>

struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Screen  *schermo;

#define INAME "intuition.library"
#define GNAME "graphics.library"
#define LVERS 33L

struct NewScreen NSStruct = {
 0,0,          /* Origine X,Y dello schermo */
 640,512,      /* Larghezza ed altezza dello schermo */
 3,            /* Profondita' in bitplanes */
 0,1,          /* DetailPen e BlockPen */
 LACE+HIRES,   /* Modi di visualizzazione */
 CUSTOMSCREEN, /* Tipo schermo */
 NULL,         /* Puntatore alla fonte di default */
 (UBYTE *) "MioSchermo", /* Titolo */
 NULL,         /* Punta primo gadget custom */
 NULL          /* Punta struttura BitMap */
};

void gexit(coderet) /* Uscita ordinata */
LONG coderet;
{
 if ( schermo ) CloseScreen( schermo );
 if ( IntuitionBase ) CloseLibrary( IntuitionBase );
 if ( GfxBase ) CloseLibrary( GfxBase );
 exit( coderet );
}

void main() /* Funzione principale */
{
 IntuitionBase = (struct IntuitionBase*)OpenLibrary(INAME,LVERS);
 GfxBase = (struct GfxBase *) OpenLibrary( GNAME, LVERS );

 if ( !GfxBase || !IntuitionBase ) gexit( 10L );

 schermo = (struct Screen *) OpenScreen( &NSStruct );

 if ( schermo == NULL ) gexit( 11L );

 Delay( 50L * 5 );
 gexit( 0L );
}
