Some checks failed
release / linux/aarch64 (pull_request) Failing after 1m7s
release / linux/armv7 (pull_request) Failing after 1m13s
release / linux/i686 (pull_request) Failing after 1m0s
release / linux/x86_64 (pull_request) Failing after 56s
release / android (pull_request) Successful in 2m46s
release / freebsd/x86_64 (pull_request) Failing after 4m56s
release / windows/i686 (pull_request) Failing after 2m19s
release / windows/x86_64 (pull_request) Failing after 2m14s
168 lines
4.6 KiB
Markdown
168 lines
4.6 KiB
Markdown
# hate-no-d
|
|
|
|
A [Love2D](https://www.love2d.org/) antagonist.
|
|
|
|
A glorified [Makefile](./Makefile), plus a small `build.bat` for MSVC.
|
|
|
|
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
|
|
|
|
Once you have the binary, save this as `quick-start.lua`:
|
|
|
|
```lua
|
|
local hnd = require("hate-no-d")
|
|
|
|
hnd.InitWindow(1280, 720, "hate-no-d")
|
|
|
|
local text = "Your first hate-no-d application!"
|
|
local fontSize = 48
|
|
|
|
local spacing = fontSize / hnd.GetFontDefault().baseSize
|
|
local textSize = hnd.MeasureTextEx(hnd.GetFontDefault(), text, fontSize, spacing)
|
|
|
|
local posX = (hnd.GetRenderWidth() / 2) - (textSize.x / 2)
|
|
local posY = (hnd.GetRenderHeight() / 2) - (textSize.y / 2)
|
|
|
|
while not hnd.WindowShouldClose() do
|
|
hnd.ClearBackground(hnd.SKYBLUE)
|
|
|
|
hnd.BeginDrawing()
|
|
hnd.DrawText(text, posX, posY, fontSize, hnd.DARKBLUE)
|
|
hnd.EndDrawing()
|
|
end
|
|
|
|
hnd.CloseWindow()
|
|
```
|
|
|
|
Then run it:
|
|
|
|
```sh
|
|
./hate-no-d quick-start.lua
|
|
```
|
|
|
|
`hate-no-d.lua` is the generated raylib/rlgl/raymath binding module. Release
|
|
archives include it next to the binary; when building from source, `make`
|
|
generates it automatically.
|
|
|
|
On Windows, use `cmd` or PowerShell:
|
|
|
|
```bat
|
|
hate-no-d.exe quick-start.lua
|
|
```
|
|
|
|
## Building
|
|
|
|
You can download precompiled builds from the [releases page](https://git.pbento.pt/pedro-bento/hate-no-d/releases).
|
|
|
|
### Linux prerequisites
|
|
|
|
Install a C toolchain, `git` and the OpenGL/X11 development 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
|
|
|
|
Install the Xcode Command Line Tools:
|
|
|
|
```sh
|
|
xcode-select --install
|
|
```
|
|
|
|
`make` and `clang` come with them. Install the host LuaJIT used by the binding
|
|
generator:
|
|
|
|
```sh
|
|
brew install luajit
|
|
```
|
|
|
|
### BSD prerequisites
|
|
|
|
Install GNU Make and the X11 development headers. FreeBSD:
|
|
|
|
```sh
|
|
sudo pkg install gmake luajit libX11 libXrandr libXinerama libXi libXcursor
|
|
```
|
|
|
|
On OpenBSD, NetBSD and DragonFly, install `gmake` and `luajit` with the system
|
|
package manager (`pkg_add gmake luajit`, `pkgin install gmake luajit` or
|
|
`pkg install gmake luajit`); X11 headers are usually in the base X sets, but
|
|
install the X11 libraries if they are missing. Use `gmake` instead of `make`.
|
|
|
|
### Android prerequisites
|
|
|
|
Android builds cross-compile from Linux or macOS. Install the Android NDK and
|
|
pass its path with `ANDROID_NDK`, or set `ANDROID_NDK_HOME`.
|
|
|
|
### Windows prerequisites
|
|
|
|
For MSVC, install Visual Studio 2022 with the "Desktop development with C++" workload. `build.bat` locates it automatically and uses the bundled CMake when available; raylib requires CMake 3.22 or newer, so install CMake if your VS2022 copy bundles an older version.
|
|
|
|
For MinGW, use MSYS2 with the mingw-w64 toolchain and `make`. A native MSYS2 build is auto-detected; when cross-compiling from another host, pass `PLATFORM=Windows` (and `WIN_ARCH=i686` for 32-bit).
|
|
|
|
### Building from source
|
|
|
|
To build manually on Linux, macOS or a BSD, run:
|
|
|
|
```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`; the generator needs a
|
|
host `luajit` in `PATH` (override with `make LUAJIT=/path/to/luajit`). On the
|
|
BSDs, use `gmake` instead of `make`.
|
|
|
|
On Windows with MinGW (MSYS2), run `make` in the MSYS2 MINGW shell. To cross-compile
|
|
from another host, run `make PLATFORM=Windows` (add `WIN_ARCH=i686` for 32-bit).
|
|
|
|
On Windows with MSVC:
|
|
|
|
```bat
|
|
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
|
|
cd hate-no-d
|
|
build.bat
|
|
```
|
|
|
|
To build for Android from Linux or macOS, pass your NDK path (or set `ANDROID_NDK_HOME`):
|
|
|
|
```sh
|
|
make PLATFORM=Android ANDROID_NDK=/path/to/ndk
|
|
```
|
|
|
|
`ANDROID_ABI` defaults to `arm64-v8a` and `ANDROID_API` to `21`; see `make help` for the other ABIs. Building `armeabi-v7a` on a 64-bit host also needs `HOST_CC="gcc -m32"`.
|