home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
datafiles
/
text
/
c_manual
/
intuition
/
colourwindow
/
example.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-27
|
4KB
|
127 lines
/***********************************************************/
/* */
/* Amiga C Encyclopedia (ACE) V3.0 Amiga C Club (ACC) */
/* ------------------------------- ------------------ */
/* */
/* Book: ACM Intuition Amiga C Club */
/* Chapter: ColourWindow Tulevagen 22 */
/* File: Example.c 181 41 LIDINGO */
/* Author: Anders Bjerin SWEDEN */
/* Date: 92-05-01 */
/* Version: 1.10 */
/* */
/* Copyright 1992, Anders Bjerin - Amiga C Club (ACC) */
/* */
/* Registered members may use this program freely in their */
/* own commercial/noncommercial programs/articles. */
/* */
/***********************************************************/
/* Include Intuition's and ColourWindow's header file: */
#include <intuition/intuition.h>
#include "ColourWindow.h"
/* ColourWindow needs both the Intuition and Graphics library: */
struct IntuitionBase *IntuitionBase = NULL;
struct GfxBase *GfxBase = NULL;
/* Declare a pointer to a Screen structure: */
struct Screen *screen = NULL;
/* Declare and initialize a NewScreen structure: */
struct NewScreen screen_data=
{
0, /* LeftEdge Should always be 0. */
0, /* TopEdge Top of the display. */
640, /* Width We are using a high resolution screen. */
200, /* Height Non-Interlaced NTSC (American) display. */
4, /* Depth 16 colours. */
0, /* DetailPen Text should be drawn with colour reg. 0 */
1, /* BlockPen Blocks should be drawn with colour reg. 1 */
HIRES, /* ViewModes High-resolution. (Non-Interlaced) */
CUSTOMSCREEN, /* Type A customized screen. */
NULL, /* Font Default font. */
"ColourWindow V1.10 By Anders Bjerin", /* Title */
NULL, /* Gadget Must for the moment be NULL. */
NULL /* BitMap No special CustomBitMap. */
};
void main();
void CleanUp();
void main()
{
UBYTE result;
/* 1. Open the Intuition Library: */
IntuitionBase = (struct IntuitionBase *)
OpenLibrary( "intuition.library", 0 );
if( IntuitionBase == NULL )
CleanUp( "Could NOT open the Intuition Library!" );
/* 2. Open the Graphics Library: */
GfxBase = (struct GfxBase *)
OpenLibrary( "graphics.library", 0 );
if( GfxBase == NULL )
CleanUp( "Could NOT open the Graphics Library!" );
/* 3. Open the screen: */
screen = (struct Screen *) OpenScreen( &screen_data );
if( screen == NULL )
CleanUp( "Could NOT open the Screen!" );
result = ColourWindow( screen, "ColourWindow V1.10", 20, 20 );
switch( result )
{
case ERROR: printf("ERROR!\n"); break;
case OK: printf("OK!\n"); break;
case CANCEL: printf("CANCEL!\n"); break;
case QUIT: printf("QUIT!\n"); break;
}
CleanUp( "THE END" );
}
/* This function will close everything that have been opened: */
void CleanUp( message )
STRPTR message;
{
if( screen )
CloseScreen( screen );
if( GfxBase )
CloseLibrary( GfxBase );
if( IntuitionBase )
CloseLibrary( IntuitionBase );
printf("%s\n", message );
exit();
}