Reviewed-on: #15 Co-authored-by: pedro-bento <mail@pbento.pt> Co-committed-by: pedro-bento <mail@pbento.pt>
3.8 KiB
hate-no-d
A Love2D antagonist.
A glorified 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:
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:
./hate-no-d quick-start.lua
On Windows:
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.
Linux prerequisites
Install a C toolchain, git, LuaJIT and the OpenGL/X11 headers.
Debian/Ubuntu:
sudo apt install build-essential git luajit libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
Fedora:
sudo dnf install gcc make git luajit mesa-libGL-devel libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
Arch:
sudo pacman -S --needed base-devel git luajit mesa libx11 libxrandr libxinerama libxcursor libxi
Void:
sudo xbps-install -S base-devel git luajit MesaLib-devel libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
Gentoo:
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
xcode-select --install
brew install luajit
The Command Line Tools provide make and clang; LuaJIT runs the binding
generator.
BSD prerequisites
FreeBSD:
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:
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:
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:
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".