Compare commits

...

1 commit

Author SHA1 Message Date
208ea1dd24 handle multiwin branch 2019-04-30 00:22:29 +02:00
2 changed files with 15 additions and 11 deletions

View file

@ -40,7 +40,7 @@ loadLoad = do
(nano ud) (nano ud)
future future
progress progress
SDL.glMakeCurrent (fromJust $ window ud) (glContext ad) SDL.glMakeCurrent (fromJust $ window ud) (snd $ head $ glContext ad)
putAffection ud putAffection ud
{ stateMVar = future { stateMVar = future
, stateProgress = progress , stateProgress = progress

View file

@ -32,13 +32,17 @@ main = do
let config = AffectionConfig let config = AffectionConfig
{ initComponents = All { initComponents = All
, windowTitle = "Tracer" , windowTitle = "Tracer"
, windowConfig = SDL.defaultWindow , windowConfigs = [
{ SDL.windowInitialSize = V2 1280 720 ( 0
, SDL.windowResizable = True , SDL.defaultWindow
, SDL.windowOpenGL = Just SDL.defaultOpenGL { SDL.windowInitialSize = V2 1280 720
{ SDL.glProfile = SDL.Core SDL.Normal 3 3 , SDL.windowResizable = True
, SDL.windowOpenGL = Just SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 3
}
} }
} )
]
, canvasSize = Nothing , canvasSize = Nothing
, preLoop = pre >> smLoad Load , preLoop = pre >> smLoad Load
, eventLoop = handle , eventLoop = handle
@ -54,8 +58,8 @@ pre :: Affection UserData ()
pre = do pre = do
ad <- A.get ad <- A.get
ud <- getAffection ud <- getAffection
threadCtx <- SDL.glCreateContext (drawWindow ad) threadCtx <- SDL.glCreateContext (snd $ head $ drawWindows ad)
SDL.glMakeCurrent (drawWindow ad) (glContext ad) SDL.glMakeCurrent (snd $ head $ drawWindows ad) (snd $ head $ glContext ad)
let Subsystems w m k j t = subsystems ud let Subsystems w m k j t = subsystems ud
_ <- partSubscribe w (fitViewport (1280/720)) _ <- partSubscribe w (fitViewport (1280/720))
_ <- partSubscribe w exitOnWindowClose _ <- partSubscribe w exitOnWindowClose
@ -65,7 +69,7 @@ pre = do
(ws, _) <- yieldSystemT (0, defStorage) (return ()) (ws, _) <- yieldSystemT (0, defStorage) (return ())
putAffection ud putAffection ud
{ threadContext = Just threadCtx { threadContext = Just threadCtx
, window = Just (drawWindow ad) , window = Just (snd $ head $ drawWindows ad)
, worldState = ws , worldState = ws
, joyUUID = u , joyUUID = u
} }
@ -83,7 +87,7 @@ quitGame (MsgKeyboardEvent _ _ SDL.Pressed False sym)
mapM_ (partUnSubscribe k) (uuid ud) mapM_ (partUnSubscribe k) (uuid ud)
mapM_ (partUnSubscribe j) (uuid ud) mapM_ (partUnSubscribe j) (uuid ud)
mapM_ (partUnSubscribe t) (uuid ud) mapM_ (partUnSubscribe t) (uuid ud)
SDL.glMakeCurrent (drawWindow ad) (glContext ad) SDL.glMakeCurrent (snd $ head $ drawWindows ad) (snd $ head $ glContext ad)
(ws, _) <- yieldSystemT (0, defStorage) (return ()) (ws, _) <- yieldSystemT (0, defStorage) (return ())
putAffection ud putAffection ud
{ worldState = ws { worldState = ws