diff options
author | Joe Crayne <joe@jerkface.net> | 2019-04-07 02:53:16 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-04-07 02:53:16 -0400 |
commit | 483ffac7da055342598b44800e69ee5217cb47cd (patch) | |
tree | f2c5780ea4bbcbfd443a3c77cd789d34905e2d90 /GtkHello.hs |
initial commit
Diffstat (limited to 'GtkHello.hs')
-rw-r--r-- | GtkHello.hs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/GtkHello.hs b/GtkHello.hs new file mode 100644 index 0000000..9b29ba7 --- /dev/null +++ b/GtkHello.hs | |||
@@ -0,0 +1,46 @@ | |||
1 | {-# LANGUAGE OverloadedLabels #-} | ||
2 | {-# LANGUAGE OverloadedLists #-} | ||
3 | {-# LANGUAGE OverloadedStrings #-} | ||
4 | module Main where | ||
5 | |||
6 | import qualified GI.Gtk as Gtk | ||
7 | import GI.Gtk.Declarative | ||
8 | import GI.Gtk.Declarative.App.Simple | ||
9 | |||
10 | import qualified Data.Map as Map | ||
11 | import qualified Data.Vector as V | ||
12 | |||
13 | import LambdaCube.GL as LambdaCubeGL -- renderer | ||
14 | import LambdaCube.GL.Mesh as LambdaCubeGL | ||
15 | |||
16 | import Codec.Picture as Juicy | ||
17 | |||
18 | import Data.Aeson | ||
19 | import qualified Data.ByteString as SB | ||
20 | |||
21 | type State = () | ||
22 | |||
23 | data Event = Closed | ||
24 | |||
25 | view' :: State -> AppView Gtk.Window Event | ||
26 | view' _ = bin | ||
27 | Gtk.Window | ||
28 | [ #title := "LambdaCube 3D DSL Hello World" | ||
29 | , on #deleteEvent $ {- GI.Gdk.Unions.Event.Event -> (Bool, Event) -} \_ -> (True,Closed) | ||
30 | ] | ||
31 | $ widget Gtk.Label [#label := "Hello, World!"] | ||
32 | |||
33 | update' :: State -> Event -> Transition State Event | ||
34 | update' _ Closed = Exit | ||
35 | |||
36 | main :: IO () | ||
37 | main = do | ||
38 | Just pipelineDesc <- decodeStrict <$> SB.readFile "hello.json" | ||
39 | |||
40 | run App | ||
41 | -- :: App Gtk.Window State Event | ||
42 | { view = view' | ||
43 | , update = update' | ||
44 | , inputs = [] | ||
45 | , initialState = () | ||
46 | } | ||