summaryrefslogtreecommitdiff
path: root/lib/Main.hs
blob: cbed60f977209ef5c792fe9c837e269484cfc0a9 (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
{-# LANGUAGE CApiFFI #-}

module Main (main) where

import Data.Bits (shiftL, (.|.))
import Foreign
import Foreign.C.String
import Foreign.C.Types

import Lib

--------------------------------------------------------------------------------
-- main
--------------------------------------------------------------------------------

main :: IO ()
main = do
  window <- withCString "a window" (\name ->
              rgfwCreateWindow
                name
                0
                0
                800
                600
                $ mkWindowFlags 
                  [ WindowNoResize
                  , WindowOpenGL
                  , WindowFullscreen
                  ]
              )
  let loop ctr = do
        shouldClose <- rgfwWindowShouldClose window
        if 0 /= shouldClose
        then return shouldClose
        else loop $ ctr + 1
  exitCode <- loop 0
  putStrLn $ show exitCode
  return ()