Created
December 13, 2012 01:02
-
-
Save jlamothe/4273166 to your computer and use it in GitHub Desktop.
I appear to be running into a bug with the mapRGB function in the SDL library. This code should render a white circle, but it's coming out cyan instead. The following appears to be relevant: http://stackoverflow.com/questions/3286864/why-is-this-haskell-sdl-line-cyan-when-it-should-be-white
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Graphics.UI.SDL as SDL | |
import qualified Graphics.UI.SDL.Primitives as Draw | |
main = SDL.withInit [SDL.InitEverything] $ do | |
SDL.setVideoMode 640 480 32 [SDL.Fullscreen] | |
>>= drawScreen | |
eventLoop | |
drawScreen :: SDL.Surface -> IO () | |
drawScreen s = do | |
SDL.mapRGB (SDL.surfaceGetPixelFormat s) 255 255 255 | |
>>= Draw.filledCircle s 320 240 200 | |
SDL.flip s | |
eventLoop :: IO () | |
eventLoop = SDL.pollEvent >>= eventHandler | |
eventHandler :: SDL.Event -> IO () | |
eventHandler (SDL.KeyDown _) = return () | |
eventHandler _ = eventLoop | |
-- jl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment