hate-no-d/README.md
pedro-bento 9b8c285cc7
Some checks failed
release / linux/aarch64 (pull_request) Successful in 1m58s
release / linux/armv7 (pull_request) Successful in 2m15s
release / linux/i686 (pull_request) Successful in 1m59s
release / linux/x86_64 (pull_request) Successful in 1m57s
release / freebsd/x86_64 (pull_request) Failing after 5m6s
release / windows/i686 (pull_request) Successful in 2m11s
release / windows/x86_64 (pull_request) Successful in 2m10s
release / android (pull_request) Successful in 2m55s
Add raylib
2026-10-22 21:00:26 +01:00

160 lines
3.7 KiB
Markdown

# hate-no-d
A [Love2D](https://www.love2d.org/) antagonist.
A glorified [Makefile](./Makefile).
Should work on:
- Linux (x86, x86_64, ARM, ARM64)
- Android (armeabi-v7a, arm64-v8a, x86, x86_64)
- macOS (x86_64, ARM64)
- Windows (x86, x86_64 via MinGW; ARM64 via MSVC)
- FreeBSD, OpenBSD, NetBSD (x86, x86_64) or DragonFly BSD (x86_64)
## Quick Start
Save this as `quick-start.lua`:
```lua
local hnd = require("hate-no-d")
hnd.InitWindow(1280, 720, "hate-no-d")
hnd.SetTargetFPS(60)
local text = "Your first hate-no-d application!"
local fontSize = 48
while not hnd.WindowShouldClose() do
hnd.BeginDrawing()
hnd.ClearBackground(hnd.SKYBLUE)
local width = hnd.MeasureText(text, fontSize)
hnd.DrawText(text, (hnd.GetScreenWidth() - width)/2, (hnd.GetScreenHeight() - fontSize)/2, fontSize, hnd.DARKBLUE)
hnd.EndDrawing()
end
hnd.CloseWindow()
```
Run it:
```sh
./hate-no-d quick-start.lua
```
On Windows:
```bat
hate-no-d.exe quick-start.lua
```
`hate-no-d.lua` is the generated raylib/rlgl/raymath binding; release archives
ship it next to the binary.
## Building
Precompiled builds can be found on the [releases page](https://git.pbento.pt/pedro-bento/hate-no-d/releases).
### Linux prerequisites
Install a C toolchain, `git`, LuaJIT and the OpenGL/X11 headers.
Debian/Ubuntu:
```sh
sudo apt install build-essential git luajit libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
```
Fedora:
```sh
sudo dnf install gcc make git luajit mesa-libGL-devel libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
```
Arch:
```sh
sudo pacman -S --needed base-devel git luajit mesa libx11 libxrandr libxinerama libxcursor libxi
```
Void:
```sh
sudo xbps-install -S base-devel git luajit MesaLib-devel libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
```
Gentoo:
```sh
sudo emerge --ask sys-devel/gcc dev-build/make dev-vcs/git dev-lang/luajit media-libs/mesa x11-libs/libX11 x11-libs/libXrandr x11-libs/libXinerama x11-libs/libXcursor x11-libs/libXi
```
### macOS prerequisites
```sh
xcode-select --install
brew install luajit
```
The Command Line Tools provide `make` and `clang`; LuaJIT runs the binding
generator.
### BSD prerequisites
FreeBSD:
```sh
sudo pkg install gmake luajit libX11 libXrandr libXinerama libXi libXcursor libglvnd
```
On OpenBSD, NetBSD and DragonFly install `gmake`, `luajit` (`pkg_add`, `pkgin`
or `pkg`) and the X11/GL libraries if they are missing. Use `gmake` instead of
`make`.
### Android prerequisites
Cross-compile from Linux or macOS with the Android NDK, passed as `ANDROID_NDK`
or exported as `ANDROID_NDK_HOME`.
### Windows prerequisites
MSVC: install Visual Studio 2022 with the "Desktop development with C++"
workload. `build.bat` finds it. raylib needs CMake 3.22+, so install CMake if the
bundled copy is older.
MinGW: use MSYS2 with the mingw-w64 toolchain and `make`. A native MSYS2 shell is
detected automatically; cross-compiling from elsewhere needs `PLATFORM=Windows`
(and `WIN_ARCH=i686` for 32-bit).
### Building from source
Linux, macOS and the BSDs:
```sh
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
cd hate-no-d
make
```
`make` builds the CLI and regenerates `hate-no-d.lua`, which needs a host `luajit`
in `PATH` (override with `make LUAJIT=/path/to/luajit`). On the BSDs use `gmake`.
Windows with MSVC:
```bat
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
cd hate-no-d
build.bat
```
Android from Linux or macOS:
```sh
make PLATFORM=Android ANDROID_NDK=/path/to/ndk
```
`ANDROID_ABI` defaults to `arm64-v8a` and `ANDROID_API` to `21`; `make help` lists
the other ABIs. Building `armeabi-v7a` on a 64-bit host also needs
`HOST_CC="gcc -m32"`.