Haskell SDL binding: Why doesn't the SDL draw a circle here?

I want to use the Haskell SDL binding to draw simple objects (triangle, circles, etc.). There is a function for drawing rectangles in Graphics.UI.SDL.Video, which works fine. But I can not get the functions that I found for drawing other primitives (in Graphics.UI.SDL.Primitives) to work. The following code draws only a rectangle. Any ideas what I missed?

module Main where import Graphics.UI.SDL as SDL import Graphics.UI.SDL.Color import Graphics.UI.SDL.Primitives main = do SDL.init [SDL.InitVideo] screen <- SDL.setVideoMode 500 500 32 [SDL.HWSurface] SDL.fillRect screen Nothing (SDL.Pixel 0x0000FF) fillRect screen (Just (SDL.Rect 10 10 30 30)) (SDL.Pixel 0x00FF0000) filledCircle screen 40 40 50 (SDL.Pixel 0x00FF0000) SDL.flip screen delay 2000 SDL.quit 
+4
source share
1 answer

The color of the pixel you give fillCircle and fillRect has its alpha component set to zero; try SDL.Pixel 0x00FF00FF . fillCircle seems to respect the alpha color component, while fillRect does not seem to.

+6
source

All Articles