blob: 54da6285b115f6ac424416b1cb1efc76f138a244 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE CPP #-}
module Main where
import GI.Gtk as Gtk hiding (main)
import qualified GI.Gtk as Gtk
import GI.GObject.Functions
import GI.GObject.Flags
import Data.GI.Base.GType
import Foreign.Ptr
-- import Triangle as R
-- import Lambda2 as R
-- import Draw as R
import LambdaHello as R
main = do
_ <- Gtk.init Nothing
let mkChild = do
gl <- gLAreaNew
st <- R.initState
_ <- on gl #realize $ R.realize st gl
_ <- on gl #unrealize $ R.unrealize st gl
_ <- on gl #render $ R.render st gl
#if MIN_VERSION_haskell_gi_base(0,22,0)
typ <- gobjectType @GLArea
#else
typ <- gobjectType gl
#endif
ccSig <- signalLookup "create-context" typ
ccid <- signalHandlerFind gl [SignalMatchTypeId] ccSig
0 -- detail
Nothing -- closure
nullPtr -- func
nullPtr -- data
ccqry <- signalQuery (fromIntegral ccid)
print (gtypeToCGType typ,ccSig,ccid {-, ccqry -}) -- (66419360,233,0)
_ <- on gl #createContext $ R.createContext st gl
ccid <- signalHandlerFind gl [SignalMatchTypeId] ccSig
0 -- detail
Nothing -- closure
nullPtr -- func
nullPtr -- data
print (gtypeToCGType typ,ccSig,ccid {-, ccqry -}) -- (77669760,233,47)
-- signalHandlerDisconnect gl ccid
return gl
window <- do
w <- windowNew WindowTypeToplevel
windowSetDefaultSize w 1000 1000
windowSetTitle w "GL Area"
containerSetBorderWidth w 10
_ <- on w #deleteEvent $ \_ -> mainQuit >> return True
child <- mkChild
containerAdd w child
return w
widgetShowAll window
Gtk.main
|