Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d36bbad5a8 |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "rgfw"]
|
||||||
|
path = include/RGFW
|
||||||
|
url = https://github.com/ColleagueRiley/RGFW
|
||||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -11,6 +11,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|||||||
- support for Windows
|
- support for Windows
|
||||||
- support for actually doing anything
|
- support for actually doing anything
|
||||||
|
|
||||||
|
## [0.2.1] -- 2025-12-16
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- submodule for `RGFW.h` to ensure reproducability
|
||||||
|
- add `RGFW` as submodule
|
||||||
|
- modify flake to copy self's submodules to the store
|
||||||
|
- change include path of `library` in `hs-game.cabal`
|
||||||
|
- change include path of `lib/RGFW.hsc`
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- random junk files from `lib`
|
||||||
|
- no breaking changes, none were in any way linked
|
||||||
|
|
||||||
## [0.2.0] -- 2025-12-16
|
## [0.2.0] -- 2025-12-16
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
||||||
|
self.submodules = true;
|
||||||
};
|
};
|
||||||
outputs = {
|
outputs = {
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
version = "0.2.0";
|
version = "0.2.1";
|
||||||
package = {
|
package = {
|
||||||
mkDerivation,
|
mkDerivation,
|
||||||
base,
|
base,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: hs-rgfw
|
name: hs-rgfw
|
||||||
version: 0.2.0
|
version: 0.2.1
|
||||||
homepage: https://git.mtgmonkey.net/Andromeda/hs-rgfw
|
homepage: https://git.mtgmonkey.net/Andromeda/hs-rgfw
|
||||||
license: BSD-3-Clause
|
license: BSD-3-Clause
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
@@ -26,7 +26,7 @@ library
|
|||||||
xrandr,
|
xrandr,
|
||||||
xi
|
xi
|
||||||
hs-source-dirs: lib
|
hs-source-dirs: lib
|
||||||
include-dirs: include
|
include-dirs: include/RGFW
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
executable hs-rgfw
|
executable hs-rgfw
|
||||||
import: warnings
|
import: warnings
|
||||||
|
|||||||
1
include/RGFW
Submodule
1
include/RGFW
Submodule
Submodule include/RGFW added at e23298e46f
14033
include/RGFW.h
14033
include/RGFW.h
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
|||||||
#define RGFW_OPENGL
|
#define RGFW_OPENGL
|
||||||
|
|
||||||
#define Time X11Time // fixes namespace clash with GHC when building with Nix
|
#define Time X11Time // fixes namespace clash with GHC when building with Nix
|
||||||
#include "RGFW.h"
|
#include "RGFW/RGFW.h"
|
||||||
#undef Time
|
#undef Time
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
87
lib/Lib.hs
87
lib/Lib.hs
@@ -1,87 +0,0 @@
|
|||||||
{-# LANGUAGE CApiFFI #-}
|
|
||||||
|
|
||||||
module Lib where
|
|
||||||
|
|
||||||
import Data.Bits (shiftL, (.|.))
|
|
||||||
import Foreign
|
|
||||||
import Foreign.C.String
|
|
||||||
import Foreign.C.Types
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- Haskell-ier abstractions
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
data WindowFlags
|
|
||||||
= WindowNoBorder
|
|
||||||
| WindowNoResize
|
|
||||||
| WindowAllowDND
|
|
||||||
| WindowHideMouse
|
|
||||||
| WindowFullscreen
|
|
||||||
| WindowTransparent
|
|
||||||
| WindowCenter
|
|
||||||
| WindowRawMouse
|
|
||||||
| WindowScaleToMonitor
|
|
||||||
| WindowHide
|
|
||||||
| WindowMaximize
|
|
||||||
| WindowCenterCursor
|
|
||||||
| WindowFloating
|
|
||||||
| WindowFocusOnShow
|
|
||||||
| WindowMinimize
|
|
||||||
| WindowFocus
|
|
||||||
| WindowOpenGL
|
|
||||||
| WindowEGL
|
|
||||||
| WindowedFullscreen
|
|
||||||
|
|
||||||
mkWindowFlags :: [WindowFlags] -> RGFWwindowFlags
|
|
||||||
mkWindowFlags [] = 0
|
|
||||||
mkWindowFlags (flag:flags) =
|
|
||||||
let
|
|
||||||
shift =
|
|
||||||
case flag of
|
|
||||||
WindowNoBorder -> 0
|
|
||||||
WindowNoResize -> 1
|
|
||||||
WindowAllowDND -> 2
|
|
||||||
WindowHideMouse -> 3
|
|
||||||
WindowFullscreen -> 4
|
|
||||||
WindowTransparent -> 5
|
|
||||||
WindowCenter -> 6
|
|
||||||
WindowRawMouse -> 7
|
|
||||||
WindowScaleToMonitor -> 8
|
|
||||||
WindowHide -> 9
|
|
||||||
WindowMaximize -> 10
|
|
||||||
WindowCenterCursor -> 11
|
|
||||||
WindowFloating -> 12
|
|
||||||
WindowFocusOnShow -> 13
|
|
||||||
WindowMinimize -> 14
|
|
||||||
WindowFocus -> 15
|
|
||||||
WindowOpenGL -> 17
|
|
||||||
WindowEGL -> 18
|
|
||||||
_ -> 19 -- TODO fix this silent error, implement windowedFullscreen
|
|
||||||
in
|
|
||||||
(shiftL 1 shift) .|. (mkWindowFlags flags)
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- directly from RFGW.h
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- RGFWindow
|
|
||||||
data RGFWwindow
|
|
||||||
-- ptr
|
|
||||||
type RGFWwindowPtr = Ptr RGFWwindow
|
|
||||||
-- flags to create
|
|
||||||
type RGFWwindowFlags = Word32
|
|
||||||
|
|
||||||
type RGFWbool = CUInt
|
|
||||||
|
|
||||||
foreign import capi "RGFW_HS.h RGFW_createWindow" rgfwCreateWindow
|
|
||||||
:: Ptr CChar
|
|
||||||
-> CInt
|
|
||||||
-> CInt
|
|
||||||
-> CInt
|
|
||||||
-> CInt
|
|
||||||
-> RGFWwindowFlags
|
|
||||||
-> IO RGFWwindowPtr
|
|
||||||
|
|
||||||
foreign import capi "RGFW_HS.h RGFW_window_shouldClose" rgfwWindowShouldClose
|
|
||||||
:: RGFWwindowPtr
|
|
||||||
-> IO RGFWbool
|
|
||||||
14034
lib/RGFW.h
14034
lib/RGFW.h
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
|||||||
#ifndef RGFW_HS // avoid repeated imports
|
|
||||||
#define RGFW_HS
|
|
||||||
|
|
||||||
// TODO add actual include logic
|
|
||||||
|
|
||||||
#define RGFW_IMPLEMENTATION
|
|
||||||
#define RGFW_DEBUG
|
|
||||||
#define RGFW_OPENGL
|
|
||||||
|
|
||||||
#define Time X11Time // fixes namespace clash with GHC when building with Nix
|
|
||||||
#include "RGFW.h"
|
|
||||||
#undef Time
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user