home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Hack 1
/
GHM01.ZIP
/
WINDOW.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-07
|
2KB
|
84 lines
// Copyright (C) 1994 by Kurt Griffiths. May only be used for implementation into
// software. May not be distibuted as a library or related media for commercial
// gain.
/*-------------------------------------------------------------------------*/
/* Window object */
/*-------------------------------------------------------------------------*/
class window
{
int minx, maxx, miny, maxy, incolor, ltcolor, dkcolor, bwidth, drawnyet;
int bcolor, lines;
public:
window();
int wn_draw(int x, int xx, int y, int yy);
int wn_setcolor(int color) { incolor = color; return 1; }
int wn_setlines(int l) { lines = l; return 1; }
int wn_setbcolor(int b) { bcolor = b; return 1; }
int wn_setdcolor(int d) { dkcolor = d; return 1; }
int wn_setlcolor(int l) { ltcolor = l; return 1; }
int wn_setoutline(int o) { ltcolor = dkcolor = o; return 1; }
int wn_setwidth(int w) { bwidth = w; return 1; }
int wn_settrans(int t) { incolor = -1; return 1; }
};
window::window()
{
lines = 0;
incolor = 27;
ltcolor = 29;
dkcolor = 22;
bcolor = 25;
bwidth = 4;
}
int window::wn_draw(int x, int xx, int y, int yy)
{
int middle, inminx, inmaxx, inminy, inmaxy;
minx = x, maxx = xx, miny = y, maxy = yy;
inminx = minx + bwidth, inmaxx = maxx - bwidth;
inminy = miny + bwidth, inmaxy = maxy - bwidth;
if(incolor != -1)
{
fg_setcolor(incolor);
fg_rect(minx, maxx, miny, maxy);
}
fg_setcolor(dkcolor);
fg_box(minx, maxx, miny, maxy);
fg_box(inminx, inmaxx, inminy, inmaxy);
if(ltcolor != dkcolor)
{
fg_setcolor(ltcolor);
fg_move(minx, maxy);
fg_draw(minx, miny);
fg_draw(maxx, miny);
fg_move(inminx, inmaxy);
fg_draw(inmaxx, inmaxy);
fg_draw(inmaxx, inminy);
}
fg_setcolor(bcolor);
if(bwidth > 0) fg_paint(minx + 1, miny + 1);
if(lines > 0) // Just something x-tra
{
fg_setcolor(dkcolor);
middle = (minx + maxx) / 2;
fg_move(middle, miny);
fg_draw(middle, inminy);
fg_move(middle, maxy);
fg_draw(middle, inmaxy);
middle = (miny + maxy) / 2;
fg_move(minx, middle);
fg_draw(inminx, middle);
fg_move(maxx, middle);
fg_draw(inmaxx, middle);
}
drawnyet = 1;
return 1;
}