diff options
author | Joe Crayne <joe@jerkface.net> | 2019-04-07 18:17:32 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-04-07 18:17:32 -0400 |
commit | 2f3c1f9fee8d6720b0180f686b0691dfcede0ba5 (patch) | |
tree | cf1e31f587833cb4b4ed342f5cacb854027df650 /gix.hs | |
parent | c155a1d9b8ca4b2cc5f327580847ad8f6249c1b6 (diff) |
Minor refactor.
Diffstat (limited to 'gix.hs')
-rw-r--r-- | gix.hs | 31 |
1 files changed, 17 insertions, 14 deletions
@@ -11,21 +11,24 @@ import Triangle as R | |||
11 | main = do | 11 | main = do |
12 | _ <- Gtk.init Nothing | 12 | _ <- Gtk.init Nothing |
13 | 13 | ||
14 | window <- windowNew WindowTypeToplevel | 14 | let mkChild = do |
15 | windowSetDefaultSize window 1000 1000 | 15 | gl <- gLAreaNew |
16 | windowSetTitle window "GL Area" | 16 | st <- R.initState |
17 | containerSetBorderWidth window 10 | 17 | _ <- on gl #realize $ R.realize st gl |
18 | _ <- on gl #unrealize $ R.unrealize st gl | ||
19 | _ <- on gl #render $ R.render st gl | ||
20 | return gl | ||
21 | |||
22 | window <- do | ||
23 | w <- windowNew WindowTypeToplevel | ||
24 | windowSetDefaultSize w 1000 1000 | ||
25 | windowSetTitle w "GL Area" | ||
26 | containerSetBorderWidth w 10 | ||
27 | _ <- on w #deleteEvent $ \_ -> mainQuit >> return True | ||
28 | child <- mkChild | ||
29 | containerAdd w child | ||
30 | return w | ||
18 | 31 | ||
19 | gl_area <- gLAreaNew | ||
20 | containerAdd window gl_area | ||
21 | |||
22 | st <- R.initState | ||
23 | |||
24 | _ <- on gl_area #realize $ R.realize st gl_area | ||
25 | _ <- on gl_area #unrealize $ R.unrealize gl_area | ||
26 | _ <- on gl_area #render $ R.render st gl_area | ||
27 | |||
28 | _ <- on window #deleteEvent $ \_ -> mainQuit >> return True | ||
29 | widgetShowAll window | 32 | widgetShowAll window |
30 | Gtk.main | 33 | Gtk.main |
31 | 34 | ||