summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-04-29 20:13:49 -0400
committerJoe Crayne <joe@jerkface.net>2019-04-29 20:13:49 -0400
commit4c98ccde118f4dd0503226154876001bfc2770f7 (patch)
tree3c60abb186c78b42ae1f992e01bfa728899b2fe4
parentccb333bf33588dc578380b60c40b8bc963b84f42 (diff)
MeshSketch.new now returns a widget.
-rw-r--r--MeshSketch.hs4
-rw-r--r--mainObj.hs26
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
114new :: IO MeshSketch 114new :: IO GLArea
115new = do 115new = 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
148onUnrealize :: MeshSketch -> IO () 148onUnrealize :: MeshSketch -> IO ()
149onUnrealize mm = do 149onUnrealize mm = do
diff --git a/mainObj.hs b/mainObj.hs
index caf6501..133643f 100644
--- a/mainObj.hs
+++ b/mainObj.hs
@@ -11,19 +11,19 @@ import qualified MeshSketch
11 11
12main :: IO () 12main :: IO ()
13main = do 13main = 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