From 55b5280636d12084f798450f36ba0526ea5b59e0 Mon Sep 17 00:00:00 2001 From: nek0 Date: Thu, 21 Dec 2017 13:09:15 +0100 Subject: [PATCH] add background color and vignette --- src/Init.hs | 1 + src/Main.hs | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/Init.hs b/src/Init.hs index d377e12..c60c7c4 100644 --- a/src/Init.hs +++ b/src/Init.hs @@ -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" diff --git a/src/Main.hs b/src/Main.hs index 41171b4..6b119a0 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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