home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
game
/
arachnid-1.1.lha
/
Arachnid
/
Window.c
< prev
Wrap
C/C++ Source or Header
|
1993-12-27
|
4KB
|
126 lines
#include <graphics/displayinfo.h>
#include <functions.h>
struct Screen *Scr = NULL;
APTR VisualInfo = NULL;
struct Window *Wnd = NULL;
struct Menu *Menus = NULL;
struct TextAttr topaz8 = {(STRPTR)"topaz.font", 8, 0x00, 0x41};
struct NewMenu NewMenu[] = {
NM_TITLE, (STRPTR)"Game", NULL, 0, 0, NULL,
NM_ITEM, (STRPTR)"New", (STRPTR)"N", 0, 0, NULL,
NM_ITEM, (STRPTR)"Load", (STRPTR)"L", 0, 0, NULL,
NM_ITEM, (STRPTR)"Save as", (STRPTR)"A", 0, 0, NULL,
NM_ITEM, (STRPTR)"Save", (STRPTR)"S", 0, 0, NULL,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0, NULL,
NM_ITEM, (STRPTR)"Quit", (STRPTR)"Q", 0, 0, NULL,
NM_TITLE, (STRPTR)"Move", NULL, 0, 0, NULL,
NM_ITEM, (STRPTR)"Undo", (STRPTR)"U", NM_ITEMDISABLED, 0, NULL,
NM_ITEM, (STRPTR)"Replay", (STRPTR)"R", 0, 0, NULL,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0, NULL,
NM_ITEM, (STRPTR)"Deal Row", NULL, 0, 0, NULL,
NM_TITLE, (STRPTR)"Cards", NULL, 0, 0, NULL,
NM_ITEM, (STRPTR)"Display Column", (STRPTR)"D", 0, 0, NULL,
NM_ITEM, (STRPTR)"Locate Card", (STRPTR)"O", 0, 0, NULL,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0, NULL,
NM_ITEM, (STRPTR)"Hide Deal and Discard", NULL, CHECKIT|MENUTOGGLE, 0, NULL,
NM_ITEM, (STRPTR)" Cheat Level", NULL, 0, 0, NULL,
NM_SUB, (STRPTR)"none", NULL, CHECKIT|CHECKED, 6, NULL,
NM_SUB, (STRPTR)"invisible", NULL, CHECKIT, 5, NULL,
NM_SUB, (STRPTR)"full", NULL, CHECKIT, 3, NULL,
NM_ITEM, (STRPTR)"Verbose", NULL, CHECKED|CHECKIT|MENUTOGGLE, 0, NULL,
NM_ITEM, (STRPTR)"Visual Dragging", NULL, CHECKIT|MENUTOGGLE, 0, NULL,
NM_TITLE, (STRPTR)"Help", NULL, 0, 0, NULL,
NM_ITEM, (STRPTR)"About", (STRPTR)"I", 0, 0, NULL,
NM_ITEM, (STRPTR)"Help", (STRPTR)"H", 0, 0, NULL,
NM_END, NULL, NULL, 0, 0, NULL };
struct ColorSpec ScreenColors[] = {
0, 0x01, 0x0C, 0x04, /* grün */
1, 0x00, 0x00, 0x00, /* schwarz */
2, 0x0D, 0x0D, 0x0D, /* n.c.(fast) */
3, 0x0F, 0x0F, 0x0F, /* weiß */
4, 0x0E, 0x02, 0x01, /* rot */
5, 0x0A, 0x08, 0x04, /* gelb/braun */
6, 0x08, 0x06, 0x04, /* n.c. */
7, 0x09, 0x04, 0x00, /* n.c. */
~0, 0x00, 0x00, 0x00 };
UWORD DriPens[] = {~0};
long SetupScreen(void)
{
if(!(Scr = OpenScreenTags(NULL, SA_Left, 0,
SA_Top, 0,
SA_Width, 640,
SA_Height, 512,
SA_Depth, 3,
SA_Colors, &ScreenColors[0],
SA_Type, CUSTOMSCREEN,
SA_DisplayID, PAL_MONITOR_ID|HIRESLACE_KEY,
SA_Pens, &DriPens[0],
SA_Title, "Arachnid",
TAG_DONE)))
return(5);
if(!(VisualInfo = GetVisualInfo(Scr, TAG_DONE))) return(6);
return(0);
}
void CloseDownScreen(void)
{
if(VisualInfo)
{
FreeVisualInfo(VisualInfo);
VisualInfo = NULL;
}
if(Scr)
{
CloseScreen(Scr);
Scr = NULL;
}
}
long OpenWin(void)
{
if(!(Menus = CreateMenus(NewMenu, GTMN_FrontPen, 0, TAG_DONE)))
return(8);
LayoutMenus(Menus, VisualInfo, GTMN_TextAttr, &topaz8, TAG_DONE);
if(!(Wnd = OpenWindowTags( NULL,
WA_IDCMP, IDCMP_MOUSEBUTTONS|IDCMP_MENUPICK|IDCMP_VANILLAKEY|IDCMP_RAWKEY,
WA_Flags, WFLG_SMART_REFRESH|WFLG_BORDERLESS|WFLG_REPORTMOUSE|WFLG_ACTIVATE,
WA_Title, NULL,
WA_ScreenTitle, "Arachnid",
WA_CustomScreen, Scr,
WA_AutoAdjust, TRUE,
TAG_DONE )))
return(7);
SetMenuStrip(Wnd, Menus);
GT_RefreshWindow(Wnd, NULL);
return(0);
}
void CloseWin(void)
{
if(Menus)
{
ClearMenuStrip(Wnd);
FreeMenus(Menus);
Menus = NULL;
}
if(Wnd)
{
CloseWindow(Wnd);
Wnd = NULL;
}
}