Try to be more resolution independent
git-svn-id: svn://svn.cc65.org/cc65/trunk@2649 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -56,7 +56,7 @@ static unsigned YRes;
|
|||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Code */
|
/* Code */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@@ -90,15 +90,17 @@ static void DoCircles (void)
|
|||||||
static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_LIGHTRED };
|
static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_LIGHTRED };
|
||||||
unsigned char I;
|
unsigned char I;
|
||||||
unsigned char Color = 1;
|
unsigned char Color = 1;
|
||||||
|
unsigned X = XRes / 2;
|
||||||
|
unsigned Y = YRes / 2;
|
||||||
|
|
||||||
tgi_setpalette (Palette);
|
tgi_setpalette (Palette);
|
||||||
while (!kbhit ()) {
|
while (!kbhit ()) {
|
||||||
tgi_setcolor (1);
|
tgi_setcolor (1);
|
||||||
tgi_line (0, 0, 319, 199);
|
tgi_line (0, 0, XRes-1, YRes-1);
|
||||||
tgi_line (0, 199, 319, 0);
|
tgi_line (0, YRes-1, XRes-1, 0);
|
||||||
tgi_setcolor (Color);
|
tgi_setcolor (Color);
|
||||||
for (I = 10; I < 240; I += 10) {
|
for (I = 10; I < 240; I += 10) {
|
||||||
tgi_circle (160, 100, I);
|
tgi_circle (X, Y, I);
|
||||||
}
|
}
|
||||||
Color ^= 0x01;
|
Color ^= 0x01;
|
||||||
}
|
}
|
||||||
@@ -140,18 +142,21 @@ static void DoCheckerboard (void)
|
|||||||
static void DoDiagram (void)
|
static void DoDiagram (void)
|
||||||
{
|
{
|
||||||
static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
|
static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
|
||||||
unsigned X;
|
unsigned X, I;
|
||||||
|
|
||||||
tgi_setpalette (Palette);
|
tgi_setpalette (Palette);
|
||||||
tgi_setcolor (1);
|
tgi_setcolor (1);
|
||||||
tgi_line (10, 10, 10, 190);
|
tgi_line (10, 10, 10, YRes-10);
|
||||||
tgi_lineto (310, 190);
|
tgi_lineto (XRes-10, YRes-10);
|
||||||
tgi_line (8, 12, 10, 10);
|
tgi_line (8, 12, 10, 10);
|
||||||
tgi_lineto (12, 12);
|
tgi_lineto (12, 12);
|
||||||
tgi_line (308, 188, 310, 190);
|
tgi_line (XRes-12, YRes-12, XRes-10, YRes-10);
|
||||||
tgi_lineto (308, 192);
|
tgi_lineto (XRes-12, YRes-8);
|
||||||
for (X = 0; X < sizeof (SinusTable); ++X) {
|
for (I = 0, X = 10; X < XRes-10; ++X) {
|
||||||
tgi_setpixel (X+10, SinusTable[X]);
|
tgi_setpixel (X, SinusTable[I]);
|
||||||
|
if (++I >= sizeof (SinusTable)) {
|
||||||
|
I = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cgetc ();
|
cgetc ();
|
||||||
@@ -159,6 +164,7 @@ static void DoDiagram (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void DoLines (void)
|
static void DoLines (void)
|
||||||
{
|
{
|
||||||
static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
|
static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
|
||||||
@@ -167,17 +173,19 @@ static void DoLines (void)
|
|||||||
tgi_setpalette (Palette);
|
tgi_setpalette (Palette);
|
||||||
tgi_setcolor (1);
|
tgi_setcolor (1);
|
||||||
|
|
||||||
for (X = 0; X < 200; X+=10) {
|
for (X = 0; X < YRes; X+=10) {
|
||||||
tgi_line(0, 0, 200, X);
|
tgi_line (0, 0, YRes, X);
|
||||||
tgi_line(0, 0, X, 200);
|
tgi_line (0, 0, X, YRes);
|
||||||
tgi_line(200, 200, 0, 200-X);
|
tgi_line (YRes, YRes, 0, YRes-X);
|
||||||
tgi_line(200, 200, 200-X, 0);
|
tgi_line (YRes, YRes, YRes-X, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cgetc ();
|
cgetc ();
|
||||||
tgi_clear ();
|
tgi_clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
unsigned char Border;
|
unsigned char Border;
|
||||||
@@ -214,3 +222,5 @@ int main (void)
|
|||||||
printf ("Done\n");
|
printf ("Done\n");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user