hunting warnings and other nasties

This commit is contained in:
nek0 2022-07-09 23:26:37 +02:00
parent 17978b0bd7
commit 60d38217c8
2 changed files with 9 additions and 7 deletions

View file

@ -102,7 +102,7 @@ library
ghc-options: -Wall ghc-options: -Wall
-- Other library packages from which modules are imported. -- Other library packages from which modules are imported.
build-depends: base >=4.9 && < 5 build-depends: base >=4.9 && < 5
, sdl2 ^>= 2.5 , sdl2 >= 2.5
, linear , linear
, text , text
, mtl , mtl
@ -129,7 +129,7 @@ executable example00
if flag(examples) if flag(examples)
build-depends: base >=4.9 && < 5 build-depends: base >=4.9 && < 5
, affection , affection
, sdl2 ^>= 2.5 , sdl2 >= 2.5
, stm , stm
else else
buildable: False buildable: False
@ -145,7 +145,7 @@ executable example01
if flag(examples) if flag(examples)
build-depends: base >=4.9 && < 5 build-depends: base >=4.9 && < 5
, affection , affection
, sdl2 ^>= 2.5 , sdl2 >= 2.5
, stm , stm
, OpenGL , OpenGL
, random , random
@ -168,7 +168,7 @@ executable example02
if flag(examples) if flag(examples)
build-depends: base >=4.9 && < 5 build-depends: base >=4.9 && < 5
, affection , affection
, sdl2 ^>= 2.5 , sdl2 >= 2.5
, stm , stm
, OpenGL , OpenGL
, random , random

View file

@ -23,7 +23,8 @@ import qualified Graphics.GL as GLRaw
import Foreign.Marshal.Array import Foreign.Marshal.Array
import qualified Data.ByteString as B import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as B8
import Data.String (fromString)
import System.Clock import System.Clock
@ -62,11 +63,12 @@ withAffection AffectionConfig{..} = do
renderQuality <- SDL.get SDL.HintRenderScaleQuality renderQuality <- SDL.get SDL.HintRenderScaleQuality
when (renderQuality /= SDL.ScaleLinear) $ when (renderQuality /= SDL.ScaleLinear) $
logIO Warn "Linear texture filtering not enabled!" logIO Warn "Linear texture filtering not enabled!"
void $ liftIO (logIO Debug . fromString . show <$> (SDL.version :: IO (Integer, Integer, Integer)))
-- construct window -- construct window
liftIO $ logIO Debug "Creating Window(s)" liftIO $ logIO Debug "Creating Window(s)"
windows <- zip3 (map (\(x,_,_) -> x) windowConfigs) <$> windows <- zip3 (map (\(x,_,_) -> x) windowConfigs) <$>
mapM mapM
(\wc -> SDL.createWindow windowTitle ((\(_,y,_) -> y) wc)) (SDL.createWindow windowTitle . (\(_,y,_) -> y))
windowConfigs <*> windowConfigs <*>
pure (map (\(_,_,z) -> z) windowConfigs) pure (map (\(_,_,z) -> z) windowConfigs)
@ -74,7 +76,7 @@ withAffection AffectionConfig{..} = do
_ <- SDL.glSetAttribute SDL.SDL_GL_SHARE_WITH_CURRENT_CONTEXT 1 _ <- SDL.glSetAttribute SDL.SDL_GL_SHARE_WITH_CURRENT_CONTEXT 1
contexts <- zip (map (\(x,_,_) -> x) windows) <$> contexts <- zip (map (\(x,_,_) -> x) windows) <$>
mapM (SDL.glCreateContext . (\(_,y,_) -> y)) windows mapM (SDL.glCreateContext . (\(_,y,_) -> y)) windows
mapM_ (\w -> flip SDL.setWindowMode ((\(_,_,z) -> z) w) ((\(_,y,_) -> y) w)) windows mapM_ (\w -> SDL.setWindowMode ((\(_,y,_) -> y) w) ((\(_,_,z) -> z) w)) windows
-- sync updates with monitor -- sync updates with monitor
-- SDL.swapInterval $= SDL.SynchronizedUpdates -- <- causes Problems with windows -- SDL.swapInterval $= SDL.SynchronizedUpdates -- <- causes Problems with windows
liftIO $ logIO Debug "Getting Time" liftIO $ logIO Debug "Getting Time"