why doesn't it work now?

This commit is contained in:
nek0 2017-12-20 04:58:24 +01:00
parent e9a9e2cf7b
commit c25c34c24b
3 changed files with 10 additions and 7 deletions

View file

@ -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 [] []

View file

@ -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

View file

@ -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)