home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <proto/intuition.h>
- #include <proto/exec.h>
- #include <intuition/screens.h>
- #include <graphics/view.h>
-
- #define Black 0
- #define White 1
- #define Red 2
- #define Green 3
- #define Blue 4
- #define Yellow 5
- #define Purple 6
- #define Gray 7
-
- WORD colortable1[] = {
- 0x0000,
- 0x0fff,
- 0x0f00,
- 0x00f0,
- 0x025f,
- 0x0ff0,
- 0x0a0f,
- 0x0888 };
-
- WORD colortable2[] = {
- 0x0f00,
- 0x00b1,
- 0x061f,
- 0x0fac,
- 0x06fe,
- 0x0fb0,
- 0x0fff,
- 0x0c1f };
-
- UWORD chip sys_in_dat[144] = {
-
- /* Plane 0 */
-
- 0xffff, 0xffff, 0xffff, 0xffc0,
- 0xe1ff, 0xffff, 0xf81f, 0xffc0,
- 0xccff, 0xffff, 0xfe7f, 0xffc0,
- 0xc7cc, 0xe0ff, 0xfe78, 0x3fc0,
- 0xe3cc, 0xcfc0, 0xfe79, 0x9fc0,
- 0xf8cc, 0xe1ff, 0xfe79, 0x9fc0,
- 0xcce1, 0xfcff, 0xfe79, 0x9fc0,
- 0xe1f3, 0xc1ff, 0xf819, 0x9fc0,
- 0xffc7, 0xffff, 0xffff, 0xffc0,
- 0xffff, 0xffff, 0xffff, 0xffc0,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
-
- /* Plane 1 */
-
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x3fff, 0xffff, 0xffff, 0xfffc,
- 0x3fff, 0xffff, 0xffff, 0xfffc,
-
- /* Plane 2 */
-
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000
- };
-
- struct Image chip sys_in_image = {
- 0, 0,
- 62,
- 12,
- 3,
- (USHORT *)&sys_in_dat,
- 7, 0,
- NULL
- };
-
- UWORD chip sys_out_dat[144] = {
-
- /* Plane 0 */
-
- 0xffff, 0xffff, 0xffff, 0xffc0,
- 0xe1ff, 0xffff, 0xe3ff, 0xfbc0,
- 0xccff, 0xffff, 0xc9ff, 0xf3c0,
- 0xc7cc, 0xe0ff, 0x9ccc, 0xe0c0,
- 0xe3cc, 0xcfc0, 0x9ccc, 0xf3c0,
- 0xf8cc, 0xe1ff, 0x9ccc, 0xf3c0,
- 0xcce1, 0xfcff, 0xc9cc, 0xf2c0,
- 0xe1f3, 0xc1ff, 0xe3e2, 0x79c0,
- 0xffc7, 0xffff, 0xffff, 0xffc0,
- 0xffff, 0xffff, 0xffff, 0xffc0,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- /* Plane 1 */
-
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x0000, 0x0000, 0x0000, 0x003c,
- 0x3fff, 0xffff, 0xffff, 0xfffc,
- 0x3fff, 0xffff, 0xffff, 0xfffc,
- /* Plane 2 */
-
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000};
-
- struct Image chip sys_out_image = {
- 0, 0,
- 62,
- 12,
- 3,
- (USHORT *)&sys_out_dat,
- 7, 0,
- NULL };
-
- struct Gadget sys_in_gad = {
- NULL,
- 10,
- 10,
- 58,
- 10,
- GADGHIMAGE | GADGIMAGE,
- RELVERIFY | TOGGLESELECT,
- BOOLGADGET,
- (APTR)&sys_in_image,
- (APTR)&sys_out_image,
- NULL,
- NULL,
- NULL,
- 1,
- NULL
- };
-
- #define SYS_IN 1
-
- struct NewScreen NewScreen = {
- 0,135,640,65,3,
- Green,Gray,
- HIRES,
- CUSTOMSCREEN,
- NULL,
- "This test (Green/Gray test)",
- NULL,
- NULL
- };
-
- struct NewWindow NewWindow = {
- 0,
- 10,
- 120,
- 30,
- Blue,
- Yellow,
- GADGETUP|CLOSEWINDOW,
- WINDOWSIZING|WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|SIZEBRIGHT,
- &sys_in_gad,
- NULL,
- "0,10,120,30,Blue,Yellow test of window with gad",
- NULL,
- NULL,
- 10,
- 10,
- 640,
- 49,
- CUSTOMSCREEN
- };
-
- struct Screen *MyScreen;
- struct GfxBase *GfxBase;
- struct Window *MyWindow;
- struct IntuitionBase *IntuitionBase;
- void openall(), closeall(), die();
-
- main()
- {
- struct IntuiMessage *imsg;
- ULONG Class;
- APTR IAddress;
- struct Gadget *GadAddress;
-
- openall();
-
- FOREVER
- {
- Wait(1L << MyWindow->UserPort->mp_SigBit);
- while((imsg = (struct IntuiMessage *)GetMsg(MyWindow->UserPort)) != NULL)
- {
- Class = imsg->Class;
- IAddress = imsg->IAddress;
- ReplyMsg((struct Message *)imsg);
- switch (Class)
- {
- case CLOSEWINDOW:
- closeall();
- exit(0);
- break;
- case GADGETUP:
- GadAddress = (struct Gadget *)IAddress;
- if (GadAddress->GadgetID == SYS_IN)
- {
- if(GadAddress->Flags & SELECTED)
- Fade(MyScreen, colortable2, 2, 8);
- /* printf("Gad->SysIO turned on\n"); */
- else
- Fade(MyScreen, colortable1, 2, 8);
- /* printf("Gad->SysIO turned off\n"); */
- }
- break;
- default:
- break;
- }
- }
- }
- }
-
- void openall()
- {
- if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0)))
- {
- printf("Can't open graphics library\n");
- die();
- }
-
- if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0)))
- {
- printf("Can't open Intuition library... Aborting\n");
- die();
- }
-
- if((MyScreen = (struct Screen *)OpenScreen(&NewScreen)) == NULL)
- {
- printf("Can't open screen... Aborting\n");
- die();
- }
-
- SetRGB4 (&(MyScreen->ViewPort),0,0,0,0);
- SetRGB4 (&(MyScreen->ViewPort),1,0,0,0);
- SetRGB4 (&(MyScreen->ViewPort),2,0,0,0);
- SetRGB4 (&(MyScreen->ViewPort),3,0,0,0);
- SetRGB4 (&(MyScreen->ViewPort),4,0,0,0);
- SetRGB4 (&(MyScreen->ViewPort),5,0,0,0);
- SetRGB4 (&(MyScreen->ViewPort),6,0,0,0);
- SetRGB4 (&(MyScreen->ViewPort),7,0,0,0);
-
- NewWindow.Screen = MyScreen;
-
- if((MyWindow = (struct Window *)OpenWindow(&NewWindow)) == NULL)
- {
- printf("Can't open window... Aborting\n");
- die();
- }
-
- Fade(MyScreen, colortable1, 2, 8);
- }
-
- void closeall()
- {
- if(MyWindow && MyScreen)
- FadeToBlack(MyScreen, 2, 8);
- if(MyWindow)
- CloseWindow(MyWindow);
- if(MyScreen)
- CloseScreen(MyScreen);
- if(IntuitionBase)
- CloseLibrary(IntuitionBase);
- if(GfxBase)
- CloseLibrary(GfxBase);
- }
-
- void die()
- {
- closeall();
- exit (-1);
- }
-
-
-