diff options
author | Joe Crayne <joe@jerkface.net> | 2019-04-29 20:13:49 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-04-29 20:13:49 -0400 |
commit | 4c98ccde118f4dd0503226154876001bfc2770f7 (patch) | |
tree | 3c60abb186c78b42ae1f992e01bfa728899b2fe4 | |
parent | ccb333bf33588dc578380b60c40b8bc963b84f42 (diff) |
MeshSketch.new now returns a widget.
-rw-r--r-- | MeshSketch.hs | 4 | ||||
-rw-r--r-- | mainObj.hs | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/MeshSketch.hs b/MeshSketch.hs index c56d34f..9c6c457 100644 --- a/MeshSketch.hs +++ b/MeshSketch.hs | |||
@@ -111,7 +111,7 @@ data Realized = Realized | |||
111 | , stState :: State | 111 | , stState :: State |
112 | } | 112 | } |
113 | 113 | ||
114 | new :: IO MeshSketch | 114 | new :: IO GLArea |
115 | new = do | 115 | new = do |
116 | m <- do | 116 | m <- do |
117 | objName <- head . (++ ["cube.obj"]) <$> getArgs | 117 | objName <- head . (++ ["cube.obj"]) <$> getArgs |
@@ -143,7 +143,7 @@ new = do | |||
143 | _ <- on g #realize $ withCurrentGL g (onRealize obj (dynamicPipeline pipeline) (dynamicSchema pipeline) mm) | 143 | _ <- on g #realize $ withCurrentGL g (onRealize obj (dynamicPipeline pipeline) (dynamicSchema pipeline) mm) |
144 | _ <- on g #unrealize $ onUnrealize mm | 144 | _ <- on g #unrealize $ onUnrealize mm |
145 | -- _ <- on g #createContext $ nullableContext (glCreateContext w st) | 145 | -- _ <- on g #createContext $ nullableContext (glCreateContext w st) |
146 | return mm | 146 | return g |
147 | 147 | ||
148 | onUnrealize :: MeshSketch -> IO () | 148 | onUnrealize :: MeshSketch -> IO () |
149 | onUnrealize mm = do | 149 | onUnrealize mm = do |
@@ -11,19 +11,19 @@ import qualified MeshSketch | |||
11 | 11 | ||
12 | main :: IO () | 12 | main :: IO () |
13 | main = do | 13 | main = do |
14 | _ <- Gtk.init Nothing | 14 | _ <- Gtk.init Nothing |
15 | 15 | ||
16 | let mkChild = MeshSketch.mmWidget <$> MeshSketch.new | 16 | let mkChild = MeshSketch.new |
17 | 17 | ||
18 | window <- do | 18 | window <- do |
19 | w <- Gtk.windowNew WindowTypeToplevel | 19 | w <- windowNew WindowTypeToplevel |
20 | windowSetDefaultSize w 720 720 | 20 | windowSetDefaultSize w 720 720 |
21 | Gtk.windowSetTitle w "MeshSketch" | 21 | windowSetTitle w "MeshSketch" |
22 | containerSetBorderWidth w 0 | 22 | containerSetBorderWidth w 0 |
23 | _ <- on w #deleteEvent $ \_ -> mainQuit >> return True | 23 | _ <- on w #deleteEvent $ \_ -> mainQuit >> return True |
24 | child <- mkChild | 24 | child <- mkChild |
25 | containerAdd w child | 25 | containerAdd w child |
26 | return w | 26 | return w |
27 | 27 | ||
28 | widgetShowAll window | 28 | widgetShowAll window |
29 | Gtk.main | 29 | Gtk.main |