Fix window size bug

This commit is contained in:
Kiana Sheibani 2021-12-29 22:54:49 -05:00
parent c39357a93b
commit c096923f39
2 changed files with 4 additions and 4 deletions

View file

@ -44,15 +44,15 @@ processEvent = event noEvent $ \case
EventMotion {} -> noEvent
EventResize size -> Event $ Resize size
run :: forall f. DisplayableSpace f => f Bool -> SF InputEvent Picture
run st =
run :: DisplayableSpace f => (Int, Int) -> f Bool -> SF InputEvent Picture
run size st =
let initSpace = gol' standardRule st
in proc inp -> do
let cmdev = processEvent inp
playing <- accumHoldBy (const . not) True -< filterE isPlayPause cmdev
time <- accum 0.2 -< mapFilterE getChangeSpeed cmdev
windowSize <- hold (100, 100) -< mapFilterE getResize cmdev
windowSize <- hold size -< mapFilterE getResize cmdev
tick <- tickSignal -< time
space <- engine initSpace -< gate tick playing

View file

@ -15,4 +15,4 @@ main =
(InWindow "Conway's Game of Life" (200, 200) (10, 10))
black
30
(run space)
(run (200, 200) space)