handle multiwin branch

This commit is contained in:
nek0 2019-04-30 00:22:29 +02:00
parent 3cb28f396b
commit 208ea1dd24
2 changed files with 15 additions and 11 deletions

View file

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

View file

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