why doesn't it work now?
This commit is contained in:
parent
e9a9e2cf7b
commit
c25c34c24b
3 changed files with 10 additions and 7 deletions
|
@ -7,7 +7,7 @@ import qualified SDL
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Maybe (catMaybes, isJust, fromJust, isNothing)
|
import Data.Maybe (catMaybes, isJust, fromJust, isNothing)
|
||||||
|
|
||||||
import Control.Monad (when)
|
import Control.Monad (when, unless)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
|
||||||
import System.Random (randomRIO)
|
import System.Random (randomRIO)
|
||||||
|
@ -28,7 +28,7 @@ loadGame stateChange = do
|
||||||
case SDL.keysymKeycode (msgKbdKeysym kbdev) of
|
case SDL.keysymKeycode (msgKbdKeysym kbdev) of
|
||||||
SDL.KeycodeSpace -> do
|
SDL.KeycodeSpace -> do
|
||||||
liftIO $ logIO Debug "TODO: PEW!"
|
liftIO $ logIO Debug "TODO: PEW!"
|
||||||
SDL.KeycodeR -> do
|
SDL.KeycodeR -> unless (msgKbdKeyRepeat kbdev) $ do
|
||||||
liftIO $ logIO Debug "Reloading"
|
liftIO $ logIO Debug "Reloading"
|
||||||
putAffection ud
|
putAffection ud
|
||||||
{ stateUUIDs = UUIDClean [] []
|
{ stateUUIDs = UUIDClean [] []
|
||||||
|
|
|
@ -33,13 +33,13 @@ foreign import ccall unsafe "glewInit"
|
||||||
|
|
||||||
load :: IO UserData
|
load :: IO UserData
|
||||||
load = do
|
load = do
|
||||||
liftIO $ logIO A.Debug "Let's drop some Hhnts for SDL"
|
-- liftIO $ logIO A.Debug "Let's drop some Hints for SDL"
|
||||||
SDL.HintRenderDriver $= SDL.OpenGL
|
-- SDL.HintRenderDriver $= SDL.OpenGL
|
||||||
liftIO $ logIO A.Debug "init GLEW"
|
liftIO $ logIO A.Debug "init GLEW"
|
||||||
_ <- glewInit
|
_ <- glewInit
|
||||||
liftIO $ logIO A.Debug "loading state"
|
liftIO $ logIO A.Debug "loading state"
|
||||||
liftIO $ logIO A.Debug "create context"
|
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"
|
liftIO $ logIO A.Debug "load ship image"
|
||||||
mshipImage <- createImage nvgCtx (FileName "assets/ship.png") 0
|
mshipImage <- createImage nvgCtx (FileName "assets/ship.png") 0
|
||||||
when (isNothing mshipImage) $ do
|
when (isNothing mshipImage) $ do
|
||||||
|
|
|
@ -29,8 +29,8 @@ main = do
|
||||||
, windowTitle = "Haskelloids"
|
, windowTitle = "Haskelloids"
|
||||||
, windowConfig = SDL.defaultWindow
|
, windowConfig = SDL.defaultWindow
|
||||||
{ SDL.windowOpenGL = Just SDL.defaultOpenGL
|
{ SDL.windowOpenGL = Just SDL.defaultOpenGL
|
||||||
{ SDL.glProfile = SDL.Core SDL.Normal 3 3
|
{ SDL.glProfile = SDL.Core SDL.Normal 3 0
|
||||||
, SDL.glColorPrecision = V4 8 8 8 8
|
, SDL.glColorPrecision = V4 0 8 8 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, initScreenMode = SDL.Windowed
|
, initScreenMode = SDL.Windowed
|
||||||
|
@ -70,6 +70,9 @@ handle e = do
|
||||||
draw :: Affection UserData ()
|
draw :: Affection UserData ()
|
||||||
draw = do
|
draw = do
|
||||||
ud <- getAffection
|
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)
|
liftIO $ beginFrame (nano ud) 800 600 (800/600)
|
||||||
smDraw (state ud)
|
smDraw (state ud)
|
||||||
liftIO $ endFrame (nano ud)
|
liftIO $ endFrame (nano ud)
|
||||||
|
|
Loading…
Reference in a new issue