From c25c34c24b49c72dc22e7c17208373698d4d8969 Mon Sep 17 00:00:00 2001 From: nek0 Date: Wed, 20 Dec 2017 04:58:24 +0100 Subject: [PATCH] why doesn't it work now? --- src/InGame.hs | 4 ++-- src/Init.hs | 6 +++--- src/Main.hs | 7 +++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/InGame.hs b/src/InGame.hs index c369b4d..e5c7a44 100644 --- a/src/InGame.hs +++ b/src/InGame.hs @@ -7,7 +7,7 @@ import qualified SDL import qualified Data.Map as M import Data.Maybe (catMaybes, isJust, fromJust, isNothing) -import Control.Monad (when) +import Control.Monad (when, unless) import Control.Monad.IO.Class (liftIO) import System.Random (randomRIO) @@ -28,7 +28,7 @@ loadGame stateChange = do case SDL.keysymKeycode (msgKbdKeysym kbdev) of SDL.KeycodeSpace -> do liftIO $ logIO Debug "TODO: PEW!" - SDL.KeycodeR -> do + SDL.KeycodeR -> unless (msgKbdKeyRepeat kbdev) $ do liftIO $ logIO Debug "Reloading" putAffection ud { stateUUIDs = UUIDClean [] [] diff --git a/src/Init.hs b/src/Init.hs index fd72a07..be9b08b 100644 --- a/src/Init.hs +++ b/src/Init.hs @@ -33,13 +33,13 @@ foreign import ccall unsafe "glewInit" load :: IO UserData load = do - liftIO $ logIO A.Debug "Let's drop some Hhnts for SDL" - SDL.HintRenderDriver $= SDL.OpenGL + -- liftIO $ logIO A.Debug "Let's drop some Hints for SDL" + -- SDL.HintRenderDriver $= SDL.OpenGL liftIO $ logIO A.Debug "init GLEW" _ <- glewInit liftIO $ logIO A.Debug "loading state" liftIO $ logIO A.Debug "create context" - nvgCtx <- createGL3 (S.fromList [Antialias, StencilStrokes]) + nvgCtx <- createGL3 (S.fromList [Antialias, StencilStrokes, NanoVG.Debug]) liftIO $ logIO A.Debug "load ship image" mshipImage <- createImage nvgCtx (FileName "assets/ship.png") 0 when (isNothing mshipImage) $ do diff --git a/src/Main.hs b/src/Main.hs index 668b0a9..e90de68 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -29,8 +29,8 @@ main = do , windowTitle = "Haskelloids" , windowConfig = SDL.defaultWindow { SDL.windowOpenGL = Just SDL.defaultOpenGL - { SDL.glProfile = SDL.Core SDL.Normal 3 3 - , SDL.glColorPrecision = V4 8 8 8 8 + { SDL.glProfile = SDL.Core SDL.Normal 3 0 + , SDL.glColorPrecision = V4 0 8 8 8 } } , initScreenMode = SDL.Windowed @@ -70,6 +70,9 @@ handle e = do draw :: Affection UserData () draw = do ud <- getAffection + window <- drawWindow <$> get + pf <- liftIO $ SDL.getWindowPixelFormat window + liftIO $ logIO A.Debug $ "Window pixel format: " ++ show pf liftIO $ beginFrame (nano ud) 800 600 (800/600) smDraw (state ud) liftIO $ endFrame (nano ud)