summaryrefslogtreecommitdiff
path: root/gix.hs
blob: 4d2fb187b9e76aa4d85b8c90c3462cbb93012485 (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
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where

import GI.Gtk as Gtk hiding (main)
import qualified GI.Gtk as Gtk

import Triangle 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
            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