MyNixOS website logo
Description

Raylib bindings for Haskell.

This library contains Haskell bindings to the Raylib library. It supports Windows, Mac, Linux, and BSD.

h-raylib: Haskell bindings for Raylib

cabal-build nix-build Hackage Version

This library includes Haskell bindings to the Raylib library.

Basic usage | Platform specific requirements | Advanced usage | GHCi | Documentation | FAQ and help

Basic usage

To use this package, include it as a dependency in your cabal file.

build-depends:
  base,
  # ...
  h-raylib

It should work out of the box. See Advanced usage for more complex use cases.

Platform specific requirements

This library is known to work on Windows, Linux, and Mac. It may not work properly on other platforms, so don't hesitate to report issues on the GitHub repository.

Windows/Mac

h-raylib should automatically work if you do not disable the detect-platform flag. In that case, you may skip this step.

If you do disable the detect-platform flag when building, use the platform-windows or platform-mac flag when building.

Linux

You may need to run the following to install X11 (a window manager for Linux).

sudo apt-get install libx11-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev

Now, h-raylib should automatically work if you do not disable the detect-platform flag. In that case, you may skip the following.

If you do disable the detect-platform flag when building, use the platform-linux flag when building

BSD (Experimental)

h-raylib should automatically work if you do not disable the detect-platform flag. In that case, you may skip this step.

If you do disable the detect-platform flag when building, use the platform-bsd flag when building.

Other platforms

This library has not yet been tested on other platforms (raylib supports Android, Raspberry Pi, and DRM, all of which have not been implemented in h-raylib). Anybody willing to try is welcome.

Web support has not been finalized yet.

If you get it working on other platforms, please create a pull request in the GitHub repository and update h-raylib.cabal with the relevant config.

Advanced usage

Your platform-specific dependencies will automatically be built by default. You may want to disable this behavior. You can disable the detect-platform flag to achieve this.

You can do this through the command line when running your project, like so

cabal run --constraint="h-raylib -detect-platform"

Or you can add it to your cabal.project file.

package h-raylib
  flags: -detect-platform

The flags platform-windows, platform-mac, platform-linux, and platform-bsd are also supported if you want to build for a different platform.

Running in GHCi

You can use this library in GHCi just like any other library, but you will need to add --constraint="h-raylib +ghci" to the command. For example, in the root folder of this repository, you could use the command below to use the library through GHCi.

cabal repl --constraint="h-raylib +ghci"

You may need to use :set -fno-ghci-sandbox after entering the REPL to fix problems with multithreaded execution.

On Windows, you may lose joystick support when running in GHCi.

Documentation

For documentation: DOCUMENTATION.md.

For contributors: CONTRIBUTING.md.

If you want to request a feature, create an issue in the GitHub repo. Please check the roadmap to see if the feature has already been planned.

FAQ and help

  • When I try to run an h-raylib program I get the error The code execution cannot proceed because libwinpthread-1.dll was not found. Reinstalling the program may fix this problem.

  • When I try to compile an h-raylib program I get the error Missing (or bad) C libraries: gcc_eh

If you find a bug, please create an issue on GitHub.

If you have a question about the library that is not related to a bug, ask it on GitHub discussions or in the Haskell GameDev Discord server.

License

This project is licensed under the Apache License 2.0. See more in LICENSE.

Metadata

Version

5.5.0.0

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows