hate-no-d/README.md
pedro-bento 80fc9f25a9
All checks were successful
release / linux/armv7 (push) Successful in 2m14s
release / linux/i686 (push) Successful in 2m0s
release / linux/x86_64 (push) Successful in 1m56s
release / windows/x86_64 (push) Successful in 2m9s
release / linux/aarch64 (push) Successful in 1m57s
release / android (push) Successful in 2m51s
release / freebsd/x86_64 (push) Successful in 5m13s
release / windows/i686 (push) Successful in 2m4s
refactor generator (#15)
Reviewed-on: #15
Co-authored-by: pedro-bento <mail@pbento.pt>
Co-committed-by: pedro-bento <mail@pbento.pt>
2026-11-01 22:09:40 +00:00

161 lines
3.8 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
require("hate-no-d")
InitWindow(1280, 720, "hate-no-d")
SetTargetFPS(60)
local text = "Your first hate-no-d application!"
local fontSize = 48
while not WindowShouldClose() do
BeginDrawing()
ClearBackground(SKYBLUE)
local width = MeasureText(text, fontSize)
DrawText(text, (GetScreenWidth() - width)/2, (GetScreenHeight() - fontSize)/2, fontSize, DARKBLUE)
EndDrawing()
end
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/raygui binding. It defines
every function and constant as a Lua global, so `require("hate-no-d")` is all
the setup you need; 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"`.