[feat] unify with example, actually win for once
This commit is contained in:
16
CHANGELOG.md
16
CHANGELOG.md
@@ -10,7 +10,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
|
||||||
- autogen code
|
|
||||||
|
## [0.2.0] -- 2025-12-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- example exe
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- probably everything ngl
|
||||||
|
- use SemVer instead of PVP
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- probably everything ngl
|
||||||
|
|
||||||
## [0.1.0.2] -- 2025-12-11
|
## [0.1.0.2] -- 2025-12-11
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,11 @@
|
|||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
version = "0.2.0";
|
||||||
package = {
|
package = {
|
||||||
mkDerivation,
|
mkDerivation,
|
||||||
base,
|
base,
|
||||||
|
bindings-DSL,
|
||||||
gl,
|
gl,
|
||||||
lib,
|
lib,
|
||||||
libGL,
|
libGL,
|
||||||
@@ -20,10 +22,11 @@
|
|||||||
}:
|
}:
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
pname = "hs-rgfw";
|
pname = "hs-rgfw";
|
||||||
version = "0.1.0.0";
|
version = "0.2.0";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
libraryHaskellDepends = [
|
libraryHaskellDepends = [
|
||||||
base
|
base
|
||||||
|
bindings-DSL
|
||||||
];
|
];
|
||||||
libraryPkgconfigDepends = [
|
libraryPkgconfigDepends = [
|
||||||
gl
|
gl
|
||||||
|
|||||||
@@ -1,53 +1,47 @@
|
|||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: hs-rgfw
|
name: hs-rgfw
|
||||||
-- PVP summary: +-+------- breaking API changes
|
version: 0.2.0
|
||||||
-- | | +----- non-breaking API additions
|
|
||||||
-- | | | +--- code changes with no API change
|
|
||||||
version: 0.1.0.2
|
|
||||||
-- A short (one-line) description of the package.
|
|
||||||
-- synopsis:
|
|
||||||
-- A longer description of the package.
|
|
||||||
-- description:
|
|
||||||
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
|
||||||
author: andromeda
|
author: andromeda
|
||||||
maintainer: @andromeda:tchncs.de
|
maintainer: @andromeda:tchncs.de
|
||||||
-- A copyright notice.
|
|
||||||
-- copyright:
|
|
||||||
category: Development
|
category: Development
|
||||||
build-type: Custom
|
build-type: Simple
|
||||||
extra-doc-files: CHANGELOG.md
|
extra-doc-files: CHANGELOG.md
|
||||||
-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
|
-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
|
||||||
-- extra-source-files:
|
|
||||||
common warnings
|
common warnings
|
||||||
ghc-options:
|
ghc-options:
|
||||||
-Wall
|
-Wall
|
||||||
-Widentities
|
|
||||||
-Wincomplete-record-updates
|
|
||||||
-Wincomplete-uni-patterns
|
|
||||||
-Wpartial-fields
|
|
||||||
-Wredundant-constraints
|
|
||||||
custom-setup
|
|
||||||
setup-depends:
|
|
||||||
base,
|
|
||||||
Cabal,
|
|
||||||
process
|
|
||||||
library
|
library
|
||||||
import: warnings
|
import: warnings
|
||||||
exposed-modules: Lib
|
exposed-modules: RGFW
|
||||||
-- Modules included in this library but not exported.
|
|
||||||
-- other-modules:
|
|
||||||
-- LANGUAGE extensions used by modules in this package.
|
|
||||||
-- other-extensions:
|
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.18
|
base >=4.18,
|
||||||
|
bindings-DSL <1000
|
||||||
pkgconfig-depends:
|
pkgconfig-depends:
|
||||||
gl,
|
gl,
|
||||||
x11,
|
x11,
|
||||||
xcursor,
|
xcursor,
|
||||||
xrandr,
|
xrandr,
|
||||||
xi
|
xi
|
||||||
hs-source-dirs:
|
hs-source-dirs: lib
|
||||||
lib
|
include-dirs: include
|
||||||
|
default-language: Haskell2010
|
||||||
|
executable hs-rgfw
|
||||||
|
import: warnings
|
||||||
|
main-is: Main.hs
|
||||||
|
build-depends:
|
||||||
|
base >=4.18,
|
||||||
|
hs-rgfw
|
||||||
|
pkgconfig-depends:
|
||||||
|
gl,
|
||||||
|
x11,
|
||||||
|
xcursor,
|
||||||
|
xrandr,
|
||||||
|
xi
|
||||||
|
hs-source-dirs: src
|
||||||
|
include-dirs: include
|
||||||
|
c-sources: include/RGFW_HS.c
|
||||||
|
install-includes: RGFW_HS.h
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|||||||
14033
include/RGFW.h
Normal file
14033
include/RGFW.h
Normal file
File diff suppressed because it is too large
Load Diff
1
include/RGFW_HS.c
Normal file
1
include/RGFW_HS.c
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#include "RGFW_HS.h"
|
||||||
14
include/RGFW_HS.h
Normal file
14
include/RGFW_HS.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#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
|
||||||
37
lib/RGFW.hsc
Normal file
37
lib/RGFW.hsc
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
|
||||||
|
#include <bindings.dsl.h>
|
||||||
|
module RGFW where
|
||||||
|
import Foreign.Ptr
|
||||||
|
#strict_import
|
||||||
|
#include <RGFW.h>
|
||||||
|
|
||||||
|
#synonym_t u8 , CChar
|
||||||
|
|
||||||
|
#opaque_t RGFW_window
|
||||||
|
|
||||||
|
#ccall RGFW_createWindow , CString -> CInt -> CInt -> CInt -> CInt -> CUInt -> IO (Ptr <struct RGFW_window>)
|
||||||
|
|
||||||
|
#synonym_t RGFW_windowFlags , CUInt
|
||||||
|
#num RGFW_windowNoBorder
|
||||||
|
#num RGFW_windowNoResize
|
||||||
|
#num RGFW_windowAllowDND
|
||||||
|
#num RGFW_windowHideMouse
|
||||||
|
#num RGFW_windowFullscreen
|
||||||
|
#num RGFW_windowTransparent
|
||||||
|
#num RGFW_windowCenter
|
||||||
|
#num RGFW_windowRawMouse
|
||||||
|
#num RGFW_windowScaleToMonitor
|
||||||
|
#num RGFW_windowHide
|
||||||
|
#num RGFW_windowMaximize
|
||||||
|
#num RGFW_windowCenterCursor
|
||||||
|
#num RGFW_windowFloating
|
||||||
|
#num RGFW_windowFocusOnShow
|
||||||
|
#num RGFW_windowMinimize
|
||||||
|
#num RGFW_windowFocus
|
||||||
|
#num RGFW_windowOpenGL
|
||||||
|
#num RGFW_windowEGL
|
||||||
|
#num RGFW_windowedFullscreen
|
||||||
|
|
||||||
|
#ccall RGFW_window_shouldClose , Ptr <struct RGFW_window> -> IO CUChar
|
||||||
|
|
||||||
|
#ccall RGFW_window_swapBuffers_OpenGL , Ptr <struct RGFW_window> -> IO ()
|
||||||
36
src/Main.hs
Normal file
36
src/Main.hs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
module Main (main) where
|
||||||
|
|
||||||
|
import Foreign.C.String (withCString)
|
||||||
|
|
||||||
|
import RGFW
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- main
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
window <- withCString "window <3" (\name ->
|
||||||
|
c'RGFW_createWindow
|
||||||
|
name
|
||||||
|
0
|
||||||
|
0
|
||||||
|
800
|
||||||
|
600
|
||||||
|
$ sum
|
||||||
|
[ c'RGFW_windowNoResize
|
||||||
|
, c'RGFW_windowOpenGL
|
||||||
|
, c'RGFW_windowedFullscreen
|
||||||
|
]
|
||||||
|
)
|
||||||
|
putStrLn $ show window
|
||||||
|
let loop ctr = do
|
||||||
|
shouldClose <- c'RGFW_window_shouldClose window
|
||||||
|
if 0 /= shouldClose
|
||||||
|
then return shouldClose
|
||||||
|
else do
|
||||||
|
c'RGFW_window_swapBuffers_OpenGL window
|
||||||
|
loop $ ctr + 1
|
||||||
|
exitCode <- loop (0 :: Integer)
|
||||||
|
putStrLn $ show exitCode
|
||||||
|
return ()
|
||||||
Reference in New Issue
Block a user