]> git.sur5r.net Git - cc65/blobdiff - samples/tgidemo.c
Fixed an error in the special purpose allocator in expr.c.
[cc65] / samples / tgidemo.c
index 92121c9d93f074ef5cda3b7df3e5878e470c44ea..ccefdb5c14259ba44107833a155040ea172fc5eb 100644 (file)
@@ -5,11 +5,12 @@
 #include <ctype.h>
 #include <modload.h>
 #include <tgi.h>
+#include <tgi/tgi-kernel.h>
 
 
 
-#define COLOR_BACK     COLOR_BLACK
-#define COLOR_FORE     COLOR_WHITE
+#define COLOR_BACK     TGI_COLOR_BLACK
+#define COLOR_FORE     TGI_COLOR_WHITE
 
 
 /*****************************************************************************/
@@ -21,6 +22,7 @@
 /* Driver stuff */
 static unsigned MaxX;
 static unsigned MaxY;
+static unsigned AspectRatio;
 
 
 
@@ -57,7 +59,7 @@ static void DoWarning (void)
 
 static void DoCircles (void)
 {
-    static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_ORANGE };
+    static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_ORANGE };
     unsigned char I;
     unsigned char Color = COLOR_FORE;
     unsigned X = MaxX / 2;
@@ -70,7 +72,7 @@ static void DoCircles (void)
         tgi_line (0, MaxY, MaxX, 0);
         tgi_setcolor (Color);
         for (I = 10; I < 240; I += 10) {
-            tgi_circle (X, Y, I);
+            tgi_ellipse (X, Y, I, tgi_imulround (I, AspectRatio));
         }
        Color = Color == COLOR_FORE ? COLOR_BACK : COLOR_FORE;
     }
@@ -83,7 +85,7 @@ static void DoCircles (void)
 
 static void DoCheckerboard (void)
 {
-    static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
+    static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_BLACK };
     unsigned X, Y;
     unsigned char Color;
 
@@ -111,7 +113,7 @@ static void DoCheckerboard (void)
 
 static void DoDiagram (void)
 {
-    static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
+    static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_BLACK };
     int XOrigin, YOrigin;
     int Amp;
     int X, Y;
@@ -155,7 +157,7 @@ static void DoDiagram (void)
 
 static void DoLines (void)
 {
-    static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_BLACK };
+    static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_BLACK };
     unsigned X;
 
     tgi_setpalette (Palette);
@@ -186,10 +188,12 @@ int main (void)
     CheckError ("tgi_load_driver");
     tgi_init ();
     CheckError ("tgi_init");
+    tgi_clear ();
 
     /* Get stuff from the driver */
     MaxX = tgi_getmaxx ();
     MaxY = tgi_getmaxy ();
+    AspectRatio = tgi_getaspectratio ();
 
     /* Set the palette, set the border color */
     Border = bordercolor (COLOR_BLACK);