Merge branch 'master' into feature/plus4-tgi-driver
This commit is contained in:
@@ -38,8 +38,9 @@ static unsigned AspectRatio;
|
||||
static void CheckError (const char* S)
|
||||
{
|
||||
unsigned char Error = tgi_geterror ();
|
||||
|
||||
if (Error != TGI_ERR_OK) {
|
||||
printf ("%s: %d\n", S, Error);
|
||||
printf ("%s: %u\n", S, Error);
|
||||
if (doesclrscrafterexit ()) {
|
||||
cgetc ();
|
||||
}
|
||||
@@ -67,26 +68,27 @@ static void DoWarning (void)
|
||||
|
||||
static void DoCircles (void)
|
||||
{
|
||||
static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_ORANGE };
|
||||
static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_BLUE };
|
||||
unsigned char I;
|
||||
unsigned char Color = COLOR_FORE;
|
||||
unsigned X = MaxX / 2;
|
||||
unsigned Y = MaxY / 2;
|
||||
unsigned char Color = COLOR_BACK;
|
||||
const unsigned X = MaxX / 2;
|
||||
const unsigned Y = MaxY / 2;
|
||||
const unsigned Limit = (X < Y) ? Y : X;
|
||||
|
||||
tgi_setpalette (Palette);
|
||||
tgi_setcolor (COLOR_FORE);
|
||||
tgi_clear ();
|
||||
tgi_line (0, 0, MaxX, MaxY);
|
||||
tgi_line (0, MaxY, MaxX, 0);
|
||||
while (!kbhit ()) {
|
||||
tgi_setcolor (COLOR_FORE);
|
||||
tgi_line (0, 0, MaxX, MaxY);
|
||||
tgi_line (0, MaxY, MaxX, 0);
|
||||
Color = (Color == COLOR_FORE) ? COLOR_BACK : COLOR_FORE;
|
||||
tgi_setcolor (Color);
|
||||
for (I = 10; I < 240; I += 10) {
|
||||
for (I = 10; I <= Limit; I += 10) {
|
||||
tgi_ellipse (X, Y, I, tgi_imulround (I, AspectRatio));
|
||||
}
|
||||
Color = Color == COLOR_FORE ? COLOR_BACK : COLOR_FORE;
|
||||
}
|
||||
|
||||
cgetc ();
|
||||
tgi_clear ();
|
||||
}
|
||||
|
||||
|
||||
@@ -95,19 +97,19 @@ static void DoCheckerboard (void)
|
||||
{
|
||||
static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_BLACK };
|
||||
unsigned X, Y;
|
||||
unsigned char Color;
|
||||
unsigned char Color = COLOR_BACK;
|
||||
|
||||
tgi_setpalette (Palette);
|
||||
Color = COLOR_BACK;
|
||||
tgi_clear ();
|
||||
|
||||
while (1) {
|
||||
for (Y = 0; Y <= MaxY; Y += 10) {
|
||||
for (X = 0; X <= MaxX; X += 10) {
|
||||
Color = (Color == COLOR_FORE) ? COLOR_BACK : COLOR_FORE;
|
||||
tgi_setcolor (Color);
|
||||
tgi_bar (X, Y, X+9, Y+9);
|
||||
Color = Color == COLOR_FORE ? COLOR_BACK : COLOR_FORE;
|
||||
if (kbhit ()) {
|
||||
cgetc ();
|
||||
tgi_clear ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -129,8 +131,9 @@ static void DoDiagram (void)
|
||||
|
||||
tgi_setpalette (Palette);
|
||||
tgi_setcolor (COLOR_FORE);
|
||||
tgi_clear ();
|
||||
|
||||
/* Determine zero and aplitude */
|
||||
/* Determine zero and amplitude */
|
||||
YOrigin = MaxY / 2;
|
||||
XOrigin = 10;
|
||||
Amp = (MaxY - 19) / 2;
|
||||
@@ -158,7 +161,6 @@ static void DoDiagram (void)
|
||||
}
|
||||
|
||||
cgetc ();
|
||||
tgi_clear ();
|
||||
}
|
||||
|
||||
|
||||
@@ -167,19 +169,20 @@ static void DoLines (void)
|
||||
{
|
||||
static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_BLACK };
|
||||
unsigned X;
|
||||
const unsigned Min = (MaxX < MaxY) ? MaxX : MaxY;
|
||||
|
||||
tgi_setpalette (Palette);
|
||||
tgi_setcolor (COLOR_FORE);
|
||||
tgi_clear ();
|
||||
|
||||
for (X = 0; X <= MaxY; X += 10) {
|
||||
tgi_line (0, 0, MaxY, X);
|
||||
tgi_line (0, 0, X, MaxY);
|
||||
tgi_line (MaxY, MaxY, 0, MaxY-X);
|
||||
tgi_line (MaxY, MaxY, MaxY-X, 0);
|
||||
for (X = 0; X <= Min; X += 10) {
|
||||
tgi_line (0, 0, Min, X);
|
||||
tgi_line (0, 0, X, Min);
|
||||
tgi_line (Min, Min, 0, Min-X);
|
||||
tgi_line (Min, Min, Min-X, 0);
|
||||
}
|
||||
|
||||
cgetc ();
|
||||
tgi_clear ();
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +206,6 @@ int main (void)
|
||||
|
||||
tgi_init ();
|
||||
CheckError ("tgi_init");
|
||||
tgi_clear ();
|
||||
|
||||
/* Get stuff from the driver */
|
||||
MaxX = tgi_getmaxx ();
|
||||
|
||||
Reference in New Issue
Block a user