summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2013-07-27 11:18:13 +0100
committerDominik Picheta <dominikpicheta@googlemail.com>2013-07-27 11:18:13 +0100
commitc5c6ef6e2beb187e4d1e1c4b67a14b67a291e6f9 (patch)
tree0c25b67164af976fd956a998e49934e6c9f90aa6
parente33af13ae39355ea3f46108d9ed1cb71ff19676e (diff)
downloadNim-c5c6ef6e2beb187e4d1e1c4b67a14b67a291e6f9.tar.gz
Fixes graphics.drawEllipse.
It failed because a Natural cannot be negative but drawEllipse tried to
set negative values to a Natural variable; this variable's type was
changed to an Int.
-rw-r--r--lib/impure/graphics.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/impure/graphics.nim b/lib/impure/graphics.nim
index f9aadf995..85eeaed42 100644
--- a/lib/impure/graphics.nim
+++ b/lib/impure/graphics.nim
@@ -360,7 +360,7 @@ proc drawEllipse*(sur: PSurface, CX, CY, XRadius, YRadius: Natural,
   ## of the ellipse.
   var 
     X, Y: Natural
-    XChange, YChange: Natural
+    XChange, YChange: Int
     EllipseError: Natural
     TwoASquare, TwoBSquare: Natural
     StoppingX, StoppingY: Natural
@@ -501,6 +501,7 @@ if sdl_ttf.Init() < 0: raiseEGraphics()
 
 when isMainModule:
   var surf = newScreenSurface(800, 600)
+
   surf.fillSurface(colWhite)
 
   # Draw the shapes
@@ -545,6 +546,8 @@ when isMainModule:
       if evk.keysym.sym == SDL.K_LEFT:
         surf.drawHorLine(395, 300, 50, colBlack)
         echo("Drawing")
+      elif evk.keysym.sym == SDL.K_ESCAPE:
+        break
       else:
         echo(evk.keysym.sym)
     of SDL.MOUSEBUTTONDOWN: