shapes-demo-0.1.0.0: src/EasySDL/Draw.hs
module EasySDL.Draw where
import Data.StateVar
import qualified SDL.Video.Renderer as R
import GHC.Word
import Linear.V4
white :: V4 Word8
white = V4 0xFF 0xFF 0xFF 0xFF
red :: V4 Word8
red = V4 0xFF 0x00 0x00 0xFF
green :: V4 Word8
green = V4 0x00 0x80 0x00 0xFF
blue :: V4 Word8
blue = V4 0x00 0x00 0xFF 0xFF
yellow :: V4 Word8
yellow = V4 0xFF 0xFF 0x00 0xFF
black :: V4 Word8
black = V4 0x00 0x00 0x00 0xFF
pink :: V4 Word8
pink = V4 0xFF 0x3E 0x96 0xFF
cyan :: V4 Word8
cyan = V4 0x00 0xFF 0xFF 0xFF
darkBlue :: V4 Word8
darkBlue = V4 0x00 0x00 0xA0 0xFF
lightBlue :: V4 Word8
lightBlue = V4 0xAD 0xD8 0xE6 0xFF
purple :: V4 Word8
purple = V4 0x80 0x00 0x80 0xFF
magenta :: V4 Word8
magenta = V4 0xFF 0x00 0xFF 0xFF
silver :: V4 Word8
silver = V4 0xC0 0xC0 0xC0 0xFF
grey :: V4 Word8
grey = V4 0x80 0x80 0x80 0xFF
orange :: V4 Word8
orange = V4 0xFF 0xA5 0x00 0xFF
brown :: V4 Word8
brown = V4 0xA5 0x2A 0x2A 0xFF
maroon :: V4 Word8
maroon = V4 0x80 0x00 0x00 0xFF
lime :: V4 Word8
lime = V4 0x00 0xFF 0x00 0xFF
olive :: V4 Word8
olive = V4 0x80 0x80 0x00 0xFF
clearScreen :: R.Renderer -> IO ()
clearScreen renderer = do
setColor renderer white
R.clear renderer
setColor :: R.Renderer -> V4 Word8 -> IO ()
setColor r c = R.rendererDrawColor r $= c
withBlankScreen :: R.Renderer -> IO () -> IO ()
withBlankScreen r operation = do
clearScreen r
operation
R.present r