SMPlayC
/*includes*/ #include <stdio.h> #include <exec/types.h> #include <exec/nodes.h> #include <exec/lists.h> #include <intuition/intuition.h> #include <proto/exec.h> #include <proto/intuition.h> #include <stdlib.h> #define LOAD 1 #define PLAY 2 /*Global Variables & Structures*/ USHORT wakeup; /* Wake me up for event */ USHORT class; /* Intu event class */ USHORT code; /* Intu event code */ APTR IAddress; int ecode; USHORT gid; struct Window *w; struct IntuiMessage *message; struct RastPort *WindowRastPort; struct Gadget *GadgetPtr; /************************* Procedures ***************************************/ void Quit(void) { CloseWindow(w); exit(ecode); } void ReactGad(void) { gid = GadgetPtr->GadgetID; switch(class) case GADGETUP: DisplayBeep(NULL); printf("GadgetID = %d",gid); } /************************ Intuition Defines ***********************************/ /*box defenition*/ SHORT BoxCoords[] = { 0,0,94,0,94,59,0,59,0,0, }; SHORT Box2Coords[] = { 94,0,0,0,0,59, }; struct Border Box2 = { 0,0,2,3,0,3,Box2Coords,NULL, }; struct Border Box = { 0,0,1,3,0,5,BoxCoords,&Box2, }; /*Text defenitions*/ struct IntuiText mytext2 = { 1,0,1,0,0,0,(BYTE *)"By Henrik Stolpe",NULL, }; struct IntuiText mytext = { 1,0,1,0,8,0,(BYTE *)"100% C!",&mytext2, }; /*Gadget Text defenitions*/ struct IntuiText Gadget2text = { 3,0,1,22,1,0,(BYTE *)"SND",NULL, }; struct IntuiText Gadgettext = { 3,0,1,22,1,0,(BYTE *)"LOAD",NULL, }; /*Gadget Border defenitions*/ SHORT Hilitecoords[] = { 80,-2,-2,-2,-2,9, }; struct Border HiliteBorder = { 0,0,2,3,JAM1,3,Hilitecoords, }; SHORT BorderCoords[] = { -2,-2,80,-2,80,9,-2,9,-2,-2, }; struct Border GadgetBorder = { 0,0,1,3,JAM1,5,BorderCoords,&HiliteBorder, }; /*Gadget defenitions*/ struct Gadget NextBoolGadget = { &AnotherNextBoolGadget, 17,40, 80,9, NULL, RELVERIFY | GADGIMMEDIATE, BOOLGADGET, (APTR)&GadgetBorder, NULL, &Gadget2text, NULL, NULL, SEND, NULL, }; struct Gadget BoolGadget = { &NextBoolGadget, 17,20, 80,9, NULL, RELVERIFY | GADGIMMEDIATE, BOOLGADGET, (APTR)&GadgetBorder, NULL, &Gadgettext, NULL, NULL, LOAD, NULL, }; /*Window defenition*/ struct NewWindow nw = { 365,15, /* Starting corner */ 264,100, /* Width, height */ 1,2, /* detail, block pens */ CLOSEWINDOW | GADGETUP, ACTIVATE | WINDOWDEPTH | WINDOWDRAG | WINDOWCLOSE, /* Window flags */ &BoolGadget, /* Pointer to first gadget */ NULL, /* Pointer to checkmark */ "TRANSMITTER V0.9 ", /* title */ NULL, /* screen pointer */ NULL, /* bitmap pointer */ 100,50,640,200, /* window not sized */ WBENCHSCREEN /* type of screen */ }; /************************ Main procedure ******************************/ void main(void) { int event; event=0; /************************ Set-Up GUI **********************************/ w = OpenWindow(&nw); WindowRastPort = w->RPort; PrintIText(WindowRastPort, &mytext,10L,80L); DrawBorder(WindowRastPort, &Box,9L,14L); /************************ Main Loop ***********************************/ FOREVER { /*Get Intuition Message*/ if ((message = (struct IntuiMessage *) GetMsg(w->UserPort)) == NULL) { Wait(1L<<w->UserPort->mp_SigBit); continue; } class = message->Class; code = message->Code; GadgetPtr = (struct Gadget *)message->IAddress; ReplyMsg((struct Message *)message); /*React On Message*/ switch(class) case CLOSEWINDOW: Quit(); ReactGad(); } }