Skip to content

Commit a2646ed

Browse files
authored
Adds 'destroyWindow' call to main example in SDL.hs (#187)
The getting started example in SDL.hs doesn't call 'destroyWindow' and so leaves windows around. This adds this call and an additional comment to explain in the example.
1 parent 8e50908 commit a2646ed

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/SDL.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,18 @@ If you wish to use SDL's 2D graphics API, you can also create a 'Renderer':
7575
renderer <- 'createRenderer' window (-1) 'defaultRenderer'
7676
@
7777
78-
Finally, we enter our main application loop:
78+
Then, we enter our main application loop:
7979
8080
@
8181
appLoop renderer
8282
@
8383
84+
Finally, once our appLoop has returned we destroy the 'Window' using 'destroyWindow':
85+
86+
@
87+
'destroyWindow' window
88+
@
89+
8490
For the body of your application, we enter a loop. Inside this loop you should begin by collecting all events that
8591
have happened - these events will inform you about information such as key presses and mouse movement:
8692
@@ -134,6 +140,7 @@ main = do
134140
window <- 'createWindow' "My SDL Application" 'defaultWindow'
135141
renderer <- 'createRenderer' window (-1) 'defaultRenderer'
136142
appLoop renderer
143+
destroyWindow window
137144
138145
appLoop :: 'Renderer' -> IO ()
139146
appLoop renderer = do

0 commit comments

Comments
 (0)