diff options
| author | mtgmonkey <mtgmonkey@nixos> | 2025-12-11 18:15:32 +0100 |
|---|---|---|
| committer | mtgmonkey <mtgmonkey@nixos> | 2025-12-11 18:15:32 +0100 |
| commit | 8a16c6695e62de46c4f0cce22ff48276040bcfff (patch) | |
| tree | 23786224830e40708ec4af0ae321f30e98f7aa27 /lib/Main.hs | |
| parent | ab69702910741af752ff7ee5820bb85b1f3ddd5c (diff) | |
basic functionality on Wayland and X11
Diffstat (limited to 'lib/Main.hs')
| -rw-r--r-- | lib/Main.hs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/Main.hs b/lib/Main.hs new file mode 100644 index 0000000..cbed60f --- /dev/null +++ b/lib/Main.hs @@ -0,0 +1,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 () |
