home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
056.lha
/
Four
/
display.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-11-20
|
3KB
|
112 lines
/* Four in a Row's screen, window and other display structures etc. */
extern void done();
void init_display(), set_screen(), set_window();
void set_defmap(), set_colormap();
void set_screen(new_screen, depth, title)
struct NewScreen *new_screen;
SHORT depth;
UBYTE *title;
{
new_screen-> LeftEdge = 0;
new_screen-> TopEdge = 0;
new_screen-> Width = 320*W;
new_screen-> Height = 200*H;
new_screen-> Depth = depth;
new_screen-> DetailPen = 1;
new_screen-> BlockPen = 2;
new_screen-> ViewModes = (W==2 ? HIRES : 0) | (H==2 ? LACE : 0);
if (depth == 6) {
new_screen-> ViewModes |= EXTRA_HALFBRITE;
}
new_screen-> Type = CUSTOMSCREEN;
new_screen-> Font = font;
new_screen-> DefaultTitle = title;
new_screen-> Gadgets = NULL;
new_screen-> CustomBitMap = NULL;
return;
}
void set_window(new_window, left, top, width, height, gadget, title, screen)
struct NewWindow *new_window;
SHORT left, top, width, height;
struct Gadget *gadget;
UBYTE *title;
struct Screen *screen;
{
new_window-> LeftEdge = left;
new_window-> TopEdge = top;
new_window-> Width = width;
new_window-> Height = height;
new_window-> DetailPen = 8;
new_window-> BlockPen = 1;
new_window-> IDCMPFlags = CLOSEWINDOW | ACTIVEWINDOW | MOUSEBUTTONS |
GADGETUP | MENUPICK;
new_window-> Flags = ACTIVATE | REPORTMOUSE | NOCAREREFRESH |
WINDOWDEPTH | WINDOWCLOSE | WINDOWDRAG |
SMART_REFRESH;
new_window-> FirstGadget = gadget;
new_window-> CheckMark = NULL;
new_window-> Title = title;
new_window-> Screen = screen;
new_window-> BitMap = NULL;
new_window-> MinWidth = 0;
new_window-> MinHeight = 0;
new_window-> MaxWidth = 0;
new_window-> MaxHeight = 0;
new_window-> Type = CUSTOMSCREEN;
return;
}
void init_display(left, top, width, height, depth, title)
SHORT left, top, width, height, depth;
UBYTE *title;
{
SHORT i;
static struct NewScreen new_screen;
static struct NewWindow new_window;
set_screen(&new_screen, depth, "");
if ((screen1=OpenScreen(&new_screen))==NULL) done(4);
set_window(&new_window, left, top, width, height,
&Gadget1, title, screen1);
if ((window1=OpenWindow(&new_window))==NULL) done(5);
myviewport = (struct ViewPort *)ViewPortAddress(window1);
if ((colormap = (struct ColorMap *)GetColorMap(CTSIZ))==NULL) done(6);
colortable = (USHORT *)colormap->ColorTable;
for (i=STCOL; i<CTSIZ; i++)
newcolors[i] = colortable[i];
set_defmap();
SetMenuStrip(window1, &menu1);
return;
}
void set_defmap()
{
register int i;
for (i=0; i<CTSIZ; i++)
*(colortable+i) = newcolors[i];
set_colormap();
return;
}
void set_colormap()
{
LoadRGB4(myviewport, colortable, CTSIZ);
return;
}