home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
262.lha
/
SpriteWizard_v1.0
/
SW_Display.h
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-30
|
3KB
|
124 lines
/* Define all global library base pointers */
OpenLibs()
{
if ( ( IntuitionBase = (struct IntuitionBase *)
OpenLibrary("intuition.library",VERSION) ) == NULL )
{
printf("Cannot find intuition library! \n");
exit(1);
};
if ( ( GfxBase = (struct GfxBase *)
OpenLibrary("graphics.library",VERSION) ) == NULL )
{
printf("Cannot find graphics library! \n");
exit(1);
};
}
/* This routine draws the edit grid */
DrawGrid()
{
struct Points MyPoints;
int i,cntr;
LONG XCoord,YCoord;
YCoord = 20;
XCoord = 20;
cntr = 1;
SetAPen(Rp,COLOR04);
for ( i = 0; i < MAX_BOXES; i++ )
{
/* Assign Rectangle Info to box array */
Boxes[i].MinX = (SHORT) XCoord;
Boxes[i].MinY = (SHORT) YCoord;
Boxes[i].MaxX = (SHORT) (XCoord + BOX_WIDTH);
Boxes[i].MaxY = (SHORT) (YCoord + BOX_HEIGHT);
/* Draw empty pixel image */
MyPoints.X1 = MyPoints.X5 = Boxes[i].MinX;
MyPoints.Y1 = MyPoints.Y5 = Boxes[i].MinY;
MyPoints.X2 = Boxes[i].MaxX;
MyPoints.Y2 = Boxes[i].MinY;
MyPoints.X3 = Boxes[i].MaxX;
MyPoints.Y3 = Boxes[i].MaxY;
MyPoints.X4 = Boxes[i].MinX;
MyPoints.Y4 = Boxes[i].MaxY;
Move(Rp,XCoord,YCoord);
PolyDraw(Rp,5,(SHORT *) &MyPoints);
if ( cntr == 16 ) /* Time to move to next row? */
{
cntr = 1;
XCoord = 20;
YCoord += BOX_HEIGHT;
}
else
{
cntr++;
XCoord += BOX_WIDTH;
};
};
}
/* Set up initial display */
InitDisplay()
{
/* Open screen */
MyScreen.LeftEdge = 0;
MyScreen.TopEdge = 0;
MyScreen.Width = MAX_WIDTH;
MyScreen.Height = MAX_HEIGHT;
MyScreen.Depth = MAX_DEPTH;
MyScreen.ViewModes = HIRES | SPRITES;
MyScreen.DetailPen = COLOR04;
MyScreen.BlockPen = COLOR05;
MyScreen.Type = CUSTOMSCREEN;
MyScreen.DefaultTitle = NULL;
if ( ( ScreenPtr = OpenScreen(&MyScreen) ) == NULL )
{
printf("Cannot open your screen! \n");
exit(1);
};
/* Open window */
MyWindow.LeftEdge = 0;
MyWindow.TopEdge = 0;
MyWindow.Width = MAX_WIDTH;
MyWindow.Height = MAX_HEIGHT;
MyWindow.Screen = ScreenPtr; /* Pointer to windows screen */
MyWindow.CheckMark = NULL;
MyWindow.DetailPen = COLOR04;
MyWindow.BlockPen = COLOR05;
MyWindow.Flags = SMART_REFRESH | ACTIVATE | WINDOWCLOSE;
MyWindow.IDCMPFlags = IDCMP_FLAGS;
MyWindow.Title = (UBYTE *) " Sprite Wizard - By D. Visage ";
MyWindow.MinWidth = MyWindow.MinHeight = 0; /* Use opening values */
MyWindow.MaxWidth = MyWindow.MaxHeight = 0; /* Use opening values */
MyWindow.Type = CUSTOMSCREEN;
if ( ( WindowPtr = OpenWindow(&MyWindow) ) == NULL )
{
printf("Cannot open your window! \n");
exit(1);
};
/* Get View, RastPort, ViewPort and BitMap pointers */
V = ViewAddress();
Rp = &ScreenPtr->RastPort;
Vp = &ScreenPtr->ViewPort;
Bm = &ScreenPtr->BitMap;
/* Set default colors */
SetRGB4(Vp,COLOR00,0x0,0x0,0x0); /* Screen - Black */
SetRGB4(Vp,COLOR01,0xf,0x0,0x0); /* SPRCOL1 - Red */
SetRGB4(Vp,COLOR02,0x0,0xf,0x0); /* SPRCOL2 - Green */
SetRGB4(Vp,COLOR03,0x0,0x0,0xf); /* SPRCOL3 - Blue */
SetRGB4(Vp,COLOR04,0xf,0xf,0xf); /* Borders - White */
SetRGB4(Vp,COLOR05,0xf,0x8,0x0); /* ReqFill - Orange */
}