add background color and vignette

This commit is contained in:
nek0 2017-12-21 13:09:15 +01:00
parent 7634be434b
commit 55b5280636
2 changed files with 14 additions and 0 deletions

View file

@ -35,6 +35,7 @@ load :: IO UserData
load = do
-- liftIO $ logIO A.Debug "Let's drop some Hints for SDL"
-- SDL.HintRenderDriver $= SDL.OpenGL
GL.clearColor $= GL.Color4 0 0 0.1 1
liftIO $ logIO A.Debug "init GLEW"
_ <- glewInit
liftIO $ logIO A.Debug "loading state"

View file

@ -84,4 +84,17 @@ draw = do
-- liftIO $ logIO A.Debug $ "Window pixel format: " ++ show pf
liftIO $ beginFrame (nano ud) 800 600 1
smDraw (state ud)
drawVignette
liftIO $ endFrame (nano ud)
drawVignette :: Affection UserData ()
drawVignette = do
ctx <- nano <$> getAffection
liftIO $ do
save ctx
beginPath ctx
grad <- boxGradient ctx 200 150 400 300 0 500 (rgba 0 0 0 0) (rgba 0 0 0 255)
rect ctx 0 0 800 600
fillPaint ctx grad
fill ctx
restore ctx