Add raylib-esp32 lib and FloorPlan3D demo (3D floor plan via rlsw)
Vendor raylib-esp32 v1.0.3 (63db94b) under lib/ — raylib 6.x core with the rlsw software renderer plus the ESP32-S3 port layer (SPI display drivers, async double-buffered flush). raylib/examples, projects, tools and logo are trimmed (~80 MB of content nothing here compiles); see lib/raylib-esp32/VENDOR.md for provenance. New floorplan3d-demo (emulator-template base) renders the NetDeck demo map (nd_demomap.h) as a 3D floor plan — bulkhead walls, blast door, cover crates, airlock pad, terminal — through the real on-device 3D stack on the desktop: - rcore_emu.c: desktop PLATFORM_CUSTOM layer mirroring rcore_esp32.c, flushing the RGB565 sw-renderer buffer into emuGfx::fb instead of SPI - raylib_emu_config.h: same module/limit defines as the device build - HUD via 3x5 bitmap font into fb: rlsw's 2D textured-quad path (DrawText/DrawRectangle) misplaces/flips quads and samples wrong atlas texels in this build; the 3D path is pixel-accurate Verified: dual build (make netdeck) green, demo smoke test clean at ~59 FPS, 600-frame stability run OK.
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
# Build artifacts
|
||||||
|
*-emu
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Captured frames
|
||||||
|
*.bmp
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# Makefile for the FloorPlan3D demo — emulator-template base + raylib-esp32.
|
||||||
|
#
|
||||||
|
# Builds raylib 6.x (from lib/raylib-esp32's raylib submodule) with the rlsw
|
||||||
|
# SOFTWARE renderer behind a custom platform layer (rcore_emu.c) that blits
|
||||||
|
# the RGB565 framebuffer into the SDL host — the same library, renderer and
|
||||||
|
# SwapScreenBuffer flow that runs on the T-Deck's ESP32-S3.
|
||||||
|
#
|
||||||
|
# Build & run: make run (from this directory)
|
||||||
|
# Smoke test: make smoke
|
||||||
|
|
||||||
|
APP ?= FloorPlan
|
||||||
|
APP_DIR := examples/$(APP)
|
||||||
|
|
||||||
|
# raylib-esp32 sources (raylib core + software renderer)
|
||||||
|
RAYLIB := ../lib/raylib-esp32/raylib
|
||||||
|
|
||||||
|
# SDL3 flags via pkg-config
|
||||||
|
SDLFLAGS := $(shell pkg-config --cflags sdl3 sdl3-ttf)
|
||||||
|
LIBS := $(shell pkg-config --libs sdl3 sdl3-ttf)
|
||||||
|
|
||||||
|
CXX ?= g++
|
||||||
|
CC ?= cc
|
||||||
|
CXXFLAGS ?= -std=gnu++17 -O2 -Wall -Wextra
|
||||||
|
CFLAGS := -std=gnu11 -O2 \
|
||||||
|
-DGRAPHICS_API_OPENGL_SOFTWARE -DPLATFORM_CUSTOM -DEXTERNAL_CONFIG_FLAGS \
|
||||||
|
-include raylib_emu_config.h \
|
||||||
|
-Wno-incompatible-pointer-types -Wno-uninitialized -Wno-nonnull \
|
||||||
|
-Wno-return-type -Wno-unused-variable -Wno-unused-function \
|
||||||
|
-Wno-unused-label -Wno-stringop-truncation
|
||||||
|
|
||||||
|
# Include current dir for shim.h/rcore_emu.c, the sketch dir, raylib, NetDeck
|
||||||
|
INC := -I . -I $(APP_DIR) -I $(RAYLIB)/src -I ../src/netdeck
|
||||||
|
|
||||||
|
# Preprocessor definitions: app name, .ino filename, and the sketch source
|
||||||
|
# path. main.cpp does `#include APP_SRC`, so switching APP is enough.
|
||||||
|
DEFS += -DAPP_INO='"$(APP).ino"' -DAPP_NAME='"$(APP)"' \
|
||||||
|
-DAPP_SRC='"$(APP_DIR)/$(APP).cpp"'
|
||||||
|
|
||||||
|
SHIMS := $(wildcard *.h)
|
||||||
|
|
||||||
|
# Main entry point for this template (standalone, no HW deps)
|
||||||
|
EMU_MAIN := src/main.cpp
|
||||||
|
|
||||||
|
EMU := $(APP)-emu
|
||||||
|
|
||||||
|
# --- raylib core translation units (same set as raylib-esp32 builds) -------
|
||||||
|
RL_SRCS := rcore.c rshapes.c rtextures.c rtext.c rmodels.c
|
||||||
|
RL_SRCDIR := $(RAYLIB)/src
|
||||||
|
RLOBJS := $(addprefix build/,$(RL_SRCS:.c=.o)) build/rcore_emu.o
|
||||||
|
|
||||||
|
all: $(EMU)
|
||||||
|
|
||||||
|
build/%.o: $(RL_SRCDIR)/%.c
|
||||||
|
@mkdir -p build
|
||||||
|
$(CC) $(CFLAGS) $(INC) -c $< -o $@
|
||||||
|
|
||||||
|
build/rcore_emu.o: rcore_emu.c $(SHIMS)
|
||||||
|
@mkdir -p build
|
||||||
|
$(CC) $(CFLAGS) $(INC) -c $< -o $@
|
||||||
|
|
||||||
|
# Compile + link: main.cpp includes the sketch .cpp, forming one TU.
|
||||||
|
$(EMU): $(EMU_MAIN) $(SHIMS) $(APP_DIR)/$(APP).cpp $(RLOBJS)
|
||||||
|
$(CXX) $(CXXFLAGS) $(SDLFLAGS) $(INC) $(DEFS) $(EMU_MAIN) $(RLOBJS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
run: $(EMU)
|
||||||
|
./$(EMU)
|
||||||
|
|
||||||
|
smoke: $(EMU)
|
||||||
|
./$(EMU) --frames 240 --dump smoke_frame.bmp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build $(EMU)
|
||||||
|
|
||||||
|
.PHONY: all run smoke clean
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# FloorPlan3D — NetDeck demo map in real 3D (raylib-esp32 + rlsw)
|
||||||
|
|
||||||
|
A 320x240 emulator-only demo that renders the **NetDeck "Breach & Board"
|
||||||
|
demo ship** (`src/netdeck/nd_demomap.h`: airlock, L-shaped main corridor,
|
||||||
|
server room) as a 3D floor plan — bulkhead walls, blast door, cover
|
||||||
|
crates, airlock pad and terminal extruded from the 40x24 tile grid.
|
||||||
|
|
||||||
|
It is the first demo to run the **actual on-device 3D stack** on the
|
||||||
|
desktop: [raylib-esp32](https://github.com/jensroth-git/raylib-esp32)
|
||||||
|
(raylib 6.x + the `rlsw` **software renderer**, the same code that runs on
|
||||||
|
the T-Deck's ESP32-S3), vendored at `../lib/raylib-esp32`.
|
||||||
|
|
||||||
|
## Why this matters for NetDeck
|
||||||
|
|
||||||
|
Previous demos (cyberspace-demo, tron-demo) hand-rolled their 3D-ish
|
||||||
|
effects into `emuGfx::fb`. This one instead runs raylib's real 3D
|
||||||
|
pipeline (projection matrices, depth buffer, mesh batching) through
|
||||||
|
`rlsw`, with only the final display flush swapped:
|
||||||
|
|
||||||
|
| | On device (raylib-esp32) | This demo (desktop) |
|
||||||
|
|---|---|---|
|
||||||
|
| Renderer | `rlsw` software renderer, RGB565 + D16 | identical (`-DGRAPHICS_API_OPENGL_SOFTWARE`) |
|
||||||
|
| Platform layer | `src/platform/rcore_esp32.c` (SPI panel flush) | `rcore_emu.c` (blits into `emuGfx::fb`) |
|
||||||
|
| Config | `include/raylib_esp32_config.h` | `raylib_emu_config.h` (same module/limit defines) |
|
||||||
|
|
||||||
|
What renders correctly here is what the T-Deck would render — the demo
|
||||||
|
is a faithful preview of a firmware-side raylib integration.
|
||||||
|
|
||||||
|
## Build & run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make run # builds and opens a window
|
||||||
|
make smoke # headless: 240 frames, dumps smoke_frame.bmp
|
||||||
|
make clean
|
||||||
|
```
|
||||||
|
|
||||||
|
(The raylib core is compiled from `../lib/raylib-esp32/raylib/src` as C
|
||||||
|
objects in `build/`, then linked with the SDL3 host. First build takes a
|
||||||
|
few seconds longer than the plain template.)
|
||||||
|
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
`a`/`d` spin the camera · `w`/`s` tilt · `q`/`e` zoom · `r` reset ·
|
||||||
|
auto-spin resumes on its own; the 10 s auto-exit safety hatch from the
|
||||||
|
template still applies (`--user-run` to disable, see template README).
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
emulator-template SDL3 host (src/main.cpp, shim.h)
|
||||||
|
└─ examples/FloorPlan/FloorPlan.cpp setup()/loop() sketch
|
||||||
|
├─ emu_raylib_set_framebuffer() tell the platform layer the size
|
||||||
|
├─ InitWindow/BeginDrawing/... plain raylib API
|
||||||
|
│ └─ rlsw software renderer RGB565 + D16 framebuffers
|
||||||
|
├─ rcore_emu.c (PLATFORM_CUSTOM) SwapScreenBuffer → present hook
|
||||||
|
├─ emu_raylib_present() RGB565 → emuGfx::fb (ABGR8888)
|
||||||
|
└─ HUD drawn straight into fb 3x5 bitmap font, raylib-2D-free
|
||||||
|
```
|
||||||
|
|
||||||
|
The platform layer mirrors raylib-esp32's `rcore_esp32.c`: same expected
|
||||||
|
symbols for a `PLATFORM_CUSTOM` rcore build, same `swSwapColorBuffer()`
|
||||||
|
double-buffer flow in `SwapScreenBuffer()` — only the flush target is the
|
||||||
|
emulator framebuffer instead of an SPI panel.
|
||||||
|
|
||||||
|
## Known limitation: rlsw 2D quads
|
||||||
|
|
||||||
|
The rlsw software renderer in raylib-esp32 1.0.3 misrenders the 2D
|
||||||
|
textured-quad path used by `DrawText`/`DrawRectangle`: glyph quads come
|
||||||
|
out vertically flipped and displaced, solid fills can sample wrong atlas
|
||||||
|
texels, and quad placement shifts with geometry (verified by dumping the
|
||||||
|
raw RGB565 buffer). The 3D path (cubes, planes, lines,
|
||||||
|
vertex colors, depth) is pixel-accurate. This demo therefore renders
|
||||||
|
**everything 3D through raylib** and draws the HUD with a 3x5 bitmap
|
||||||
|
font directly into `emuGfx::fb` (same approach as cyberspace-demo).
|
||||||
|
If you need raylib 2D on device, debug `rlsw`'s textured-quad sampler
|
||||||
|
first — the 3D-only workaround below sidesteps it entirely.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT template + zlib raylib; raylib-esp32 is MIT/zlib (see
|
||||||
|
`../lib/raylib-esp32/LICENSE`).
|
||||||
@@ -0,0 +1,314 @@
|
|||||||
|
/**
|
||||||
|
* FloorPlan3D — NetDeck demo map rendered as a 3D floor plan with raylib.
|
||||||
|
*
|
||||||
|
* Uses raylib-esp32's raylib 6.x core + rlsw software renderer (the exact
|
||||||
|
* same library and renderer that runs on the T-Deck's ESP32-S3 — see
|
||||||
|
* lib/raylib-esp32), driven by the emulator-template SDL host. The platform
|
||||||
|
* layer (rcore_emu.c) hands the RGB565 software-renderer framebuffer to
|
||||||
|
* emu_raylib_present() below, which blits it into emuGfx::fb.
|
||||||
|
*
|
||||||
|
* Content: nd::DEMO_MAP from src/netdeck (the NetDeck "Breach & Board"
|
||||||
|
* demo ship: airlock, L-shaped main corridor, server room) extruded into
|
||||||
|
* 3D — bulkhead walls, blast door, cover crates, airlock pad, terminal.
|
||||||
|
*
|
||||||
|
* Rendering note: only the 3D pipeline (cubes/planes/lines, vertex colors)
|
||||||
|
* is used. The rlsw 2D quad path (DrawText / DrawRectangle with the font
|
||||||
|
* atlas) misplaces and corrupts quads in this build, so the HUD is drawn
|
||||||
|
* with a tiny bitmap font directly into emuGfx::fb after the raylib frame.
|
||||||
|
*
|
||||||
|
* Controls (emulator keyboard queue): a/d spin the camera, w/s tilt,
|
||||||
|
* q/e zoom, r reset.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shim.h"
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include "../../../src/netdeck/nd_demomap.h"
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
// Emulator state provided by the host (src/main.cpp)
|
||||||
|
extern uint32_t emuGfx::fb[320 * 240];
|
||||||
|
extern bool emuGfx::dirty;
|
||||||
|
extern std::deque<uint8_t> emu::keyboard;
|
||||||
|
|
||||||
|
// Platform layer hooks (rcore_emu.c)
|
||||||
|
extern "C" void emu_raylib_set_framebuffer(int w, int h);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// RGB565 → ABGR8888 blit: the software renderer's buffer lands in the
|
||||||
|
// emulator framebuffer. Called from rcore_emu.c's SwapScreenBuffer().
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
extern "C" void emu_raylib_present(const unsigned short *rgb565, int w, int h)
|
||||||
|
{
|
||||||
|
if (w != 320 || h != 240) return;
|
||||||
|
for (int i = 0; i < 320 * 240; i++) {
|
||||||
|
uint16_t px = rgb565[i];
|
||||||
|
uint8_t r5 = (px >> 11) & 0x1F;
|
||||||
|
uint8_t g6 = (px >> 5) & 0x3F;
|
||||||
|
uint8_t b5 = px & 0x1F;
|
||||||
|
// Bit-replication expansion 5→8 / 6→8
|
||||||
|
uint8_t r = (uint8_t)((r5 << 3) | (r5 >> 2));
|
||||||
|
uint8_t g = (uint8_t)((g6 << 2) | (g6 >> 4));
|
||||||
|
uint8_t b = (uint8_t)((b5 << 3) | (b5 >> 2));
|
||||||
|
emuGfx::fb[i] = 0xFF000000u | ((uint32_t)b << 16) | ((uint32_t)g << 8) | r;
|
||||||
|
}
|
||||||
|
emuGfx::dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// HUD drawing — tiny 3x5 bitmap font straight into emuGfx::fb.
|
||||||
|
// (Pattern borrowed from cyberspace-demo; raylib's 2D quad path is
|
||||||
|
// unreliable under rlsw, see note at the top.)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
static constexpr int W = 320;
|
||||||
|
static constexpr int H = 240;
|
||||||
|
|
||||||
|
static uint32_t rgb(uint8_t r, uint8_t g, uint8_t b)
|
||||||
|
{
|
||||||
|
return 0xFF000000u | ((uint32_t)b << 16) | ((uint32_t)g << 8) | r;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define F3x5(a, b, c, d, e) \
|
||||||
|
((uint16_t)(((a) << 12) | ((b) << 9) | ((c) << 6) | ((d) << 3) | (e)))
|
||||||
|
|
||||||
|
static uint16_t glyph(char ch)
|
||||||
|
{
|
||||||
|
switch (ch) {
|
||||||
|
case 'A': return F3x5(7, 5, 7, 5, 5);
|
||||||
|
case 'B': return F3x5(6, 5, 6, 5, 6);
|
||||||
|
case 'C': return F3x5(7, 4, 4, 4, 7);
|
||||||
|
case 'D': return F3x5(6, 5, 5, 5, 6);
|
||||||
|
case 'E': return F3x5(7, 4, 7, 4, 7);
|
||||||
|
case 'F': return F3x5(7, 4, 7, 4, 4);
|
||||||
|
case 'G': return F3x5(7, 4, 5, 5, 7);
|
||||||
|
case 'H': return F3x5(5, 5, 7, 5, 5);
|
||||||
|
case 'I': return F3x5(7, 2, 2, 2, 7);
|
||||||
|
case 'L': return F3x5(4, 4, 4, 4, 7);
|
||||||
|
case 'M': return F3x5(5, 7, 7, 5, 5);
|
||||||
|
case 'N': return F3x5(6, 5, 5, 5, 5);
|
||||||
|
case 'O': return F3x5(7, 5, 5, 5, 7);
|
||||||
|
case 'P': return F3x5(7, 5, 7, 4, 4);
|
||||||
|
case 'R': return F3x5(7, 5, 6, 5, 5);
|
||||||
|
case 'S': return F3x5(7, 4, 7, 1, 7);
|
||||||
|
case 'T': return F3x5(7, 2, 2, 2, 2);
|
||||||
|
case 'U': return F3x5(5, 5, 5, 5, 7);
|
||||||
|
case 'W': return F3x5(5, 5, 7, 7, 5);
|
||||||
|
case 'X': return F3x5(5, 5, 2, 5, 5);
|
||||||
|
case 'Y': return F3x5(5, 5, 2, 2, 2);
|
||||||
|
case 'Z': return F3x5(7, 1, 2, 4, 7);
|
||||||
|
case '0': return F3x5(7, 5, 5, 5, 7);
|
||||||
|
case '1': return F3x5(2, 6, 2, 2, 7);
|
||||||
|
case '2': return F3x5(7, 1, 7, 4, 7);
|
||||||
|
case '3': return F3x5(7, 1, 7, 1, 7);
|
||||||
|
case '4': return F3x5(5, 5, 7, 1, 1);
|
||||||
|
case '5': return F3x5(7, 4, 7, 1, 7);
|
||||||
|
case '6': return F3x5(4, 4, 7, 5, 7);
|
||||||
|
case '7': return F3x5(7, 1, 1, 2, 2);
|
||||||
|
case '8': return F3x5(7, 5, 7, 5, 7);
|
||||||
|
case '9': return F3x5(7, 5, 7, 1, 7);
|
||||||
|
case '/': return F3x5(1, 1, 2, 4, 4);
|
||||||
|
case '-': return F3x5(0, 0, 7, 0, 0);
|
||||||
|
case ':': return F3x5(0, 2, 0, 2, 0);
|
||||||
|
case '.': return F3x5(0, 0, 0, 0, 2);
|
||||||
|
case ' ': default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pset(int x, int y, uint32_t c)
|
||||||
|
{
|
||||||
|
if (x >= 0 && x < W && y >= 0 && y < H) emuGfx::fb[y * W + x] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drawText(int x, int y, const char *s, uint32_t c, int scale = 1)
|
||||||
|
{
|
||||||
|
while (*s) {
|
||||||
|
if (*s != ' ') {
|
||||||
|
uint16_t g = glyph(*s);
|
||||||
|
for (int r = 0; r < 5; r++) {
|
||||||
|
int bits = (g >> (12 - 3 * r)) & 7;
|
||||||
|
for (int col = 0; col < 3; col++) {
|
||||||
|
if (!(bits & (4 >> col))) continue;
|
||||||
|
for (int py = 0; py < scale; py++)
|
||||||
|
for (int px = 0; px < scale; px++)
|
||||||
|
pset(x + col * scale + px, y + r * scale + py, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x += 4 * scale;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Demo state
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
static constexpr float TILE_W = 1.0f; // one tile = 1 world unit
|
||||||
|
static constexpr float MAP_W = nd::TILE_COLS * TILE_W; // 40
|
||||||
|
static constexpr float MAP_H = nd::TILE_ROWS * TILE_W; // 24
|
||||||
|
static constexpr float WALL_H = 1.6f;
|
||||||
|
|
||||||
|
// Camera orbit parameters (auto-rotating inspection tour)
|
||||||
|
static float camYawDeg = -35.0f; // rotation around the map
|
||||||
|
static float camPitchDeg = 55.0f; // tilt down from horizontal
|
||||||
|
static float camDist = 44.0f; // distance from map center
|
||||||
|
static float yawSpeed = 14.0f; // deg/s auto-spin
|
||||||
|
static bool autoSpin = true;
|
||||||
|
static unsigned long lastMs = 0;
|
||||||
|
static unsigned long fpsFrames = 0, fpsT0 = 0, fpsShow = 0;
|
||||||
|
|
||||||
|
// Palette (NetDeck-ish: steel walls, cyan network accents)
|
||||||
|
static const Color COL_FLOOR = { 38, 44, 54, 255 };
|
||||||
|
static const Color COL_WALL = { 124, 134, 142, 255 };
|
||||||
|
static const Color COL_WALLTOP = { 168, 178, 186, 255 };
|
||||||
|
static const Color COL_DOOR = { 232, 62, 48, 255 };
|
||||||
|
static const Color COL_CRATE = { 240, 156, 40, 255 };
|
||||||
|
static const Color COL_AIRLOCK = { 46, 196, 118, 255 };
|
||||||
|
static const Color COL_TERM = { 72, 207, 229, 255 };
|
||||||
|
static const Color COL_SKY = { 18, 20, 28, 255 };
|
||||||
|
|
||||||
|
static const uint32_t HUD_MAIN = rgb( 72, 207, 229);
|
||||||
|
static const uint32_t HUD_DIM = rgb(150, 158, 168);
|
||||||
|
static const uint32_t HUD_BAR = rgb( 12, 14, 20);
|
||||||
|
static const uint32_t HUD_OK = rgb( 46, 196, 118);
|
||||||
|
|
||||||
|
static void tileToWorld(float tx, float ty, float *wx, float *wz)
|
||||||
|
{
|
||||||
|
*wx = (tx - nd::TILE_COLS / 2.0f + 0.5f) * TILE_W;
|
||||||
|
*wz = (ty - nd::TILE_ROWS / 2.0f + 0.5f) * TILE_W;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void applyCamera(Camera3D *cam)
|
||||||
|
{
|
||||||
|
float yaw = camYawDeg * DEG2RAD;
|
||||||
|
float pitch = camPitchDeg * DEG2RAD;
|
||||||
|
float cx = cosf(pitch) * sinf(yaw) * camDist;
|
||||||
|
float cy = sinf(pitch) * camDist;
|
||||||
|
float cz = cosf(pitch) * cosf(yaw) * camDist;
|
||||||
|
cam->position = (Vector3){ cx, cy, cz };
|
||||||
|
cam->target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
|
cam->up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||||
|
cam->fovy = 45.0f;
|
||||||
|
cam->projection = CAMERA_PERSPECTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drawHud()
|
||||||
|
{
|
||||||
|
// Bottom strip (NetDeck layout: 320x48 HUD bar under the tactical view)
|
||||||
|
for (int y = nd::VIEW_H; y < H; y++)
|
||||||
|
for (int x = 0; x < W; x++) pset(x, y, HUD_BAR);
|
||||||
|
|
||||||
|
drawText(8, nd::VIEW_H + 8, "NETDECK :: BREACH & BOARD", HUD_MAIN);
|
||||||
|
drawText(8, nd::VIEW_H + 24, "A/D SPIN W/S TILT Q/E ZOOM R RESET", HUD_DIM);
|
||||||
|
|
||||||
|
drawText(262, nd::VIEW_H + 8, "RLSW 3D", HUD_DIM);
|
||||||
|
char buf[16];
|
||||||
|
snprintf(buf, sizeof(buf), "%lu FPS", (unsigned long)fpsShow);
|
||||||
|
drawText(262, nd::VIEW_H + 24, buf, HUD_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
emu_raylib_set_framebuffer(W, H); // platform layer needs the size first
|
||||||
|
InitWindow(W, H, "FloorPlan3D");
|
||||||
|
SetTargetFPS(60);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
// Delta time (seconds since previous frame), clamped after stalls
|
||||||
|
unsigned long now = millis();
|
||||||
|
float dt = lastMs ? (now - lastMs) / 1000.0f : 1.0f / 60.0f;
|
||||||
|
lastMs = now;
|
||||||
|
if (dt > 0.1f) dt = 0.1f;
|
||||||
|
|
||||||
|
// FPS counter (1 s window, measured with millis() like on hardware)
|
||||||
|
fpsFrames++;
|
||||||
|
if (!fpsT0) fpsT0 = now;
|
||||||
|
if (now - fpsT0 >= 1000) {
|
||||||
|
fpsShow = fpsFrames * 1000 / (now - fpsT0);
|
||||||
|
fpsFrames = 0; fpsT0 = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Keyboard (emulator queue: 'a', 'd', ..., 0x08, 0x7F) ---
|
||||||
|
while (!emu::keyboard.empty()) {
|
||||||
|
uint8_t k = emu::keyboard.front();
|
||||||
|
emu::keyboard.pop_front();
|
||||||
|
switch (k) {
|
||||||
|
case 'a': camYawDeg -= 15.0f; autoSpin = false; break;
|
||||||
|
case 'd': camYawDeg += 15.0f; autoSpin = false; break;
|
||||||
|
case 'w': camPitchDeg += 6.0f; if (camPitchDeg > 85) camPitchDeg = 85; break;
|
||||||
|
case 's': camPitchDeg -= 6.0f; if (camPitchDeg < 15) camPitchDeg = 15; break;
|
||||||
|
case 'q': camDist += 2.0f; if (camDist > 60) camDist = 60; break;
|
||||||
|
case 'e': camDist -= 2.0f; if (camDist < 8) camDist = 8; break;
|
||||||
|
case 'r': camYawDeg = -35; camPitchDeg = 55; camDist = 44; autoSpin = true; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (autoSpin) camYawDeg += yawSpeed * dt;
|
||||||
|
|
||||||
|
// --- Render the 3D floor plan through raylib + rlsw ---
|
||||||
|
Camera3D cam;
|
||||||
|
applyCamera(&cam);
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(COL_SKY);
|
||||||
|
|
||||||
|
BeginMode3D(cam);
|
||||||
|
// Floor slab
|
||||||
|
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ MAP_W, MAP_H }, COL_FLOOR);
|
||||||
|
// Map grid aligned with tile boundaries
|
||||||
|
DrawGrid((int)fmaxf(MAP_W, MAP_H), TILE_W);
|
||||||
|
|
||||||
|
// Extrude the tile map
|
||||||
|
for (int ty = 0; ty < nd::TILE_ROWS; ty++) {
|
||||||
|
for (int tx = 0; tx < nd::TILE_COLS; tx++) {
|
||||||
|
char c = nd::DEMO_MAP[ty][tx];
|
||||||
|
if (c == ' ') continue;
|
||||||
|
float wx, wz;
|
||||||
|
tileToWorld((float)tx, (float)ty, &wx, &wz);
|
||||||
|
switch (c) {
|
||||||
|
case '#': // bulkhead wall
|
||||||
|
DrawCube((Vector3){ wx, WALL_H / 2, wz },
|
||||||
|
TILE_W, WALL_H, TILE_W, COL_WALL);
|
||||||
|
break;
|
||||||
|
case '+': // blast door
|
||||||
|
DrawCube((Vector3){ wx, WALL_H / 2, wz },
|
||||||
|
TILE_W * 0.9f, WALL_H, TILE_W * 0.9f, COL_DOOR);
|
||||||
|
break;
|
||||||
|
case 'o': // cover crate
|
||||||
|
DrawCube((Vector3){ wx, 0.35f, wz },
|
||||||
|
TILE_W * 0.7f, 0.7f, TILE_W * 0.7f, COL_CRATE);
|
||||||
|
break;
|
||||||
|
case 'A': // airlock pad
|
||||||
|
DrawCube((Vector3){ wx, 0.05f, wz },
|
||||||
|
TILE_W * 0.95f, 0.1f, TILE_W * 0.95f, COL_AIRLOCK);
|
||||||
|
break;
|
||||||
|
case 'T': // terminal
|
||||||
|
DrawCube((Vector3){ wx, 0.25f, wz },
|
||||||
|
TILE_W * 0.8f, 0.5f, TILE_W * 0.8f, COL_TERM);
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wall tops: a lighter cap plate makes the wall run read at a glance
|
||||||
|
for (int ty = 0; ty < nd::TILE_ROWS; ty++) {
|
||||||
|
for (int tx = 0; tx < nd::TILE_COLS; tx++) {
|
||||||
|
if (nd::DEMO_MAP[ty][tx] != '#') continue;
|
||||||
|
float wx, wz;
|
||||||
|
tileToWorld((float)tx, (float)ty, &wx, &wz);
|
||||||
|
DrawCube((Vector3){ wx, WALL_H + 0.03f, wz },
|
||||||
|
TILE_W, 0.06f, TILE_W, COL_WALLTOP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EndMode3D();
|
||||||
|
EndDrawing();
|
||||||
|
|
||||||
|
// --- HUD: drawn straight into the emulator framebuffer ---
|
||||||
|
drawHud();
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
/**
|
||||||
|
* raylib_emu_config.h — raylib build configuration for the FloorPlan3D
|
||||||
|
* emulator demo (desktop port of raylib-esp32's raylib_esp32_config.h).
|
||||||
|
*
|
||||||
|
* raylib-esp32 (lib/raylib-esp32) runs raylib 6.x on the ESP32-S3 using the
|
||||||
|
* rlsw software renderer (GRAPHICS_API_OPENGL_SOFTWARE) behind a custom
|
||||||
|
* platform layer. This demo uses the exact same raylib code and renderer on
|
||||||
|
* the desktop, so what you see in the emulator is what the T-Deck would
|
||||||
|
* render — only the display flush differs (SDL framebuffer instead of SPI).
|
||||||
|
*
|
||||||
|
* This header is force-included (-include) into every raylib translation
|
||||||
|
* unit by the Makefile, mirroring the library's pio_build.py.
|
||||||
|
*/
|
||||||
|
#ifndef RAYLIB_EMU_CONFIG_H
|
||||||
|
#define RAYLIB_EMU_CONFIG_H
|
||||||
|
|
||||||
|
#ifndef EXTERNAL_CONFIG_FLAGS
|
||||||
|
#define EXTERNAL_CONFIG_FLAGS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Software renderer framebuffer — same format as on the ESP32 build so the
|
||||||
|
// 565→8888 blit into emuGfx::fb is byte-identical to the device path.
|
||||||
|
#define SW_FRAMEBUFFER_COLOR_TYPE R5G6B5
|
||||||
|
#define SW_FRAMEBUFFER_DEPTH_TYPE D16
|
||||||
|
#define SW_FRAMEBUFFER_OUTPUT_BGRA false
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Module selection (audio off, same as on-device)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_MODULE_RSHAPES 1
|
||||||
|
#define SUPPORT_MODULE_RTEXTURES 1
|
||||||
|
#define SUPPORT_MODULE_RTEXT 1
|
||||||
|
#define SUPPORT_MODULE_RMODELS 1
|
||||||
|
#define SUPPORT_MODULE_RAUDIO 0
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rcore
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_CAMERA_SYSTEM 1
|
||||||
|
#define SUPPORT_GESTURES_SYSTEM 1
|
||||||
|
#define SUPPORT_RPRAND_GENERATOR 1
|
||||||
|
#define SUPPORT_MOUSE_GESTURES 0
|
||||||
|
#define SUPPORT_SSH_KEYBOARD_RPI 0
|
||||||
|
#define SUPPORT_WINMM_HIGHRES_TIMER 0
|
||||||
|
#define SUPPORT_PARTIALBUSY_WAIT_LOOP 0
|
||||||
|
#define SUPPORT_SCREEN_CAPTURE 0
|
||||||
|
#define SUPPORT_GIF_RECORDING 0
|
||||||
|
#define SUPPORT_AUTOMATION_EVENTS 0
|
||||||
|
#define SUPPORT_CLIPBOARD_IMAGE 0
|
||||||
|
|
||||||
|
#define MAX_FILEPATH_CAPACITY 512
|
||||||
|
#define MAX_FILEPATH_LENGTH 256
|
||||||
|
#define MAX_KEYBOARD_KEYS 128
|
||||||
|
#define MAX_MOUSE_BUTTONS 4
|
||||||
|
#define MAX_GAMEPADS 1
|
||||||
|
#define MAX_GAMEPAD_AXES 4
|
||||||
|
#define MAX_GAMEPAD_BUTTONS 16
|
||||||
|
#define MAX_GAMEPAD_VIBRATION_TIME 2.0f
|
||||||
|
#define MAX_TOUCH_POINTS 4
|
||||||
|
#define MAX_KEY_PRESSED_QUEUE 8
|
||||||
|
#define MAX_CHAR_PRESSED_QUEUE 8
|
||||||
|
#define MAX_DECOMPRESSION_SIZE 16
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rlgl (embedded-friendly batch sizes, same as the ESP32 build)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define RL_SUPPORT_MESH_GPU_SKINNING 0
|
||||||
|
#define RL_DEFAULT_BATCH_BUFFERS 1
|
||||||
|
#define RL_DEFAULT_BATCH_DRAWCALLS 128
|
||||||
|
#define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 2
|
||||||
|
#define RL_MAX_MATRIX_STACK_SIZE 16
|
||||||
|
#define RL_MAX_SHADER_LOCATIONS 16
|
||||||
|
#define RL_CULL_DISTANCE_NEAR 0.05
|
||||||
|
#define RL_CULL_DISTANCE_FAR 1000.0
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rshapes
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_QUADS_DRAW_MODE 1
|
||||||
|
#define SPLINE_SEGMENT_DIVISIONS 16
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rtextures — image file formats (PNG for the window icon, same as device)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_FILEFORMAT_PNG 1
|
||||||
|
#define SUPPORT_FILEFORMAT_BMP 0
|
||||||
|
#define SUPPORT_FILEFORMAT_TGA 0
|
||||||
|
#define SUPPORT_FILEFORMAT_JPG 0
|
||||||
|
#define SUPPORT_FILEFORMAT_GIF 0
|
||||||
|
#define SUPPORT_FILEFORMAT_QOI 1
|
||||||
|
#define SUPPORT_FILEFORMAT_PSD 0
|
||||||
|
#define SUPPORT_FILEFORMAT_DDS 0
|
||||||
|
#define SUPPORT_FILEFORMAT_HDR 0
|
||||||
|
#define SUPPORT_FILEFORMAT_PIC 0
|
||||||
|
#define SUPPORT_FILEFORMAT_KTX 0
|
||||||
|
#define SUPPORT_FILEFORMAT_ASTC 0
|
||||||
|
#define MAX_IMAGE_FLIP_QUEUE 2
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rtext — font file formats (embedded default font only, like on device)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_FILEFORMAT_FNT 1
|
||||||
|
#define SUPPORT_FILEFORMAT_TTF 0
|
||||||
|
#define SUPPORT_FILEFORMAT_BMF 0
|
||||||
|
#define MAX_TEXT_BUFFER_LENGTH 512
|
||||||
|
#define MAX_TEXTSPLIT_COUNT 64
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rmodels — 3D model file formats
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_FILEFORMAT_OBJ 1
|
||||||
|
#define SUPPORT_FILEFORMAT_MTL 1
|
||||||
|
#define SUPPORT_FILEFORMAT_GLTF 1
|
||||||
|
#define SUPPORT_FILEFORMAT_M3D 1
|
||||||
|
#define SUPPORT_FILEFORMAT_VOX 0
|
||||||
|
#define SUPPORT_FILEFORMAT_IQM 0
|
||||||
|
#define SUPPORT_MESH_GENERATION 1
|
||||||
|
|
||||||
|
#endif // RAYLIB_EMU_CONFIG_H
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
/**
|
||||||
|
* rcore_emu.c — raylib platform layer for the FloorPlan3D emulator demo.
|
||||||
|
*
|
||||||
|
* Desktop counterpart of raylib-esp32's src/platform/rcore_esp32.c: provides
|
||||||
|
* all symbols that rcore.c expects from a PLATFORM_CUSTOM backend, but
|
||||||
|
* instead of pushing the RGB565 software-renderer buffer to an SPI panel it
|
||||||
|
* hands it to the SDL host via emu_raylib_present() (implemented by the
|
||||||
|
* sketch in C++, which converts 565→8888 into emuGfx::fb).
|
||||||
|
*
|
||||||
|
* Everything else mirrors rcore_esp32.c so the demo and the on-device build
|
||||||
|
* exercise the same code paths (rlsw renderer, SwapScreenBuffer flow).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "raylib_emu_config.h"
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "rlgl.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
// --- Internal state --------------------------------------------------------
|
||||||
|
static int screen_width = 0;
|
||||||
|
static int screen_height = 0;
|
||||||
|
|
||||||
|
extern void *swGetColorBuffer(int *width, int *height);
|
||||||
|
extern void *swSwapColorBuffer(int *width, int *height);
|
||||||
|
|
||||||
|
// Provided by the sketch (C++): converts the RGB565 buffer into the
|
||||||
|
// emulator's ABGR8888 framebuffer and marks it dirty.
|
||||||
|
extern void emu_raylib_present(const unsigned short *rgb565, int w, int h);
|
||||||
|
|
||||||
|
// Called by the sketch before InitWindow(), mirroring raylib_esp32_init()
|
||||||
|
// (which tells the port layer the panel size on device).
|
||||||
|
void emu_raylib_set_framebuffer(int w, int h)
|
||||||
|
{
|
||||||
|
screen_width = w;
|
||||||
|
screen_height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Window management stubs
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
bool WindowShouldClose(void) { return false; }
|
||||||
|
void ToggleFullscreen(void) { TRACELOG(LOG_WARNING, "ToggleFullscreen() not available in the emulator"); }
|
||||||
|
void ToggleBorderlessWindowed(void) { TRACELOG(LOG_WARNING, "ToggleBorderlessWindowed() not available in the emulator"); }
|
||||||
|
void MaximizeWindow(void) { TRACELOG(LOG_WARNING, "MaximizeWindow() not available in the emulator"); }
|
||||||
|
void MinimizeWindow(void) { TRACELOG(LOG_WARNING, "MinimizeWindow() not available in the emulator"); }
|
||||||
|
void RestoreWindow(void) { TRACELOG(LOG_WARNING, "RestoreWindow() not available in the emulator"); }
|
||||||
|
void SetWindowState(unsigned int flags) { (void)flags; }
|
||||||
|
void ClearWindowState(unsigned int flags){ (void)flags; }
|
||||||
|
void SetWindowIcon(Image image) { (void)image; }
|
||||||
|
void SetWindowIcons(Image *imgs, int n) { (void)imgs; (void)n; }
|
||||||
|
void SetWindowTitle(const char *title) { (void)title; }
|
||||||
|
void SetWindowPosition(int x, int y) { (void)x; (void)y; }
|
||||||
|
void SetWindowMonitor(int m) { (void)m; }
|
||||||
|
void SetWindowMinSize(int w, int h) { (void)w; (void)h; }
|
||||||
|
void SetWindowMaxSize(int w, int h) { (void)w; (void)h; }
|
||||||
|
void SetWindowSize(int w, int h) { (void)w; (void)h; }
|
||||||
|
void SetWindowOpacity(float o) { (void)o; }
|
||||||
|
void SetWindowFocused(void) {}
|
||||||
|
|
||||||
|
void *GetWindowHandle(void) { return NULL; }
|
||||||
|
|
||||||
|
int GetCurrentMonitor(void) { return 0; }
|
||||||
|
Vector2 GetMonitorPosition(int m) { (void)m; return (Vector2){0, 0}; }
|
||||||
|
int GetMonitorWidth(int m) { (void)m; return screen_width; }
|
||||||
|
int GetMonitorHeight(int m) { (void)m; return screen_height; }
|
||||||
|
int GetMonitorPhysicalWidth(int m) { (void)m; return 0; }
|
||||||
|
int GetMonitorPhysicalHeight(int m) { (void)m; return 0; }
|
||||||
|
int GetMonitorRefreshRate(int m) { (void)m; return 60; }
|
||||||
|
const char *GetMonitorName(int m) { (void)m; return "T-Deck emulator"; }
|
||||||
|
Vector2 GetWindowPosition(void) { return (Vector2){0, 0}; }
|
||||||
|
Vector2 GetWindowScaleDPI(void) { return (Vector2){1.0f, 1.0f}; }
|
||||||
|
|
||||||
|
void SetClipboardText(const char *t) { (void)t; }
|
||||||
|
const char *GetClipboardText(void) { return ""; }
|
||||||
|
Image GetClipboardImage(void) { return (Image){0}; }
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Cursor stubs
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
void ShowCursor(void) {}
|
||||||
|
void HideCursor(void) {}
|
||||||
|
void EnableCursor(void) {}
|
||||||
|
void DisableCursor(void) {}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Input stubs (the sketch reads emu::keyboard directly instead)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
int SetGamepadMappings(const char *m) { (void)m; return 0; }
|
||||||
|
void SetMousePosition(int x, int y) { (void)x; (void)y; }
|
||||||
|
void SetMouseCursor(int c) { (void)c; }
|
||||||
|
const char *GetKeyName(int key) { (void)key; return ""; }
|
||||||
|
void PollInputEvents(void) {}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// SwapScreenBuffer — hand the rendered frame to the SDL host
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
void SwapScreenBuffer(void)
|
||||||
|
{
|
||||||
|
int sw_w, sw_h;
|
||||||
|
uint16_t *rendered = (uint16_t *)swSwapColorBuffer(&sw_w, &sw_h);
|
||||||
|
if (!rendered || sw_w != screen_width || sw_h != screen_height) {
|
||||||
|
TRACELOG(LOG_ERROR, "PLATFORM: Framebuffer mismatch");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emu_raylib_present(rendered, sw_w, sw_h);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Timing
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
double GetTime(void)
|
||||||
|
{
|
||||||
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
return (double)ts.tv_sec + (double)ts.tv_nsec / 1000000000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Misc
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
void OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
if (strchr(url, '\'') != NULL)
|
||||||
|
TRACELOG(LOG_WARNING, "SYSTEM: Provided URL contains suspicious character");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Platform init / close
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
int InitPlatform(void);
|
||||||
|
bool InitGraphicsDevice(void);
|
||||||
|
|
||||||
|
bool CreateWindowFramebuffer(int width, int height)
|
||||||
|
{
|
||||||
|
screen_width = width;
|
||||||
|
screen_height = height;
|
||||||
|
TRACELOG(LOG_INFO, "PLATFORM: Framebuffer %dx%d (RGB565, software renderer)", width, height);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int InitPlatform(void)
|
||||||
|
{
|
||||||
|
if (screen_width == 0 || screen_height == 0) {
|
||||||
|
// Mirrors the ESP32 port: display size must be known before InitWindow().
|
||||||
|
TRACELOG(LOG_ERROR, "PLATFORM: Framebuffer size unknown — call "
|
||||||
|
"emu_raylib_set_framebuffer(w, h) before InitWindow()");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateWindowFramebuffer(screen_width, screen_height);
|
||||||
|
TRACELOG(LOG_INFO, "PLATFORM: Emulator initialized (%dx%d)", screen_width, screen_height);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClosePlatform(void)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_INFO, "PLATFORM: Emulator closed");
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
/**
|
||||||
|
* Minimal emulator shim — provides only the subset of Arduino API needed
|
||||||
|
* for graphics/engine prototypes running on the SDL3 emulator.
|
||||||
|
*
|
||||||
|
* Include this single header in your sketch:
|
||||||
|
* #include "shim.h"
|
||||||
|
*
|
||||||
|
* The template's main.cpp includes this file and sets up the emulated state.
|
||||||
|
* This header defines: millis(), random(), randomSeed(), String, and basic
|
||||||
|
* type definitions. No GPIO, no interrupts, no peripheral dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cctype>
|
||||||
|
#include <string>
|
||||||
|
#include <deque>
|
||||||
|
#include <thread> // for std::this_thread::sleep_for
|
||||||
|
#include <chrono> // for std::chrono::milliseconds, microseconds
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Platform marker: the sketch can #ifdef EMULATOR for emulator-only code
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define EMULATOR 1
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Flash-resident data macros (no-op on emulator; flash-mapped memory)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define PROGMEM
|
||||||
|
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
|
||||||
|
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
|
||||||
|
#define pgm_read_dword(addr) (*(const unsigned long *)(addr))
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Time
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
inline unsigned long millis()
|
||||||
|
{
|
||||||
|
using namespace std::chrono;
|
||||||
|
static const auto start = steady_clock::now();
|
||||||
|
return (unsigned long)duration_cast<milliseconds>(steady_clock::now() - start).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline unsigned long micros()
|
||||||
|
{
|
||||||
|
using namespace std::chrono;
|
||||||
|
static const auto start = steady_clock::now();
|
||||||
|
return (unsigned long)duration_cast<microseconds>(steady_clock::now() - start).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void delay(unsigned long ms)
|
||||||
|
{
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void delayMicroseconds(unsigned int us)
|
||||||
|
{
|
||||||
|
std::this_thread::sleep_for(std::chrono::microseconds(us));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Random (Arduino-style)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
inline long random(long maxv) { return maxv > 0 ? std::rand() % maxv : 0; }
|
||||||
|
inline long random(long lo, long hi) { return hi > lo ? lo + std::rand() % (hi - lo) : lo; }
|
||||||
|
inline void randomSeed(unsigned long seed) { std::srand((unsigned)seed); }
|
||||||
|
|
||||||
|
// Emulated esp_random (used by some sketches)
|
||||||
|
inline uint32_t esp_random()
|
||||||
|
{
|
||||||
|
return ((uint32_t)std::rand() << 17) ^ (uint32_t)std::rand() ^ millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Minimal String class (Arduino-style)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
class String {
|
||||||
|
public:
|
||||||
|
std::string s;
|
||||||
|
String() {}
|
||||||
|
String(const char *c) : s(c) {}
|
||||||
|
String(const std::string &x) : s(x) {}
|
||||||
|
String(char c) : s(1, c) {}
|
||||||
|
String(int v) : s(std::to_string(v)) {}
|
||||||
|
String(long v) : s(std::to_string(v)) {}
|
||||||
|
String(unsigned v) : s(std::to_string(v)) {}
|
||||||
|
String(unsigned long v) : s(std::to_string(v)) {}
|
||||||
|
String(float v) : s(std::to_string(v)) {}
|
||||||
|
const char *c_str() const { return s.c_str(); }
|
||||||
|
unsigned length() const { return (unsigned)s.length(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
inline String operator+(const String &a, const String &b) { return String(a.s + b.s); }
|
||||||
|
inline String operator+(const String &a, const char *b) { return String(a.s + b); }
|
||||||
|
inline String operator+(const char *a, const String &b) { return String(std::string(a) + b.s); }
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------//
|
||||||
|
// Minimal GPIO — emulated pin levels (idle HIGH). Access via
|
||||||
|
// emu::pinLevels in the main.cpp; this shim provides a safe read API.
|
||||||
|
// For the template's purposes, users should use the emu::keyboard queue
|
||||||
|
// for input instead of raw GPIO reads.
|
||||||
|
// -------------------------------------------------------------------------//
|
||||||
|
#define INPUT 0
|
||||||
|
#define OUTPUT 1
|
||||||
|
#define INPUT_PULLUP 2
|
||||||
|
#define HIGH 1
|
||||||
|
#define LOW 0
|
||||||
|
|
||||||
|
inline void pinMode(int, int) {} // no-op in emulator
|
||||||
|
|
||||||
|
inline int digitalRead(int pin)
|
||||||
|
{
|
||||||
|
(void)pin;
|
||||||
|
return 1; // idle HIGH
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void digitalWrite(int, int) {}
|
||||||
|
|
||||||
|
// Pin edge structure — used by the emulator's ISR dispatch logic.
|
||||||
|
struct PinEdge { int pin, from, to; };
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------//
|
||||||
|
// Serial simulation (minimal)
|
||||||
|
// -------------------------------------------------------------------------//
|
||||||
|
struct SerialSim {
|
||||||
|
std::deque<std::string> *sink = nullptr;
|
||||||
|
void capture(const char *s)
|
||||||
|
{
|
||||||
|
if (!sink) return;
|
||||||
|
sink->push_back(s);
|
||||||
|
while (sink->size() > 512) sink->pop_front();
|
||||||
|
}
|
||||||
|
template <typename... A> void printf(const char *fmt, A... a)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
std::snprintf(buf, sizeof(buf), fmt, a...);
|
||||||
|
std::fputs(buf, stdout);
|
||||||
|
capture(buf);
|
||||||
|
}
|
||||||
|
void println() { std::printf("\n"); capture("\n"); }
|
||||||
|
void println(const char *s) { std::printf("%s\n", s); capture(s); capture("\n"); }
|
||||||
|
void println(const String &s) { std::printf("%s\n", s.c_str()); capture(s.c_str()); capture("\n"); }
|
||||||
|
void println(int v) { std::printf("%d\n", v); capture(std::to_string(v).c_str()); capture("\n"); }
|
||||||
|
};
|
||||||
|
|
||||||
|
// External instance — the emulator main.cpp defines this.
|
||||||
|
extern SerialSim Serial;
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,240 @@
|
|||||||
|
/**
|
||||||
|
* Minimal SDL3 host for the T-Deck emulator-only template.
|
||||||
|
*
|
||||||
|
* Sets up an SDL3 window/renderer, presents the user's framebuffer,
|
||||||
|
* and calls the user's sketch setup() / loop() each frame.
|
||||||
|
*
|
||||||
|
* This file is deliberately hardware-free: no TFT_eSPI, no SPI,
|
||||||
|
* no I2S, no GPIO matrix. It only depends on SDL3 and the shim.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#if __has_include(<SDL3/SDL_ttf.h>)
|
||||||
|
#include <SDL3/SDL_ttf.h>
|
||||||
|
#else
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
#endif
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
|
// --- Include the template's minimal shim (provides millis(), random,
|
||||||
|
// randomSeed(), String, pinMode/digitalRead, etc.) ---
|
||||||
|
#include "shim.h"
|
||||||
|
|
||||||
|
// --- Emulator shared state (defined in main.cpp below) ---
|
||||||
|
// The sketch writes to emuGfx::fb; this file presents it each frame.
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
namespace emu {
|
||||||
|
uint8_t pinLevels[64];
|
||||||
|
const char *pinDrivenBy[64];
|
||||||
|
std::deque<PinEdge> pinEdges;
|
||||||
|
bool touchDown = false;
|
||||||
|
int touchX = 0, touchY = 0;
|
||||||
|
std::deque<uint8_t> keyboard;
|
||||||
|
bool quitRequested = false;
|
||||||
|
} // namespace emu
|
||||||
|
|
||||||
|
namespace emuGfx {
|
||||||
|
uint32_t fb[320 * 240]; // ABGR8888 pixels, 320x240
|
||||||
|
SDL_Texture *tex = nullptr;
|
||||||
|
bool dirty = true;
|
||||||
|
} // namespace emuGfx
|
||||||
|
|
||||||
|
// --- Forward declarations of the user's sketch functions ---
|
||||||
|
// These will be defined in the sketch .cpp file included below.
|
||||||
|
extern "C" void setup();
|
||||||
|
extern "C" void loop();
|
||||||
|
|
||||||
|
// --- Include the user's sketch .cpp file ---
|
||||||
|
// The path comes from the Makefile: -DAPP_SRC='"examples/$(APP)/$(APP).cpp"'.
|
||||||
|
// Change APP (or replace examples/Demo/Demo.cpp) to run your own sketch.
|
||||||
|
#ifndef APP_SRC
|
||||||
|
#define APP_SRC "examples/Demo/Demo.cpp"
|
||||||
|
#endif
|
||||||
|
#include APP_SRC
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// --- Main entry point ---
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
// Parse simple command-line options
|
||||||
|
long maxFrames = -1; // --frames N: run exactly N frames then exit
|
||||||
|
const char *dumpPath = nullptr;
|
||||||
|
bool userRun = false; // --user-run: disable the safety-hatch timeout
|
||||||
|
long timeoutMs = 10000; // safety hatch: auto-exit after 10 s by default
|
||||||
|
|
||||||
|
for (int i = 1; i < argc; i++) {
|
||||||
|
if (!strcmp(argv[i], "--frames") && i + 1 < argc) maxFrames = atol(argv[++i]);
|
||||||
|
else if (!strcmp(argv[i], "--dump") && i + 1 < argc) dumpPath = argv[++i];
|
||||||
|
else if (!strcmp(argv[i], "--user-run")) userRun = true;
|
||||||
|
else if (!strcmp(argv[i], "--timeout") && i + 1 < argc) timeoutMs = atol(argv[++i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SDL3 initialization
|
||||||
|
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||||
|
std::printf("SDL_Init failed: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
TTF_Init();
|
||||||
|
|
||||||
|
// Create window matching the 320x240 canvas
|
||||||
|
SDL_Window *win = SDL_CreateWindow("T-Deck: " APP_NAME,
|
||||||
|
320, 240, SDL_WINDOW_RESIZABLE);
|
||||||
|
if (!win) {
|
||||||
|
std::printf("SDL_CreateWindow failed: %s\n", SDL_GetError());
|
||||||
|
TTF_Quit();
|
||||||
|
SDL_Quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Renderer *ren = SDL_CreateRenderer(win, NULL);
|
||||||
|
if (!ren) ren = SDL_CreateRenderer(win, "software");
|
||||||
|
SDL_SetRenderLogicalPresentation(ren, 320, 240,
|
||||||
|
SDL_LOGICAL_PRESENTATION_LETTERBOX);
|
||||||
|
emuGfx::tex = SDL_CreateTexture(ren, SDL_PIXELFORMAT_ABGR8888,
|
||||||
|
SDL_TEXTUREACCESS_STREAMING, 320, 240);
|
||||||
|
if (!emuGfx::tex) {
|
||||||
|
std::printf("SDL_CreateTexture failed: %s\n", SDL_GetError());
|
||||||
|
SDL_DestroyRenderer(ren);
|
||||||
|
SDL_DestroyWindow(win);
|
||||||
|
TTF_Quit();
|
||||||
|
SDL_Quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- User sketch initialization ---
|
||||||
|
setup();
|
||||||
|
|
||||||
|
// --- Main loop ---
|
||||||
|
bool running = true;
|
||||||
|
// Frame pacing: the sketch contract is "loop() called once per frame
|
||||||
|
// (~60 fps)". Without pacing this loop busy-spins at hundreds/thousands
|
||||||
|
// of fps on a desktop and every frame-based animation runs too fast,
|
||||||
|
// so we delay until the next 60 Hz tick before starting the next frame.
|
||||||
|
const Uint64 FRAME_MS = 1000 / 60; // ~16.7 ms per frame
|
||||||
|
Uint64 nextFrame = SDL_GetTicks() + FRAME_MS;
|
||||||
|
while (running && !emu::quitRequested) {
|
||||||
|
// --- Event pump ---
|
||||||
|
SDL_Event e;
|
||||||
|
while (SDL_PollEvent(&e)) {
|
||||||
|
if (e.type == SDL_EVENT_QUIT) {
|
||||||
|
running = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Forward key presses to the emulated I2C keyboard device
|
||||||
|
if (e.type == SDL_EVENT_KEY_DOWN) {
|
||||||
|
if (e.key.repeat) break;
|
||||||
|
SDL_Keycode k = e.key.key;
|
||||||
|
if (k == SDLK_RETURN || k == SDLK_KP_ENTER) {
|
||||||
|
emu::keyboard.push_back(' ');
|
||||||
|
}
|
||||||
|
else if (k == SDLK_SPACE) {
|
||||||
|
emu::keyboard.push_back(' ');
|
||||||
|
}
|
||||||
|
else if (k == SDLK_BACKSPACE) {
|
||||||
|
emu::keyboard.push_back(0x08);
|
||||||
|
}
|
||||||
|
else if (k == SDLK_DELETE) {
|
||||||
|
emu::keyboard.push_back(0x7F);
|
||||||
|
}
|
||||||
|
else if (k == SDLK_ESCAPE) {
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const char *name = SDL_GetKeyName(k);
|
||||||
|
if (name && strlen(name) == 1) {
|
||||||
|
emu::keyboard.push_back((uint8_t)tolower((unsigned char)name[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Safety hatch: auto-exit unless the user asked to play ---
|
||||||
|
if (!userRun && timeoutMs > 0 && millis() >= (unsigned long)timeoutMs) {
|
||||||
|
std::printf("[emu] safety hatch: exiting after %ld ms "
|
||||||
|
"(pass --user-run to run indefinitely)\n", timeoutMs);
|
||||||
|
running = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Call the user's simulation step ---
|
||||||
|
loop();
|
||||||
|
|
||||||
|
// --- Present frame if dirty ---
|
||||||
|
if (emuGfx::dirty) {
|
||||||
|
SDL_UpdateTexture(emuGfx::tex, nullptr, emuGfx::fb,
|
||||||
|
320 * sizeof(uint32_t));
|
||||||
|
emuGfx::dirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render: clear -> texture -> present
|
||||||
|
SDL_RenderClear(ren);
|
||||||
|
SDL_RenderTexture(ren, emuGfx::tex, nullptr, nullptr);
|
||||||
|
SDL_RenderPresent(ren);
|
||||||
|
|
||||||
|
// --- Frame counting / dump ---
|
||||||
|
if (maxFrames > 0 && --maxFrames == 0) {
|
||||||
|
running = false;
|
||||||
|
if (dumpPath) {
|
||||||
|
// Create a surface from the texture and save as BMP
|
||||||
|
SDL_Surface *s = SDL_CreateSurface(320, 240, SDL_PIXELFORMAT_ABGR8888);
|
||||||
|
if (s) {
|
||||||
|
// Read pixels from the texture
|
||||||
|
void *pixels;
|
||||||
|
int pitch;
|
||||||
|
SDL_LockTexture(emuGfx::tex, nullptr, &pixels, &pitch);
|
||||||
|
// Copy the framebuffer directly to the surface
|
||||||
|
Uint32 *sp = (Uint32 *)s->pixels;
|
||||||
|
for (int y = 0; y < 240; y++) {
|
||||||
|
memcpy(sp + y * s->w, emuGfx::fb + y * 320, 320 * sizeof(Uint32));
|
||||||
|
}
|
||||||
|
SDL_UnlockTexture(emuGfx::tex);
|
||||||
|
|
||||||
|
SDL_SaveBMP(s, dumpPath);
|
||||||
|
SDL_DestroySurface(s);
|
||||||
|
std::printf("[emu] frame dumped to %s\n", dumpPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Frame pacing: sleep until the next 60 Hz tick ---
|
||||||
|
Uint64 nowMs = SDL_GetTicks();
|
||||||
|
if (nowMs >= nextFrame) {
|
||||||
|
// Behind schedule (a slow frame or a stall): resync instead of
|
||||||
|
// burst-catching-up, so animation never runs fast to "make up"
|
||||||
|
// lost frames.
|
||||||
|
nextFrame = nowMs;
|
||||||
|
} else {
|
||||||
|
SDL_Delay((Uint32)(nextFrame - nowMs));
|
||||||
|
}
|
||||||
|
nextFrame += FRAME_MS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Save last frame as BMP for AI inspection ---
|
||||||
|
{
|
||||||
|
SDL_Surface *s = SDL_CreateSurface(320, 240, SDL_PIXELFORMAT_ABGR8888);
|
||||||
|
if (s) {
|
||||||
|
void *pixels;
|
||||||
|
int pitch;
|
||||||
|
SDL_LockTexture(emuGfx::tex, nullptr, &pixels, &pitch);
|
||||||
|
Uint32 *sp = (Uint32 *)s->pixels;
|
||||||
|
for (int y = 0; y < 240; y++) {
|
||||||
|
memcpy(sp + y * s->w, emuGfx::fb + y * 320, 320 * sizeof(Uint32));
|
||||||
|
}
|
||||||
|
SDL_UnlockTexture(emuGfx::tex);
|
||||||
|
SDL_SaveBMP(s, "frame.bmp");
|
||||||
|
SDL_DestroySurface(s);
|
||||||
|
std::printf("[emu] last frame saved to frame.bmp\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Cleanup ---
|
||||||
|
TTF_Quit();
|
||||||
|
SDL_DestroyTexture(emuGfx::tex);
|
||||||
|
SDL_DestroyRenderer(ren);
|
||||||
|
SDL_DestroyWindow(win);
|
||||||
|
SDL_Quit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
.pio/
|
||||||
|
.vscode/
|
||||||
|
build/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Jens Roth
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
# raylib-esp32
|
||||||
|
|
||||||
|
**Raylib 6.x for ESP32** — software-rendered 2D/3D graphics on embedded SPI displays.
|
||||||
|
|
||||||
|
Runs on ESP32-S3 (and other ESP32 variants with PSRAM) using raylib's software
|
||||||
|
renderer (`rlsw`). No GPU required.
|
||||||
|
|
||||||
|
[Demo Video](https://www.youtube.com/shorts/21pVBDuoufk)
|
||||||
|
|
||||||
|
## Supported displays
|
||||||
|
|
||||||
|
| Driver | Resolution | Notes |
|
||||||
|
|----------|-------------|-------|
|
||||||
|
| GC9A01 | 240x240 | Round display, bundled driver |
|
||||||
|
| ST7789 | up to 320x240 | Uses ESP-IDF built-in driver |
|
||||||
|
| ILI9341 | 320x240 | Uses ESP-IDF built-in driver |
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
### platformio.ini
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[env:esp32s3]
|
||||||
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||||
|
framework = arduino
|
||||||
|
board = esp32-s3-devkitc-1
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
jensroth-pio/raylib-esp32
|
||||||
|
|
||||||
|
build_flags = -DBOARD_HAS_PSRAM
|
||||||
|
board_build.arduino.memory_type = qio_opi
|
||||||
|
```
|
||||||
|
|
||||||
|
### main.cpp
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <raylib_esp32.h>
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
Camera3D camera = {0};
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
raylib_esp32_display_config_t disp = {
|
||||||
|
.driver = RAYLIB_DRIVER_GC9A01,
|
||||||
|
.spi_host = SPI2_HOST,
|
||||||
|
.pin_sclk = 12, .pin_mosi = 11,
|
||||||
|
.pin_cs = 10, .pin_dc = 9,
|
||||||
|
.pin_rst = 8, .pin_bl = 7,
|
||||||
|
.width = 240, .height = 240,
|
||||||
|
};
|
||||||
|
raylib_esp32_init(&disp);
|
||||||
|
InitWindow(240, 240, "hello");
|
||||||
|
|
||||||
|
camera.position = (Vector3){4, 4, 4};
|
||||||
|
camera.target = (Vector3){0, 0, 0};
|
||||||
|
camera.up = (Vector3){0, 1, 0};
|
||||||
|
camera.fovy = 45.0f;
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
BeginMode3D(camera);
|
||||||
|
DrawCube((Vector3){0}, 2, 2, 2, RED);
|
||||||
|
DrawCubeWires((Vector3){0}, 2, 2, 2, MAROON);
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
EndMode3D();
|
||||||
|
DrawFPS(4, 4);
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Loading assets (models, textures, fonts)
|
||||||
|
|
||||||
|
1. Set `board_build.filesystem = littlefs` in `platformio.ini`.
|
||||||
|
2. Create a `data/` folder in your project root with your assets.
|
||||||
|
3. Upload with `pio run -t uploadfs`.
|
||||||
|
4. Mount in code:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
raylib_esp32_mount_fs("/data", "spiffs"); // partition label is "spiffs" even for LittleFS
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Load normally:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
Model model = LoadModel("/data/model.glb");
|
||||||
|
Texture tex = LoadTexture("/data/texture.png");
|
||||||
|
```
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
User code (setup / loop)
|
||||||
|
|
|
||||||
|
+-- raylib_esp32_init() one-call display setup
|
||||||
|
| +-- SPI bus init
|
||||||
|
| +-- Display driver GC9A01 / ST7789 / ILI9341
|
||||||
|
| +-- Port layer DMA flush, semaphore sync
|
||||||
|
|
|
||||||
|
+-- InitWindow() standard raylib
|
||||||
|
+-- BeginDrawing / EndDrawing
|
||||||
|
|
|
||||||
|
+-- rlsw software renderer (RGB565, 16-bit depth)
|
||||||
|
+-- SwapScreenBuffer() vertical flip + port flush
|
||||||
|
```
|
||||||
|
|
||||||
|
## Memory usage (240x240 display)
|
||||||
|
|
||||||
|
| Buffer | Size | Location |
|
||||||
|
|--------|------|----------|
|
||||||
|
| SW color buffer (R5G6B5) | 112 KB | PSRAM |
|
||||||
|
| SW depth buffer (D16) | 112 KB | PSRAM |
|
||||||
|
| Display framebuffer | 112 KB | PSRAM |
|
||||||
|
| DMA chunk buffer | ~23 KB | Internal SRAM |
|
||||||
|
|
||||||
|
Total PSRAM: ~336 KB. Fits comfortably on ESP32-S3 with 2-8 MB PSRAM.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Raylib is licensed under the **zlib/libpng** license.
|
||||||
|
This wrapper follows the same license.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Vendored: raylib-esp32
|
||||||
|
|
||||||
|
Source: https://github.com/jensroth-git/raylib-esp32
|
||||||
|
Upstream commit: 63db94b3f9ff8ef9d4f04ed97520a77eeeebd9ff (v1.0.3)
|
||||||
|
|
||||||
|
The upstream repo vendors the raylib source tree in-tree (the `.gitmodules`
|
||||||
|
entry for `raysan5/raylib` is vestigial — the index tracks the files
|
||||||
|
directly). raylib version here: 6.0.
|
||||||
|
|
||||||
|
## Trimming vs upstream (this vendored copy only)
|
||||||
|
|
||||||
|
Removed because nothing in this repo compiles them and they are ~80 MB:
|
||||||
|
|
||||||
|
- `raylib/examples/`, `raylib/projects/`, `raylib/tools/`, `raylib/logo/`,
|
||||||
|
`raylib/.github/`, `raylib/cmake/`
|
||||||
|
- upstream git metadata (`.git`)
|
||||||
|
|
||||||
|
Kept intact:
|
||||||
|
|
||||||
|
- `include/` + `src/` — the ESP32 port (platform layer, display drivers,
|
||||||
|
SPI port) as used by the PlatformIO build (`library.json`/`pio_build.py`)
|
||||||
|
- `raylib/src/` — raylib core + `external/rlsw.h` software renderer
|
||||||
|
- `docs/` — ESP32 optimization notes (contains the on-device benchmarks)
|
||||||
|
- `examples/` — the library's own hello_3d / model_loading device examples
|
||||||
|
|
||||||
|
Consumers:
|
||||||
|
|
||||||
|
- `floorplan3d-demo/` — compiles `raylib/src/{rcore,rshapes,rtextures,rtext,rmodels}.c`
|
||||||
|
with `-DGRAPHICS_API_OPENGL_SOFTWARE -DPLATFORM_CUSTOM` plus a local
|
||||||
|
desktop platform layer (`rcore_emu.c`)
|
||||||
|
- future firmware integration — same recipe as `library.json` flags
|
||||||
@@ -0,0 +1,353 @@
|
|||||||
|
# ESP32 Performance Optimizations for rlsw
|
||||||
|
|
||||||
|
This document describes the ESP32-specific optimizations applied to the `rlsw` software renderer. All changes are guarded by platform-detection macros and have zero impact on non-ESP targets.
|
||||||
|
|
||||||
|
## Results summary
|
||||||
|
|
||||||
|
Measured on ESP32-S3 @ 240 MHz, 240x240 R5G6B5 display, rendering a textured 3D model
|
||||||
|
with depth testing:
|
||||||
|
|
||||||
|
| Metric | Before | After | Improvement |
|
||||||
|
|--------|--------|-------|-------------|
|
||||||
|
| Frame time | ~65 ms | ~47 ms | **-28%** |
|
||||||
|
| FPS | ~15 | ~21 | **+40%** |
|
||||||
|
| `swap` phase | 15 ms | 0.03 ms | -99.8% |
|
||||||
|
| `model` phase | 44 ms | 39 ms | -11% |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Async SPI Double-Buffer
|
||||||
|
|
||||||
|
**Files:** `rlsw.h`, `raylib_esp32_port.h`, `raylib_esp32_port.c`, `rcore_esp32.c`
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
`SwapScreenBuffer()` called `raylib_port_flush_rgb565_vflip()` which blocked
|
||||||
|
for ~15 ms doing chunked byte-swap + DMA transfer to the display. During this
|
||||||
|
time the render core sat idle.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
Double-buffer the color framebuffer and run the display transfer on a dedicated
|
||||||
|
FreeRTOS task pinned to core 0, overlapping it with rendering on core 1.
|
||||||
|
|
||||||
|
**rlsw.h changes:**
|
||||||
|
- `sw_default_framebuffer_t` now holds `sw_texture_t color[2]` + `int colorIndex`
|
||||||
|
- `sw_default_framebuffer_alloc/free` manage both buffers
|
||||||
|
- New public function `swSwapColorBuffer()` toggles the render target and
|
||||||
|
returns a pointer to the just-rendered buffer
|
||||||
|
|
||||||
|
**Port layer changes:**
|
||||||
|
- `raylib_port_flush_async(src, w, h)` — stores buffer pointer, notifies
|
||||||
|
flush task, returns immediately
|
||||||
|
- `raylib_port_wait_flush()` — blocks until the previous transfer completes
|
||||||
|
- Flush task: persistent FreeRTOS task on core 0 (4 KB stack), sleeps via
|
||||||
|
`ulTaskNotifyTake`, runs vflip + byte-swap + DMA, signals completion
|
||||||
|
|
||||||
|
**SwapScreenBuffer flow:**
|
||||||
|
```
|
||||||
|
wait_flush() // ensure previous transfer finished
|
||||||
|
rendered = swSwapColorBuffer() // swap render target, get finished buffer
|
||||||
|
flush_async(rendered) // kick off transfer on core 0
|
||||||
|
```
|
||||||
|
|
||||||
|
**Memory cost:** ~115 KB PSRAM (second color buffer) + 4 KB task stack.
|
||||||
|
|
||||||
|
Since render time (~42 ms) > transfer time (~15 ms), the wait never blocks in
|
||||||
|
steady state. Effective swap cost drops to ~30 µs.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Fast Reciprocal (`recip0.s`)
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#if defined(__XTENSA__)`
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
Float division on Xtensa uses a software `__divsf3` call (~20+ cycles). The
|
||||||
|
rasterizer performs multiple `1.0f/x` operations per triangle setup, per
|
||||||
|
16-pixel affine block, and per vertex transform.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
`sw_rcp(float x)` uses the Xtensa `recip0.s` instruction with a Newton-Raphson
|
||||||
|
refinement sequence, achieving 1-ULP accuracy in ~7 instructions (all in FPU
|
||||||
|
registers, no function call overhead):
|
||||||
|
|
||||||
|
```c
|
||||||
|
#if defined(__XTENSA__)
|
||||||
|
__attribute__((always_inline))
|
||||||
|
static inline float sw_rcp(float x)
|
||||||
|
{
|
||||||
|
float result, temp;
|
||||||
|
__asm__(
|
||||||
|
"recip0.s %0, %2\n"
|
||||||
|
"const.s %1, 1\n"
|
||||||
|
"msub.s %1, %2, %0\n"
|
||||||
|
"madd.s %0, %0, %1\n"
|
||||||
|
"const.s %1, 1\n"
|
||||||
|
"msub.s %1, %2, %0\n"
|
||||||
|
"maddn.s %0, %0, %1\n"
|
||||||
|
: "=&f"(result), "=&f"(temp) : "f"(x)
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline float sw_rcp(float x) { return 1.0f / x; }
|
||||||
|
#endif
|
||||||
|
```
|
||||||
|
|
||||||
|
Applied to all hot-path divisions:
|
||||||
|
- **Span function:** `dxRcp`, `blockLenRcp`, `wRcpA`, `wRcpB` (per span + per 16px block)
|
||||||
|
- **Triangle setup:** `h02Rcp`, `h01Rcp`, `h12Rcp` (per triangle)
|
||||||
|
- **Vertex transform:** `1/w` for clip-to-NDC conversion (per vertex)
|
||||||
|
- **Quad rasterizer:** `wRcp`, `hRcp`
|
||||||
|
- **Line rasterizer:** `stepRcp`
|
||||||
|
|
||||||
|
On non-Xtensa targets (RISC-V ESP32-C3/C6, desktop) the function transparently
|
||||||
|
falls back to `1.0f / x`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Direct R5G6B5 Pixel Read/Write
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#if defined(ESP_PLATFORM)`
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
The default R5G6B5 write path goes through three stages:
|
||||||
|
|
||||||
|
```
|
||||||
|
float[4] → sw_color_to_color8 → uint8[4] → sw_pixel_write_color8_R5G6B5 → uint16
|
||||||
|
```
|
||||||
|
|
||||||
|
This involves 4 float→int conversions (including a wasted alpha channel),
|
||||||
|
expand/compress LUT operations, and an intermediate byte array.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
**Write** (`sw_pixel_write_color_R5G6B5`): converts float RGB directly to
|
||||||
|
packed R5G6B5 in one step — 3 multiplies + 3 float→int + bit packing:
|
||||||
|
|
||||||
|
```c
|
||||||
|
uint32_t r = (uint32_t)(color[0] * 31.0f + 0.5f);
|
||||||
|
uint32_t g = (uint32_t)(color[1] * 63.0f + 0.5f);
|
||||||
|
uint32_t b = (uint32_t)(color[2] * 31.0f + 0.5f);
|
||||||
|
((uint16_t *)pixels)[offset] = (uint16_t)((r << 11) | (g << 5) | b);
|
||||||
|
```
|
||||||
|
|
||||||
|
**Read** (`sw_pixel_read_color_R5G6B5`): unpacks R5G6B5 directly to float RGB,
|
||||||
|
skipping the expand-to-uint8 intermediate:
|
||||||
|
|
||||||
|
```c
|
||||||
|
uint16_t pixel = ((const uint16_t *)pixels)[offset];
|
||||||
|
color[0] = (float)((pixel >> 11) & 0x1F) * (1.0f/31.0f);
|
||||||
|
color[1] = (float)((pixel >> 5) & 0x3F) * (1.0f/63.0f);
|
||||||
|
color[2] = (float)( pixel & 0x1F) * (1.0f/31.0f);
|
||||||
|
color[3] = 1.0f;
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Optimized Texture Sampling
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#if defined(ESP_PLATFORM)`
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
`sw_texture_sample` computes LOD (level-of-detail) every pixel — 6 float ops
|
||||||
|
(4 multiplies + 2 adds + compare) — even when `minFilter == magFilter`, making
|
||||||
|
the LOD decision meaningless. Additionally, the texel read goes through a
|
||||||
|
function pointer (`tex->readColor`), preventing inlining.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
**Skip LOD when filters match** (the common case):
|
||||||
|
|
||||||
|
```c
|
||||||
|
if (tex->minFilter == tex->magFilter) {
|
||||||
|
if (tex->minFilter == SW_NEAREST)
|
||||||
|
sw_texture_sample_nearest_inline(color, tex, u, v);
|
||||||
|
else
|
||||||
|
sw_texture_sample_linear(color, tex, u, v);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Inline nearest sampling** for common texture formats. A new
|
||||||
|
`sw_texture_sample_nearest_inline` function inlines the texel read for
|
||||||
|
R8G8B8A8 and R5G6B5 textures, avoiding the function pointer indirection and
|
||||||
|
allowing the compiler to schedule memory loads:
|
||||||
|
|
||||||
|
```c
|
||||||
|
switch (tex->format) {
|
||||||
|
case SW_PIXELFORMAT_COLOR_R8G8B8A8: { /* direct byte read */ }
|
||||||
|
case SW_PIXELFORMAT_COLOR_R5G6B5: { /* direct uint16 unpack */ }
|
||||||
|
default: tex->readColor(color, tex->pixels, offset);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Framebuffer Clear Optimization
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#if SW_COLOR_IS_R5G6B5` / `#if SW_DEPTH_IS_D16`
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
The default clear loop fills the framebuffer byte-by-byte:
|
||||||
|
|
||||||
|
```c
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
for (int b = 0; b < PIXEL_SIZE; b++)
|
||||||
|
dst[i * PIXEL_SIZE + b] = pixel[b];
|
||||||
|
```
|
||||||
|
|
||||||
|
For a 240x240 R5G6B5 buffer this means 115,200 individual byte stores.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
For R5G6B5 and D16 formats (both 2 bytes per pixel):
|
||||||
|
|
||||||
|
1. **memset fast path**: when both bytes of the packed pixel are equal (e.g.
|
||||||
|
black = `0x0000`, depth 1.0 = `0xFFFF`), use `memset` — a single call that
|
||||||
|
the runtime can optimize with DMA or wide stores.
|
||||||
|
2. **32-bit word fill**: pack two pixels into a `uint32_t` and fill with
|
||||||
|
aligned 32-bit writes, halving the number of store operations.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Compile-Time Format Detection
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
|
||||||
|
Two token-pasting macros detect the framebuffer format at compile time, enabling
|
||||||
|
`#if` guards with zero runtime cost:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#define SW_DEPTH_IS_D16 /* 1 when SW_FRAMEBUFFER_DEPTH_TYPE == D16 */
|
||||||
|
#define SW_COLOR_IS_R5G6B5 /* 1 when SW_FRAMEBUFFER_COLOR_TYPE == R5G6B5 */
|
||||||
|
```
|
||||||
|
|
||||||
|
These gate the fixed-point depth test (from a prior optimization), the direct
|
||||||
|
pixel read/write paths, and the clear optimizations.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Fixed-Point Depth Test
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#if SW_DEPTH_IS_D16`
|
||||||
|
|
||||||
|
The inner-loop depth test converts `float z` to `uint16_t` every pixel via
|
||||||
|
`(uint16_t)(z * 65535.0f)` — an expensive float→int conversion. When the depth
|
||||||
|
format is D16, the depth value and step are pre-converted to `int32_t` before
|
||||||
|
the pixel loop:
|
||||||
|
|
||||||
|
```c
|
||||||
|
int32_t z_fp = (int32_t)(z * 65535.0f);
|
||||||
|
int32_t dZdx_fp = (int32_t)(dZdx * 65535.0f);
|
||||||
|
```
|
||||||
|
|
||||||
|
The inner loop then uses integer compare and add:
|
||||||
|
|
||||||
|
```c
|
||||||
|
uint16_t z16 = (uint16_t)z_fp;
|
||||||
|
if (z16 > depth) goto discard;
|
||||||
|
((uint16_t *)dPtr)[0] = z16;
|
||||||
|
// ...
|
||||||
|
z_fp += dZdx_fp;
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. ESP-DSP Matrix Acceleration
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#ifdef SW_HAS_ESP_DSP`
|
||||||
|
|
||||||
|
When the ESP-DSP library is available, optimized matrix operations replace the
|
||||||
|
scalar implementations:
|
||||||
|
|
||||||
|
- `sw_matrix_mul_rst` → `dspm_mult_4x4x4_f32` (4×4 matrix multiply)
|
||||||
|
- Vertex MVP transform → `dspm_mult_4x4x1_f32` (4×4 × 4×1 multiply)
|
||||||
|
|
||||||
|
A row-major transposed MVP copy (`matMVP_rm`) is maintained for ESP-DSP
|
||||||
|
compatibility since `rlsw` uses column-major layout internally.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. SRAM-Aware Framebuffer Allocation
|
||||||
|
|
||||||
|
**File:** `rlsw.h`, `raylib_esp32_config.h`
|
||||||
|
**Guard:** `#ifdef CONFIG_IDF_TARGET_ESP32S3`
|
||||||
|
|
||||||
|
Custom allocator hooks (`SW_FB_REALLOC`, `SW_FB_FREE`) allow framebuffer memory
|
||||||
|
to be placed in specific memory regions. On ESP32-S3:
|
||||||
|
|
||||||
|
- `_sw_fb_alloc_prefer_internal`: tries `MALLOC_CAP_INTERNAL` first, falls back
|
||||||
|
to `MALLOC_CAP_SPIRAM`
|
||||||
|
- The depth buffer is allocated first (it benefits most from fast SRAM since it
|
||||||
|
is accessed for every pixel attempt, including occluded ones)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. Fixed-Point Color Interpolation
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#if SW_COLOR_IS_R5G6B5 && !defined(SW_ENABLE_TEXTURE) && !defined(SW_ENABLE_BLEND)`
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
In the triangle span inner loop, vertex colors were interpolated as `float[4]`,
|
||||||
|
then converted per pixel via `color[i] * 31.0f + 0.5f` → `(uint32_t)` → pack
|
||||||
|
to R5G6B5. That is 3 float multiplies + 3 float→int conversions + 4 float adds
|
||||||
|
(stepping) per pixel.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
At each affine block boundary, convert `srcColor` and `dSrcColordx` to 16.16
|
||||||
|
fixed-point pre-scaled to R5G6B5 channel ranges (×31, ×63, ×31):
|
||||||
|
|
||||||
|
```c
|
||||||
|
int32_t r_fp = (int32_t)(srcColor[0] * (31.0f * 65536.0f));
|
||||||
|
int32_t dr_fp = (int32_t)(dSrcColordx[0] * (31.0f * 65536.0f));
|
||||||
|
```
|
||||||
|
|
||||||
|
The inner pixel loop becomes pure integer: `>> 16`, clamp, shift-OR pack, and
|
||||||
|
`r_fp += dr_fp` stepping. No floats touched per pixel.
|
||||||
|
|
||||||
|
Applies to non-textured, non-blend template variants (BASE, DEPTH). Textured
|
||||||
|
paths still use float for the `srcColor × texColor` multiply.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. POT Texture Bit-Masking
|
||||||
|
|
||||||
|
**File:** `rlsw.h`
|
||||||
|
**Guard:** `#if defined(ESP_PLATFORM)` (in both `sw_texture_sample_nearest` and `sw_texture_sample_nearest_inline`)
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
For `SW_REPEAT` wrap mode, `sw_fract(u)` calls `floorf` to get the fractional
|
||||||
|
part. While `floorf` maps to `floor.s` on Xtensa FPU, the full wrap sequence
|
||||||
|
(`sw_fract` + multiply + cast + clamp) is 6 instructions per coordinate.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
For power-of-two textures (`width & wMinus1 == 0`), replace the entire wrap
|
||||||
|
chain with a single bitmask:
|
||||||
|
|
||||||
|
```c
|
||||||
|
x = (int)(u * tex->width) & tex->wMinus1;
|
||||||
|
```
|
||||||
|
|
||||||
|
This handles both positive and negative UVs through two's complement wrapping
|
||||||
|
(off by at most 1 texel for rare negative UVs — imperceptible at 240×240).
|
||||||
|
Non-POT textures fall through to the original `sw_fract` path.
|
||||||
|
|
||||||
|
Saves ~2 instructions per texel per coordinate on the nearest-filter hot path.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[env:esp32s3]
|
||||||
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||||
|
framework = arduino
|
||||||
|
board = esp32-s3-devkitc-1
|
||||||
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
; Point to the library one level up
|
||||||
|
lib_deps = ../..
|
||||||
|
|
||||||
|
board_build.partitions = default.csv
|
||||||
|
board_build.arduino.memory_type = qio_opi
|
||||||
|
|
||||||
|
; Enable PSRAM
|
||||||
|
build_flags =
|
||||||
|
-DBOARD_HAS_PSRAM
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include <raylib_esp32.h>
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
static Camera3D camera = {0};
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.println("raylib-esp32 hello_3d example");
|
||||||
|
|
||||||
|
raylib_esp32_display_config_t disp = {
|
||||||
|
.driver = RAYLIB_DRIVER_GC9A01,
|
||||||
|
.spi_host = SPI2_HOST,
|
||||||
|
.pin_sclk = 12,
|
||||||
|
.pin_mosi = 11,
|
||||||
|
.pin_cs = 10,
|
||||||
|
.pin_dc = 9,
|
||||||
|
.pin_rst = 8,
|
||||||
|
.pin_bl = 7,
|
||||||
|
.width = 240,
|
||||||
|
.height = 240,
|
||||||
|
.spi_freq_hz = 40000000,
|
||||||
|
};
|
||||||
|
ESP_ERROR_CHECK(raylib_esp32_init(&disp));
|
||||||
|
|
||||||
|
InitWindow(240, 240, "hello_3d");
|
||||||
|
|
||||||
|
camera.position = (Vector3){4.0f, 4.0f, 4.0f};
|
||||||
|
camera.target = (Vector3){0.0f, 0.0f, 0.0f};
|
||||||
|
camera.up = (Vector3){0.0f, 1.0f, 0.0f};
|
||||||
|
camera.fovy = 45.0f;
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
DrawCube((Vector3){0}, 2.0f, 2.0f, 2.0f, RED);
|
||||||
|
DrawCubeWires((Vector3){0}, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
DrawFPS(4, 4);
|
||||||
|
DrawText("raylib on ESP32!", 10, 220, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
|
app0, app, ota_0, 0x10000, 0x200000,
|
||||||
|
spiffs, data, spiffs, 0x210000, 0x1F0000,
|
||||||
|
@@ -0,0 +1,14 @@
|
|||||||
|
[env:esp32s3]
|
||||||
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||||
|
framework = arduino
|
||||||
|
board = esp32-s3-devkitc-1
|
||||||
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
lib_deps = ../..
|
||||||
|
|
||||||
|
board_build.filesystem = littlefs
|
||||||
|
board_build.partitions = partitions.csv
|
||||||
|
board_build.arduino.memory_type = qio_opi
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
-DBOARD_HAS_PSRAM
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include <raylib_esp32.h>
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
static Camera3D camera = {0};
|
||||||
|
static Model model = {0};
|
||||||
|
static bool model_loaded = false;
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.println("raylib-esp32 model_loading example");
|
||||||
|
|
||||||
|
raylib_esp32_display_config_t disp = {
|
||||||
|
.driver = RAYLIB_DRIVER_GC9A01,
|
||||||
|
.spi_host = SPI2_HOST,
|
||||||
|
.pin_sclk = 12,
|
||||||
|
.pin_mosi = 11,
|
||||||
|
.pin_cs = 10,
|
||||||
|
.pin_dc = 9,
|
||||||
|
.pin_rst = 8,
|
||||||
|
.pin_bl = 7,
|
||||||
|
.width = 240,
|
||||||
|
.height = 240,
|
||||||
|
.spi_freq_hz = 40000000,
|
||||||
|
};
|
||||||
|
ESP_ERROR_CHECK(raylib_esp32_init(&disp));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mount LittleFS. Put your .glb / .obj files in the data/ folder
|
||||||
|
* and upload with: pio run -t uploadfs
|
||||||
|
*/
|
||||||
|
esp_err_t fs_ret = raylib_esp32_mount_fs("/data", "spiffs");
|
||||||
|
if (fs_ret != ESP_OK) {
|
||||||
|
Serial.printf("FS mount failed: %d\n", fs_ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
InitWindow(240, 240, "model_loading");
|
||||||
|
|
||||||
|
camera.position = (Vector3){5.0f, 5.0f, 5.0f};
|
||||||
|
camera.target = (Vector3){0.0f, 0.0f, 0.0f};
|
||||||
|
camera.up = (Vector3){0.0f, 1.0f, 0.0f};
|
||||||
|
camera.fovy = 45.0f;
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE;
|
||||||
|
|
||||||
|
model = LoadModel("/data/model.glb");
|
||||||
|
model_loaded = (model.meshCount > 0);
|
||||||
|
if (!model_loaded) {
|
||||||
|
Serial.println("Model not found — showing fallback cube. "
|
||||||
|
"Upload a model.glb to the data/ folder.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
if (model_loaded) {
|
||||||
|
DrawModel(model, (Vector3){0}, 1.0f, WHITE);
|
||||||
|
} else {
|
||||||
|
DrawCube((Vector3){0}, 2.0f, 2.0f, 2.0f, SKYBLUE);
|
||||||
|
DrawCubeWires((Vector3){0}, 2.0f, 2.0f, 2.0f, DARKBLUE);
|
||||||
|
}
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
DrawFPS(4, 4);
|
||||||
|
if (!model_loaded) {
|
||||||
|
DrawText("No model.glb found", 10, 220, 10, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief ESP LCD: GC9A01
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "esp_lcd_panel_vendor.h"
|
||||||
|
#include "esp_idf_version.h"
|
||||||
|
|
||||||
|
#ifndef ESP_LCD_GC9A01_VER_MAJOR
|
||||||
|
#define ESP_LCD_GC9A01_VER_MAJOR 1
|
||||||
|
#define ESP_LCD_GC9A01_VER_MINOR 0
|
||||||
|
#define ESP_LCD_GC9A01_VER_PATCH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel initialization commands.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
int cmd; /*<! The specific LCD command */
|
||||||
|
const void *data; /*<! Buffer that holds the command specific data */
|
||||||
|
size_t data_bytes; /*<! Size of `data` in memory, in bytes */
|
||||||
|
unsigned int delay_ms; /*<! Delay in milliseconds after this command */
|
||||||
|
} gc9a01_lcd_init_cmd_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel vendor configuration.
|
||||||
|
*
|
||||||
|
* @note This structure needs to be passed to the `vendor_config` field in `esp_lcd_panel_dev_config_t`.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
const gc9a01_lcd_init_cmd_t *init_cmds; /*!< Pointer to initialization commands array. Set to NULL if using default commands.
|
||||||
|
* The array should be declared as `static const` and positioned outside the function.
|
||||||
|
* Please refer to `vendor_specific_init_default` in source file.
|
||||||
|
*/
|
||||||
|
uint16_t init_cmds_size; /*<! Number of commands in above array */
|
||||||
|
} gc9a01_vendor_config_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create LCD panel for model GC9A01
|
||||||
|
*
|
||||||
|
* @note Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for initialization sequence code.
|
||||||
|
*
|
||||||
|
* @param[in] io LCD panel IO handle
|
||||||
|
* @param[in] panel_dev_config general panel device configuration
|
||||||
|
* @param[out] ret_panel Returned LCD panel handle
|
||||||
|
* @return
|
||||||
|
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||||
|
* - ESP_ERR_NO_MEM if out of memory
|
||||||
|
* - ESP_OK on success
|
||||||
|
*/
|
||||||
|
esp_err_t esp_lcd_new_panel_gc9a01(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel bus configuration structure
|
||||||
|
*
|
||||||
|
* @param[in] sclk SPI clock pin number
|
||||||
|
* @param[in] mosi SPI MOSI pin number
|
||||||
|
* @param[in] max_trans_sz Maximum transfer size in bytes
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
|
#define GC9A01_PANEL_BUS_SPI_CONFIG(sclk, mosi, max_trans_sz) \
|
||||||
|
{ \
|
||||||
|
.mosi_io_num = mosi, \
|
||||||
|
.miso_io_num = -1, \
|
||||||
|
.sclk_io_num = sclk, \
|
||||||
|
.quadwp_io_num = -1, \
|
||||||
|
.quadhd_io_num = -1, \
|
||||||
|
.data4_io_num = -1, \
|
||||||
|
.data5_io_num = -1, \
|
||||||
|
.data6_io_num = -1, \
|
||||||
|
.data7_io_num = -1, \
|
||||||
|
.max_transfer_sz = max_trans_sz, \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define GC9A01_PANEL_BUS_SPI_CONFIG(sclk, mosi, max_trans_sz) \
|
||||||
|
{ \
|
||||||
|
.mosi_io_num = mosi, \
|
||||||
|
.miso_io_num = -1, \
|
||||||
|
.sclk_io_num = sclk, \
|
||||||
|
.quadwp_io_num = -1, \
|
||||||
|
.quadhd_io_num = -1, \
|
||||||
|
.max_transfer_sz = max_trans_sz, \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel IO configuration structure
|
||||||
|
*
|
||||||
|
* @param[in] cs SPI chip select pin number
|
||||||
|
* @param[in] dc SPI data/command pin number
|
||||||
|
* @param[in] cb Callback function when SPI transfer is done
|
||||||
|
* @param[in] cb_ctx Callback function context
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define GC9A01_PANEL_IO_SPI_CONFIG(cs, dc, callback, callback_ctx) \
|
||||||
|
{ \
|
||||||
|
.cs_gpio_num = cs, \
|
||||||
|
.dc_gpio_num = dc, \
|
||||||
|
.spi_mode = 0, \
|
||||||
|
.pclk_hz = 80 * 1000 * 1000, \
|
||||||
|
.trans_queue_depth = 10, \
|
||||||
|
.on_color_trans_done = callback, \
|
||||||
|
.user_ctx = callback_ctx, \
|
||||||
|
.lcd_cmd_bits = 8, \
|
||||||
|
.lcd_param_bits = 8, \
|
||||||
|
.flags = {} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief ESP LCD: ST7796
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "hal/lcd_types.h"
|
||||||
|
#include "esp_lcd_panel_vendor.h"
|
||||||
|
#include "esp_idf_version.h"
|
||||||
|
#if SOC_MIPI_DSI_SUPPORTED
|
||||||
|
#include "esp_lcd_mipi_dsi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel initialization commands.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
int cmd; /*<! The specific LCD command */
|
||||||
|
const void *data; /*<! Buffer that holds the command specific data */
|
||||||
|
size_t data_bytes; /*<! Size of `data` in memory, in bytes */
|
||||||
|
unsigned int delay_ms; /*<! Delay in milliseconds after this command */
|
||||||
|
} st7796_lcd_init_cmd_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel vendor configuration.
|
||||||
|
*
|
||||||
|
* @note This structure needs to be passed to the `vendor_config` field in `esp_lcd_panel_dev_config_t`.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
const st7796_lcd_init_cmd_t *init_cmds; /*!< Pointer to initialization commands array. Set to NULL if using default commands.
|
||||||
|
* The array should be declared as `static const` and positioned outside the function.
|
||||||
|
* Please refer to `vendor_specific_init_default` in source file.
|
||||||
|
*/
|
||||||
|
uint16_t init_cmds_size; /*<! Number of commands in above array */
|
||||||
|
#if SOC_MIPI_DSI_SUPPORTED
|
||||||
|
struct {
|
||||||
|
esp_lcd_dsi_bus_handle_t dsi_bus; /*!< MIPI-DSI bus configuration */
|
||||||
|
const esp_lcd_dpi_panel_config_t *dpi_config; /*!< MIPI-DPI panel configuration */
|
||||||
|
} mipi_config;
|
||||||
|
#endif
|
||||||
|
struct {
|
||||||
|
unsigned int use_mipi_interface: 1; /*<! Set to 1 if using MIPI interface, default is SPI/I80 interface */
|
||||||
|
} flags;
|
||||||
|
} st7796_vendor_config_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create LCD panel for model ST7796
|
||||||
|
*
|
||||||
|
* @note Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for initialization sequence code.
|
||||||
|
*
|
||||||
|
* @param[in] io LCD panel IO handle
|
||||||
|
* @param[in] panel_dev_config general panel device configuration
|
||||||
|
* @param[out] ret_panel Returned LCD panel handle
|
||||||
|
* @return
|
||||||
|
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||||
|
* - ESP_ERR_NO_MEM if out of memory
|
||||||
|
* - ESP_OK on success
|
||||||
|
*/
|
||||||
|
esp_err_t esp_lcd_new_panel_st7796(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/////////////////////////////// Default Configuration Macros for I80 Interface /////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel bus configuration structure
|
||||||
|
*
|
||||||
|
* @param[in] max_trans_bytes Maximum bytes of data to be transferred in one transaction. Normally set to the size of one frame bytes.
|
||||||
|
* @param[in] data_width Data bus width
|
||||||
|
* @param[in] dc I80 data/command pin number
|
||||||
|
* @param[in] wr I80 write clock pin number
|
||||||
|
* @param[in] d[0:15] I80 data pin number 0 ~ 15. Set to -1 if not used.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 4, 1)
|
||||||
|
#define ST7796_PANEL_BUS_I80_CONFIG(max_trans_bytes, data_width, dc, wr, d0, d1, d2, d3, d4, \
|
||||||
|
d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15) \
|
||||||
|
{ \
|
||||||
|
.clk_src = LCD_CLK_SRC_PLL160M, \
|
||||||
|
.dc_gpio_num = dc, \
|
||||||
|
.wr_gpio_num = wr, \
|
||||||
|
.data_gpio_nums = { \
|
||||||
|
d0, d1, d2, d3, d4, d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15 \
|
||||||
|
}, \
|
||||||
|
.bus_width = data_width, \
|
||||||
|
.max_transfer_bytes = max_trans_bytes, \
|
||||||
|
}
|
||||||
|
#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
|
||||||
|
#define ST7796_PANEL_BUS_I80_CONFIG(max_trans_bytes, data_width, dc, wr, d0, d1, d2, d3, d4, \
|
||||||
|
d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15) \
|
||||||
|
{ \
|
||||||
|
.clk_src = LCD_CLK_SRC_PLL160M, \
|
||||||
|
.dc_gpio_num = dc, \
|
||||||
|
.wr_gpio_num = wr, \
|
||||||
|
.data_gpio_nums = { \
|
||||||
|
d0, d1, d2, d3, d4, d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15 \
|
||||||
|
}, \
|
||||||
|
.bus_width = data_width, \
|
||||||
|
.max_transfer_bytes = max_trans_bytes, \
|
||||||
|
.psram_trans_align = 64, \
|
||||||
|
.sram_trans_align = 4, \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define ST7796_PANEL_BUS_I80_CONFIG(max_trans_bytes, data_width, dc, wr, d0, d1, d2, d3, d4, \
|
||||||
|
d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15) \
|
||||||
|
{ \
|
||||||
|
.clk_src = LCD_CLK_SRC_PLL160M, \
|
||||||
|
.dc_gpio_num = dc, \
|
||||||
|
.wr_gpio_num = wr, \
|
||||||
|
.data_gpio_nums = { \
|
||||||
|
d0, d1, d2, d3, d4, d5, d6, d7, d8 , d9, d10, d11, d12, d13, d14, d15 \
|
||||||
|
}, \
|
||||||
|
.bus_width = data_width, \
|
||||||
|
.max_transfer_bytes = max_trans_bytes, \
|
||||||
|
.dma_burst_size = 64, \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LCD panel IO configuration structure
|
||||||
|
*
|
||||||
|
* @param[in] cs I80 chip select pin number
|
||||||
|
* @param[in] cb Callback function when data transfer is done
|
||||||
|
* @param[in] cb_ctx Callback function context
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define ST7796_PANEL_IO_I80_CONFIG(cs, cb, cb_ctx) \
|
||||||
|
{ \
|
||||||
|
.cs_gpio_num = cs, \
|
||||||
|
.pclk_hz = 10 * 1000 * 1000, \
|
||||||
|
.trans_queue_depth = 10, \
|
||||||
|
.dc_levels = { \
|
||||||
|
.dc_idle_level = 0, \
|
||||||
|
.dc_cmd_level = 0, \
|
||||||
|
.dc_dummy_level = 0, \
|
||||||
|
.dc_data_level = 1, \
|
||||||
|
}, \
|
||||||
|
.flags = { \
|
||||||
|
.swap_color_bytes = 1, \
|
||||||
|
}, \
|
||||||
|
.on_color_trans_done = cb, \
|
||||||
|
.user_ctx = cb_ctx, \
|
||||||
|
.lcd_cmd_bits = 8, \
|
||||||
|
.lcd_param_bits = 8, \
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////// Default Configuration Macros for MIPI-DSI Interface //////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MIPI-DSI bus configuration structure
|
||||||
|
*
|
||||||
|
* @param[in] lane_num Number of data lanes
|
||||||
|
* @param[in] lane_mbps Lane bit rate in Mbps
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define ST7796_PANEL_BUS_DSI_1CH_CONFIG() \
|
||||||
|
{ \
|
||||||
|
.bus_id = 0, \
|
||||||
|
.num_data_lanes = 1, \
|
||||||
|
.phy_clk_src = 0, \
|
||||||
|
.lane_bit_rate_mbps = 480, \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MIPI-DBI panel IO configuration structure
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define ST7796_PANEL_IO_DBI_CONFIG() \
|
||||||
|
{ \
|
||||||
|
.virtual_channel = 0, \
|
||||||
|
.lcd_cmd_bits = 8, \
|
||||||
|
.lcd_param_bits = 8, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
|
||||||
|
/**
|
||||||
|
* @brief MIPI DPI configuration structure
|
||||||
|
*
|
||||||
|
* @note refresh_rate = (dpi_clock_freq_mhz * 1000000) / (h_res + hsync_pulse_width + hsync_back_porch + hsync_front_porch)
|
||||||
|
* / (v_res + vsync_pulse_width + vsync_back_porch + vsync_front_porch)
|
||||||
|
*
|
||||||
|
* @param[in] px_format Pixel format of the panel
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define ST7796_320_480_PANEL_60HZ_DPI_CONFIG(px_format) \
|
||||||
|
{ \
|
||||||
|
.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, \
|
||||||
|
.dpi_clock_freq_mhz = 10, \
|
||||||
|
.virtual_channel = 0, \
|
||||||
|
.pixel_format = px_format, \
|
||||||
|
.num_fbs = 1, \
|
||||||
|
.video_timing = { \
|
||||||
|
.h_size = 320, \
|
||||||
|
.v_size = 480, \
|
||||||
|
.hsync_back_porch = 10, \
|
||||||
|
.hsync_pulse_width = 10, \
|
||||||
|
.hsync_front_porch = 20, \
|
||||||
|
.vsync_back_porch = 10, \
|
||||||
|
.vsync_pulse_width = 10, \
|
||||||
|
.vsync_front_porch = 10, \
|
||||||
|
}, \
|
||||||
|
.flags.use_dma2d = true, \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MIPI DPI configuration structure
|
||||||
|
*
|
||||||
|
* @note refresh_rate = (dpi_clock_freq_mhz * 1000000) / (h_res + hsync_pulse_width + hsync_back_porch + hsync_front_porch)
|
||||||
|
* / (v_res + vsync_pulse_width + vsync_back_porch + vsync_front_porch)
|
||||||
|
*
|
||||||
|
* @param[in] color_format Input color format of the panel
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define ST7796_320_480_PANEL_60HZ_DPI_CONFIG_CF(color_format) \
|
||||||
|
{ \
|
||||||
|
.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, \
|
||||||
|
.dpi_clock_freq_mhz = 10, \
|
||||||
|
.virtual_channel = 0, \
|
||||||
|
.in_color_format = color_format, \
|
||||||
|
.num_fbs = 1, \
|
||||||
|
.video_timing = { \
|
||||||
|
.h_size = 320, \
|
||||||
|
.v_size = 480, \
|
||||||
|
.hsync_back_porch = 10, \
|
||||||
|
.hsync_pulse_width = 10, \
|
||||||
|
.hsync_front_porch = 20, \
|
||||||
|
.vsync_back_porch = 10, \
|
||||||
|
.vsync_pulse_width = 10, \
|
||||||
|
.vsync_front_porch = 10, \
|
||||||
|
}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "esp_lcd_types.h"
|
||||||
|
#include "esp_lcd_panel_vendor.h"
|
||||||
|
#include "soc/soc_caps.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @brief Initialize ST7796 LCD panel with SPI/I80 interface
|
||||||
|
*
|
||||||
|
* @param[in] io LCD panel IO handle
|
||||||
|
* @param[in] panel_dev_config LCD panel device configuration
|
||||||
|
* @param[out] ret_panel LCD panel handle
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: Success
|
||||||
|
* - Otherwise: Fail
|
||||||
|
*/
|
||||||
|
esp_err_t esp_lcd_new_panel_st7796_general(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel);
|
||||||
|
|
||||||
|
#if SOC_MIPI_DSI_SUPPORTED
|
||||||
|
/**
|
||||||
|
* @brief Initialize ST7796 LCD panel with MIPI interface
|
||||||
|
*
|
||||||
|
* @param[in] io LCD panel IO handle
|
||||||
|
* @param[in] panel_dev_config LCD panel device configuration
|
||||||
|
* @param[out] ret_panel LCD panel handle
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: Success
|
||||||
|
* - Otherwise: Fail
|
||||||
|
*/
|
||||||
|
esp_err_t esp_lcd_new_panel_st7796_mipi(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config,
|
||||||
|
esp_lcd_panel_handle_t *ret_panel);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/* Forwarding header — lets users write #include <raylib.h> */
|
||||||
|
#include "../raylib/src/raylib.h"
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#ifndef RAYLIB_ESP32_H
|
||||||
|
#define RAYLIB_ESP32_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "driver/spi_master.h"
|
||||||
|
#include "raylib_esp32_displays.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
raylib_display_driver_e driver;
|
||||||
|
spi_host_device_t spi_host;
|
||||||
|
int pin_sclk;
|
||||||
|
int pin_mosi;
|
||||||
|
int pin_cs;
|
||||||
|
int pin_dc;
|
||||||
|
int pin_rst;
|
||||||
|
int pin_bl;
|
||||||
|
uint16_t width;
|
||||||
|
uint16_t height;
|
||||||
|
uint32_t spi_freq_hz; /* 0 → use driver default */
|
||||||
|
} raylib_esp32_display_config_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize display hardware and the raylib port layer.
|
||||||
|
* Must be called before InitWindow().
|
||||||
|
*
|
||||||
|
* Sets up: SPI bus → panel driver → port layer (DMA flush, semaphores).
|
||||||
|
* Also turns on the backlight via pin_bl (active-high).
|
||||||
|
*/
|
||||||
|
esp_err_t raylib_esp32_init(const raylib_esp32_display_config_t *config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mount a LittleFS partition so that raylib's LoadModel / LoadTexture /
|
||||||
|
* LoadFont can read from it via standard fopen().
|
||||||
|
*
|
||||||
|
* @param mount_point VFS path, e.g. "/data"
|
||||||
|
* @param partition Partition label in the partition table (usually "spiffs")
|
||||||
|
* @return ESP_OK on success
|
||||||
|
*/
|
||||||
|
esp_err_t raylib_esp32_mount_fs(const char *mount_point,
|
||||||
|
const char *partition_label);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down the port layer and free the display framebuffer.
|
||||||
|
*/
|
||||||
|
void raylib_esp32_deinit(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* RAYLIB_ESP32_H */
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#ifndef RAYLIB_ESP32_CONFIG_H
|
||||||
|
#define RAYLIB_ESP32_CONFIG_H
|
||||||
|
|
||||||
|
#ifndef EXTERNAL_CONFIG_FLAGS
|
||||||
|
#define EXTERNAL_CONFIG_FLAGS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
// Route all raylib allocations through PSRAM.
|
||||||
|
// rlgl.h maps SW_MALLOC -> RL_MALLOC, so this also covers the SW renderer.
|
||||||
|
#define RL_MALLOC(sz) heap_caps_malloc(sz, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)
|
||||||
|
#define RL_CALLOC(n, sz) \
|
||||||
|
heap_caps_calloc(n, sz, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)
|
||||||
|
#define RL_REALLOC(ptr, sz) \
|
||||||
|
heap_caps_realloc(ptr, sz, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)
|
||||||
|
#define RL_FREE(ptr) heap_caps_free(ptr)
|
||||||
|
|
||||||
|
// Software renderer framebuffer
|
||||||
|
#define SW_FRAMEBUFFER_COLOR_TYPE R5G6B5
|
||||||
|
#define SW_FRAMEBUFFER_DEPTH_TYPE D16
|
||||||
|
#define SW_FRAMEBUFFER_OUTPUT_BGRA false
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Framebuffer placement: internal SRAM on ESP32-S3
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// The rasterizer inner loop hammers the color/depth buffers every pixel.
|
||||||
|
// Internal SRAM has ~10x lower latency than PSRAM for random access.
|
||||||
|
// 240x240 R5G6B5+D16 = ~225 KB — fits in the S3's 512 KB SRAM.
|
||||||
|
// Falls back to PSRAM automatically if internal memory is insufficient.
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32S3
|
||||||
|
static inline void *_sw_fb_alloc_prefer_internal(void *old, size_t sz) {
|
||||||
|
void *p = heap_caps_malloc(sz, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
|
|
||||||
|
printf("allocated in internal SRAM: %p\n", p);
|
||||||
|
|
||||||
|
if (!p)
|
||||||
|
p = heap_caps_malloc(sz, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
||||||
|
if (old)
|
||||||
|
heap_caps_free(old);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
#define SW_FB_REALLOC(ptr, sz) _sw_fb_alloc_prefer_internal(ptr, sz)
|
||||||
|
#define SW_FB_FREE(ptr) heap_caps_free(ptr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Module selection
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_MODULE_RSHAPES 1
|
||||||
|
#define SUPPORT_MODULE_RTEXTURES 1
|
||||||
|
#define SUPPORT_MODULE_RTEXT 1
|
||||||
|
#define SUPPORT_MODULE_RMODELS 1
|
||||||
|
#define SUPPORT_MODULE_RAUDIO 0
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rcore
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_CAMERA_SYSTEM 1
|
||||||
|
#define SUPPORT_GESTURES_SYSTEM 1
|
||||||
|
#define SUPPORT_RPRAND_GENERATOR 1
|
||||||
|
#define SUPPORT_MOUSE_GESTURES 0
|
||||||
|
#define SUPPORT_SSH_KEYBOARD_RPI 0
|
||||||
|
#define SUPPORT_WINMM_HIGHRES_TIMER 0
|
||||||
|
#define SUPPORT_PARTIALBUSY_WAIT_LOOP 0
|
||||||
|
#define SUPPORT_SCREEN_CAPTURE 0
|
||||||
|
#define SUPPORT_GIF_RECORDING 0
|
||||||
|
#define SUPPORT_COMPRESSION_API 0
|
||||||
|
#define SUPPORT_AUTOMATION_EVENTS 0
|
||||||
|
#define SUPPORT_CLIPBOARD_IMAGE 0
|
||||||
|
|
||||||
|
#define MAX_FILEPATH_CAPACITY 512
|
||||||
|
#define MAX_FILEPATH_LENGTH 256
|
||||||
|
#define MAX_KEYBOARD_KEYS 128
|
||||||
|
#define MAX_MOUSE_BUTTONS 4
|
||||||
|
#define MAX_GAMEPADS 1
|
||||||
|
#define MAX_GAMEPAD_AXES 4
|
||||||
|
#define MAX_GAMEPAD_BUTTONS 16
|
||||||
|
#define MAX_GAMEPAD_VIBRATION_TIME 2.0f
|
||||||
|
#define MAX_TOUCH_POINTS 4
|
||||||
|
#define MAX_KEY_PRESSED_QUEUE 8
|
||||||
|
#define MAX_CHAR_PRESSED_QUEUE 8
|
||||||
|
#define MAX_DECOMPRESSION_SIZE 16
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rlgl (embedded-friendly batch sizes)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define RL_SUPPORT_MESH_GPU_SKINNING 0
|
||||||
|
#define RL_DEFAULT_BATCH_BUFFERS 1
|
||||||
|
#define RL_DEFAULT_BATCH_DRAWCALLS 128
|
||||||
|
#define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 2
|
||||||
|
#define RL_MAX_MATRIX_STACK_SIZE 16
|
||||||
|
#define RL_MAX_SHADER_LOCATIONS 16
|
||||||
|
#define RL_CULL_DISTANCE_NEAR 0.05
|
||||||
|
#define RL_CULL_DISTANCE_FAR 1000.0
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rshapes
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_QUADS_DRAW_MODE 1
|
||||||
|
#define SPLINE_SEGMENT_DIVISIONS 16
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rtextures — image file formats
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_FILEFORMAT_PNG 1
|
||||||
|
#define SUPPORT_FILEFORMAT_BMP 0
|
||||||
|
#define SUPPORT_FILEFORMAT_TGA 0
|
||||||
|
#define SUPPORT_FILEFORMAT_JPG 0
|
||||||
|
#define SUPPORT_FILEFORMAT_GIF 0
|
||||||
|
#define SUPPORT_FILEFORMAT_QOI 1
|
||||||
|
#define SUPPORT_FILEFORMAT_PSD 0
|
||||||
|
#define SUPPORT_FILEFORMAT_DDS 0
|
||||||
|
#define SUPPORT_FILEFORMAT_HDR 0
|
||||||
|
#define SUPPORT_FILEFORMAT_PIC 0
|
||||||
|
#define SUPPORT_FILEFORMAT_KTX 0
|
||||||
|
#define SUPPORT_FILEFORMAT_ASTC 0
|
||||||
|
#define MAX_IMAGE_FLIP_QUEUE 2
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rtext — font file formats
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_FILEFORMAT_FNT 1
|
||||||
|
#define SUPPORT_FILEFORMAT_TTF 0
|
||||||
|
#define SUPPORT_FILEFORMAT_BMF 0
|
||||||
|
#define MAX_TEXT_BUFFER_LENGTH 512
|
||||||
|
#define MAX_TEXTSPLIT_COUNT 64
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// rmodels — 3D model file formats
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
#define SUPPORT_FILEFORMAT_OBJ 1
|
||||||
|
#define SUPPORT_FILEFORMAT_MTL 1
|
||||||
|
#define SUPPORT_FILEFORMAT_GLTF 1
|
||||||
|
#define SUPPORT_FILEFORMAT_M3D 1
|
||||||
|
#define SUPPORT_FILEFORMAT_VOX 0
|
||||||
|
#define SUPPORT_FILEFORMAT_IQM 0
|
||||||
|
#define SUPPORT_MESH_GENERATION 1
|
||||||
|
|
||||||
|
#endif // RAYLIB_ESP32_CONFIG_H
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#ifndef RAYLIB_ESP32_DISPLAYS_H
|
||||||
|
#define RAYLIB_ESP32_DISPLAYS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "esp_idf_version.h"
|
||||||
|
// #include "esp_lcd_panel_io.h"
|
||||||
|
|
||||||
|
#include "esp_lcd_io_spi.h"
|
||||||
|
#include "esp_lcd_panel_ops.h"
|
||||||
|
#include "esp_lcd_panel_vendor.h"
|
||||||
|
|
||||||
|
#include "driver/spi_master.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/* IDF 4.4 uses void* for the SPI bus handle; IDF 5.x takes spi_host_device_t directly */
|
||||||
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
|
#define RAYLIB_LCD_SPI_HOST(h) ((esp_lcd_spi_bus_handle_t)(h))
|
||||||
|
#else
|
||||||
|
#define RAYLIB_LCD_SPI_HOST(h) (h)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RAYLIB_DRIVER_GC9A01,
|
||||||
|
RAYLIB_DRIVER_ST7789,
|
||||||
|
RAYLIB_DRIVER_ST7796S,
|
||||||
|
RAYLIB_DRIVER_ILI9341,
|
||||||
|
RAYLIB_DRIVER_CUSTOM,
|
||||||
|
} raylib_display_driver_e;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const char *name;
|
||||||
|
esp_err_t (*init_panel)(spi_host_device_t spi_host,
|
||||||
|
int pin_cs, int pin_dc, int pin_rst,
|
||||||
|
uint16_t width, uint16_t height,
|
||||||
|
uint32_t spi_freq_hz,
|
||||||
|
esp_lcd_panel_handle_t *out_panel,
|
||||||
|
esp_lcd_panel_io_handle_t *out_io);
|
||||||
|
bool needs_invert_color;
|
||||||
|
bool needs_byte_swap;
|
||||||
|
uint32_t default_spi_freq_hz;
|
||||||
|
} raylib_display_driver_t;
|
||||||
|
|
||||||
|
const raylib_display_driver_t *raylib_esp32_get_driver(raylib_display_driver_e id);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RAYLIB_ESP32_DISPLAYS_H
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef RAYLIB_ESP32_PORT_H
|
||||||
|
#define RAYLIB_ESP32_PORT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "esp_lcd_panel_io.h"
|
||||||
|
#include "esp_lcd_panel_ops.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
esp_lcd_panel_handle_t panel;
|
||||||
|
esp_lcd_panel_io_handle_t io;
|
||||||
|
uint16_t width;
|
||||||
|
uint16_t height;
|
||||||
|
bool swap_bytes;
|
||||||
|
size_t chunk_height;
|
||||||
|
} raylib_port_config_t;
|
||||||
|
|
||||||
|
esp_err_t raylib_port_init(const raylib_port_config_t *config);
|
||||||
|
esp_err_t raylib_port_flush_rgb565(const uint16_t *buf, int x, int y, int w, int h);
|
||||||
|
esp_err_t raylib_port_flush_rgb565_vflip(const uint16_t *src, int w, int h);
|
||||||
|
esp_err_t raylib_port_flush_async(const uint16_t *src, int w, int h);
|
||||||
|
esp_err_t raylib_port_wait_flush(void);
|
||||||
|
void raylib_port_get_dimensions(uint16_t *w, uint16_t *h);
|
||||||
|
void raylib_port_deinit(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RAYLIB_ESP32_PORT_H
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/* Forwarding header — lets users write #include <raymath.h> */
|
||||||
|
#include "../raylib/src/raymath.h"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/* Forwarding header — lets users write #include <rlgl.h> */
|
||||||
|
#include "../raylib/src/rlgl.h"
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"name": "raylib-esp32",
|
||||||
|
"version": "1.0.3",
|
||||||
|
"description": "Raylib 6.x for ESP32 — software-rendered 2D/3D graphics on embedded SPI displays",
|
||||||
|
"keywords": [
|
||||||
|
"raylib",
|
||||||
|
"esp32",
|
||||||
|
"graphics",
|
||||||
|
"3d",
|
||||||
|
"embedded",
|
||||||
|
"lcd",
|
||||||
|
"gc9a01",
|
||||||
|
"st7789",
|
||||||
|
"ili9341"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/jensroth-git/raylib-esp32.git"
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jens Roth",
|
||||||
|
"maintainer": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "Zlib",
|
||||||
|
"platforms": "espressif32",
|
||||||
|
"frameworks": "arduino",
|
||||||
|
"headers": "raylib_esp32.h",
|
||||||
|
"build": {
|
||||||
|
"extraScript": "pio_build.py",
|
||||||
|
"includeDir": "include",
|
||||||
|
"srcDir": ".",
|
||||||
|
"srcFilter": [
|
||||||
|
"-<*>",
|
||||||
|
"+<src/**/*.c>",
|
||||||
|
"+<raylib/src/rcore.c>",
|
||||||
|
"+<raylib/src/rshapes.c>",
|
||||||
|
"+<raylib/src/rtextures.c>",
|
||||||
|
"+<raylib/src/rtext.c>",
|
||||||
|
"+<raylib/src/rmodels.c>",
|
||||||
|
"-<examples>"
|
||||||
|
],
|
||||||
|
"flags": [
|
||||||
|
"-O3",
|
||||||
|
"-DGRAPHICS_API_OPENGL_SOFTWARE",
|
||||||
|
"-DPLATFORM_CUSTOM",
|
||||||
|
"-DEXTERNAL_CONFIG_FLAGS",
|
||||||
|
"-Wno-incompatible-pointer-types",
|
||||||
|
"-Wno-uninitialized",
|
||||||
|
"-Wno-nonnull",
|
||||||
|
"-Wno-return-type",
|
||||||
|
"-Wno-unused-variable",
|
||||||
|
"-Wno-unused-function",
|
||||||
|
"-Wno-unused-label",
|
||||||
|
"-Wno-stringop-truncation"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
Import("env")
|
||||||
|
import os
|
||||||
|
|
||||||
|
lib_root = os.path.dirname(os.path.realpath("__file__"))
|
||||||
|
|
||||||
|
env.Prepend(CPPPATH=[
|
||||||
|
os.path.join(lib_root, "include"),
|
||||||
|
])
|
||||||
|
|
||||||
|
env.Append(CPPPATH=[
|
||||||
|
os.path.join(lib_root, "raylib", "src"),
|
||||||
|
os.path.join(lib_root, "src", "port"),
|
||||||
|
])
|
||||||
|
|
||||||
|
env.Append(CCFLAGS=[
|
||||||
|
"-include", "raylib_esp32_config.h",
|
||||||
|
])
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[env:esp32s3usbotg]
|
||||||
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||||
|
board = esp32s3usbotg
|
||||||
|
framework = arduino
|
||||||
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
monitor_rts = 0
|
||||||
|
monitor_dtr = 0
|
||||||
|
|
||||||
|
lib_deps=
|
||||||
|
|
||||||
|
; Enable PSRAM
|
||||||
|
build_flags =
|
||||||
|
-DBOARD_HAS_PSRAM
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=0
|
||||||
|
-DARDUINO_USB_MODE=1
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
# Ignore generated files
|
||||||
|
# ...
|
||||||
|
|
||||||
|
# Ignore VIM's backup generated files
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# Ignore thumbnails created by windows
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Ignore files build by Visual Studio
|
||||||
|
# *.obj --> Can be confused with 3d model!
|
||||||
|
*.pdb
|
||||||
|
*.aps
|
||||||
|
*.user
|
||||||
|
# *.vcproj
|
||||||
|
# *.vcxproj*
|
||||||
|
# *.sln
|
||||||
|
*.vspscc
|
||||||
|
*_i.c
|
||||||
|
*.i
|
||||||
|
*.icf
|
||||||
|
*_p.c
|
||||||
|
*.ncb
|
||||||
|
*.suo
|
||||||
|
*.tlb
|
||||||
|
*.tlh
|
||||||
|
*.bak
|
||||||
|
*.cache
|
||||||
|
*.ilk
|
||||||
|
*.log
|
||||||
|
.vs
|
||||||
|
|
||||||
|
[Bb]in
|
||||||
|
[Dd]ebug/
|
||||||
|
*.sbr
|
||||||
|
*.sdf
|
||||||
|
obj/
|
||||||
|
[R]elease/
|
||||||
|
_ReSharper*/
|
||||||
|
[Tt]est[Rr]esult*
|
||||||
|
ipch/
|
||||||
|
*.opensdf
|
||||||
|
*.db
|
||||||
|
*.opendb
|
||||||
|
packages/
|
||||||
|
!examples/models/resources/models/obj/
|
||||||
|
|
||||||
|
# Ignore compiled binaries
|
||||||
|
*.o
|
||||||
|
*.exe
|
||||||
|
*.a
|
||||||
|
*.bc
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dll
|
||||||
|
*.h.pch
|
||||||
|
./*.obj
|
||||||
|
|
||||||
|
# Ignore SDL libs for testing
|
||||||
|
src/external/SDL2
|
||||||
|
src/external/SDL3
|
||||||
|
|
||||||
|
# Emscripten
|
||||||
|
emsdk
|
||||||
|
|
||||||
|
# Ignore wasm data in examples/
|
||||||
|
examples/**/*
|
||||||
|
!examples/**/*.*
|
||||||
|
!examples/**/*/
|
||||||
|
examples/**/*.exe
|
||||||
|
examples/**/*.wasm
|
||||||
|
examples/**/*.data
|
||||||
|
examples/**/*.js
|
||||||
|
examples/**/*.html
|
||||||
|
examples/**/logs/*
|
||||||
|
|
||||||
|
# Ignore files build by xcode
|
||||||
|
*.mode*v*
|
||||||
|
*.pbxuser
|
||||||
|
*.xcbkptlist
|
||||||
|
*.xcscheme
|
||||||
|
*.xcworkspacedata
|
||||||
|
*.xcuserstate
|
||||||
|
*.xccheckout
|
||||||
|
xcschememanagement.plist
|
||||||
|
.DS_Store
|
||||||
|
._.*
|
||||||
|
xcuserdata/
|
||||||
|
DerivedData/
|
||||||
|
|
||||||
|
# VSCode project
|
||||||
|
.vscode
|
||||||
|
.clangd
|
||||||
|
|
||||||
|
# Jetbrains project
|
||||||
|
.idea/
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# CMake stuff
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
cmake_install.cmake
|
||||||
|
cmake_uninstall.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
compile_commands.json
|
||||||
|
CTestTestfile.cmake
|
||||||
|
build
|
||||||
|
|
||||||
|
# Ignore GNU global tags
|
||||||
|
GPATH
|
||||||
|
GRTAGS
|
||||||
|
GTAGS
|
||||||
|
|
||||||
|
# Zig programming language
|
||||||
|
.zig-cache/
|
||||||
|
zig-cache/
|
||||||
|
zig-pkg/
|
||||||
|
zig-out/
|
||||||
|
build/
|
||||||
|
build-*/
|
||||||
|
docgen_tmp/
|
||||||
|
|
||||||
|
# Tools stuff
|
||||||
|
tools/parser/rlparser.exe
|
||||||
|
tools/parser/rlparser
|
||||||
|
tools/rexm/rexm.exe
|
||||||
|
tools/rexm/rexm
|
||||||
|
|
||||||
|
# CI
|
||||||
|
emsdk-cache/
|
||||||
|
raylib.com/
|
||||||
|
|
||||||
|
# Wayland files
|
||||||
|
src/*protocol.h
|
||||||
|
src/*protocol-code.h
|
||||||
|
src/*protocol-code.c
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
# raylib bindings and wrappers
|
||||||
|
|
||||||
|
Some people ported raylib to other languages in the form of bindings or wrappers to the library. Here is a list with all the ports available. Feel free to send a PR if you know of any binding/wrapper not in this list.
|
||||||
|
|
||||||
|
### Language Bindings
|
||||||
|
|
||||||
|
| Name | raylib Version | Language | License |
|
||||||
|
| :--------------------------------------------------------------------------------------- | :--------------: | :------------------------------------------------------------------: | :------------------: |
|
||||||
|
| [raylib](https://github.com/raysan5/raylib) | **5.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib |
|
||||||
|
| [raylib-ada](https://github.com/Fabien-Chouteau/raylib-ada) | **5.5** | [Ada](https://en.wikipedia.org/wiki/Ada_(programming_language)) | MIT |
|
||||||
|
| [raylib-beef](https://github.com/Starpelly/raylib-beef) | **5.5** | [Beef](https://www.beeflang.org) | MIT |
|
||||||
|
| [raybit](https://github.com/Alex-Velez/raybit) | **5.0** | [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) | MIT |
|
||||||
|
| [raylib-c3](https://github.com/c3lang/vendor/tree/main/libraries/raylib55.c3l) | **5.5** | [C3](https://c3-lang.org) | MIT |
|
||||||
|
| [raylib-cs](https://github.com/raylib-cs/raylib-cs) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
|
||||||
|
| [Raylib-CsLo](https://github.com/NotNotTech/Raylib-CsLo) | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||||
|
| [Raylib-CSharp-Vinculum](https://github.com/ZeroElectric/Raylib-CSharp-Vinculum) | **5.0** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 |
|
||||||
|
| [Raylib-CSharp](https://github.com/MrScautHD/Raylib-CSharp) | **5.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT |
|
||||||
|
| [Raylib-cs.BleedingEdge](https://github.com/danilwhale/Raylib-cs.BleedingEdge) | **5.6-dev** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib |
|
||||||
|
| [cl-raylib](https://github.com/longlene/cl-raylib) | 4.0 | [Common Lisp](https://common-lisp.net) | MIT |
|
||||||
|
| [claylib/wrap](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
|
||||||
|
| [claw-raylib](https://github.com/bohonghuang/claw-raylib) | **auto** | [Common Lisp](https://common-lisp.net) | Apache-2.0 |
|
||||||
|
| [raylib](https://github.com/fosskers/raylib) | 5.5 | [Common Lisp](https://common-lisp.net) | MPL-2.0 |
|
||||||
|
| [chez-raylib](https://github.com/Yunoinsky/chez-raylib) | **auto** | [Chez Scheme](https://cisco.github.io/ChezScheme) | GPLv3 |
|
||||||
|
| [chicken-raylib](https://github.com/meowstr/chicken-raylib) | 5.5 | [CHICKEN Scheme](https://wiki.call-cc.org) | MIT |
|
||||||
|
| [CLIPSraylib](https://github.com/mrryanjohnston/CLIPSraylib) | **auto** | [CLIPS](https://www.clipsrules.net/) | MIT |
|
||||||
|
| [raylib-cr](https://github.com/sol-vin/raylib-cr) | 4.6-dev (5e1a81) | [Crystal](https://crystal-lang.org) | Apache-2.0 |
|
||||||
|
| [ray-cyber](https://github.com/fubark/ray-cyber) | **5.0** | [Cyber](https://cyberscript.dev) | MIT |
|
||||||
|
| [dart-raylib](https://gitlab.com/wolfenrain/dart-raylib) | 4.0 | [Dart](https://dart.dev) | MIT |
|
||||||
|
| [bindbc-raylib3](https://github.com/o3o/bindbc-raylib3) | **5.0** | [D](https://dlang.org) | BSL-1.0 |
|
||||||
|
| [dray](https://github.com/redthing1/dray) | **5.0** | [D](https://dlang.org) | Apache-2.0 |
|
||||||
|
| [raylib-d](https://github.com/schveiguy/raylib-d) | **5.5** | [D](https://dlang.org) | Zlib |
|
||||||
|
| [DenoRaylib550](https://github.com/JJLDonley/DenoRaylib550) | **5.5** | [Deno](https://deno.land) | MIT |
|
||||||
|
| [rayex](https://github.com/shiryel/rayex) | 3.7 | [elixir](https://elixir-lang.org) | Apache-2.0 |
|
||||||
|
| [raylib-elle](https://github.com/acquitelol/elle/blob/rewrite/std/raylib.le) | **5.5** | [Elle](https://github.com/acquitelol/elle) | GPL-3.0 |
|
||||||
|
| [raylib-factor](https://github.com/factor/factor/blob/master/extra/raylib/raylib.factor) | 5.5 | [Factor](https://factorcode.org) | BSD |
|
||||||
|
| [raylib-freebasic](https://github.com/WIITD/raylib-freebasic) | **5.0** | [FreeBASIC](https://www.freebasic.net) | MIT |
|
||||||
|
| [raylib.f](https://github.com/cthulhuology/raylib.f) | **5.5** | [Forth](https://forth.com) | Zlib |
|
||||||
|
| [fortran-raylib](https://github.com/interkosmos/fortran-raylib) | **5.5** | [Fortran](https://fortran-lang.org) | ISC |
|
||||||
|
| [raylib-go](https://github.com/gen2brain/raylib-go) | **5.5** | [Go](https://golang.org) | Zlib |
|
||||||
|
| [raylib-guile](https://github.com/petelliott/raylib-guile) | **auto** | [Guile](https://www.gnu.org/software/guile) | Zlib |
|
||||||
|
| [gforth-raylib](https://github.com/ArnautDaniel/gforth-raylib) | 3.5 | [Gforth](https://gforth.org) | **???** |
|
||||||
|
| [h-raylib](https://github.com/Anut-py/h-raylib) | **5.5-dev** | [Haskell](https://haskell.org) | Apache-2.0 |
|
||||||
|
| [raylib-hx](https://github.com/foreignsasquatch/raylib-hx) | 4.2 | [Haxe](https://haxe.org) | Zlib |
|
||||||
|
| [hb-raylib](https://github.com/MarcosLeonardoMendezGerencir/hb-raylib) | 3.5 | [Harbour](https://harbour.github.io) | MIT |
|
||||||
|
| [jaylib](https://github.com/janet-lang/jaylib) | **5.0** | [Janet](https://janet-lang.org) | MIT |
|
||||||
|
| [jaylib](https://github.com/electronstudio/jaylib/) | **5.5** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE |
|
||||||
|
| [raylib-j](https://github.com/CreedVI/Raylib-J) | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib |
|
||||||
|
| [Raylib.jl](https://github.com/chengchingwen/Raylib.jl) | 4.2 | [Julia](https://julialang.org) | Zlib |
|
||||||
|
| [kaylib](https://github.com/electronstudio/kaylib) | 3.7 | [Kotlin/native](https://kotlinlang.org) | **???** |
|
||||||
|
| [KaylibKit](https://codeberg.org/Kenta/KaylibKit) | 4.5 | [Kotlin/native](https://kotlinlang.org) | Zlib |
|
||||||
|
| [raylib-lua](https://github.com/TSnake41/raylib-lua) | 5.0 | [Lua](http://www.lua.org) | ISC |
|
||||||
|
| [raylib-lua-bindings (WIP)](https://github.com/legendaryredfox/raylib-lua-bindings) | 5.5 | [Lua](http://www.lua.org) | ISC |
|
||||||
|
| [ReiLua](https://github.com/nullstare/ReiLua) | 5.5 | [Lua](http://www.lua.org) | MIT |
|
||||||
|
| [raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) | 5.5 | [Lua](http://www.lua.org) | Zlib |
|
||||||
|
| [raylib-luajit](https://github.com/homma/raylib-luajit) | 5.5 | [Lua](http://www.lua.org) | MIT |
|
||||||
|
| [raylib-luajit-generated](https://github.com/james2doyle/raylib-luajit-generated) | 5.5 | [Lua](http://www.lua.org) | MIT |
|
||||||
|
| [raylib-matte](https://github.com/jcorks/raylib-matte) | 4.6-dev | [Matte](https://github.com/jcorks/matte) | **???** |
|
||||||
|
| [Raylib.nelua](https://github.com/AuzFox/Raylib.nelua) | **5.5** | [nelua](https://nelua.io) | Zlib |
|
||||||
|
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 5.6-dev | [Ruby](https://www.ruby-lang.org/en) | Zlib |
|
||||||
|
| [naylib](https://github.com/planetis-m/naylib) | **5.6-dev** | [Nim](https://nim-lang.org) | MIT |
|
||||||
|
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
|
||||||
|
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | Zlib |
|
||||||
|
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
|
||||||
|
| [raylib-ocaml](https://github.com/tjammer/raylib-ocaml) | **5.0** | [OCaml](https://ocaml.org) | MIT |
|
||||||
|
| [TurboRaylib](https://github.com/turborium/TurboRaylib) | 4.5 | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT |
|
||||||
|
| [Ray4Laz](https://github.com/GuvaCode/Ray4Laz) | **5.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)/[Delphi](https://en.wikipedia.org/wiki/Delphi_(software)) | Zlib |
|
||||||
|
| [Raylib.4.0.Pascal](https://github.com/sysrpl/Raylib.4.0.Pascal) | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal) | Zlib |
|
||||||
|
| [pyraylib](https://github.com/Ho011/pyraylib) | 3.7 | [Python](https://www.python.org) | Zlib |
|
||||||
|
| [raylib-python-cffi](https://github.com/electronstudio/raylib-python-cffi) | **5.5** | [Python](https://www.python.org) | EPL-2.0 |
|
||||||
|
| [raylibpyctbg](https://github.com/overdev/raylibpyctbg) | 5.5 | [Python](https://www.python.org) | MIT |
|
||||||
|
| [raylib-py](https://github.com/overdev/raylib-py) | 5.5 | [Python](https://www.python.org) | MIT |
|
||||||
|
| [raylib-python-ctypes](https://github.com/sDos280/raylib-python-ctypes) | 4.6-dev | [Python](https://www.python.org) | MIT |
|
||||||
|
| [raylib-pkpy-bindings](https://github.com/blueloveTH/pkpy-bindings) | 5.1-dev | [pocketpy](https://pocketpy.dev) | MIT |
|
||||||
|
| [raylib-php](https://github.com/joseph-montanez/raylib-php) | 4.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib |
|
||||||
|
| [raylib-phpcpp](https://github.com/oraoto/raylib-phpcpp) | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | Zlib |
|
||||||
|
| [raylibr](https://github.com/jeroenjanssens/raylibr) | 4.0 | [R](https://www.r-project.org) | MIT |
|
||||||
|
| [raylib-ffi](https://github.com/ewpratten/raylib-ffi) | 5.5 | [Rust](https://www.rust-lang.org) | GPLv3 |
|
||||||
|
| [raylib-rs](https://github.com/raylib-rs/raylib-rs) | **5.5** | [Rust](https://www.rust-lang.org) | Zlib |
|
||||||
|
| [raylib-ruby](https://github.com/wilsonsilva/raylib-ruby) | 4.5 | [Ruby](https://www.ruby-lang.org) | Zlib |
|
||||||
|
| [Relib](https://github.com/RedCubeDev-ByteSpace/Relib) | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | **???** |
|
||||||
|
| [racket-raylib](https://github.com/eutro/racket-raylib) | **5.5** | [Racket](https://racket-lang.org) | MIT/Apache-2.0 |
|
||||||
|
| [raylib-swift](https://github.com/STREGAsGate/Raylib) | 4.0 | [Swift](https://swift.org) | MIT |
|
||||||
|
| [raylib-scopes](https://github.com/salotz/raylib-scopes) | auto | [Scopes](http://scopes.rocks) | MIT |
|
||||||
|
| [raylib-SmallBASIC](https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib) | **5.5** | [SmallBASIC](https://github.com/smallbasic/SmallBASIC) | GPLv3 |
|
||||||
|
| [raylib-umka](https://github.com/robloach/raylib-umka) | 4.5 | [Umka](https://github.com/vtereshkov/umka-lang) | Zlib |
|
||||||
|
| [raylib-v](https://github.com/vlang/raylib) | 5.5 | [V](https://vlang.io) | MIT/Unlicense |
|
||||||
|
| [raylib.v](https://github.com/irishgreencitrus/raylib.v) | 4.2 | [V](https://vlang.io) | Zlib |
|
||||||
|
| [raylib-vapi](https://github.com/lxmcf/raylib-vapi) | **5.0** | [Vala](https://vala.dev) | Zlib |
|
||||||
|
| [raylib-wave](https://github.com/wavefnd/raylib-wave) | **auto** |[Wave](http://wave-lang.dev) | Zlib |
|
||||||
|
| [raylib-wren](https://github.com/TSnake41/raylib-wren) | 4.5 | [Wren](http://wren.io) | ISC |
|
||||||
|
| [raylib-zig](https://github.com/raylib-zig/raylib-zig) | **5.6-dev** | [Zig](https://ziglang.org) | MIT |
|
||||||
|
| [raylib.zig](https://github.com/ryupold/raylib.zig) | **5.1-dev** | [Zig](https://ziglang.org) | MIT |
|
||||||
|
| [raylib-zig-bindings](https://github.com/L-Briand/raylib-zig-bindings) | **5.0** | [Zig](https://ziglang.org) | Zlib |
|
||||||
|
| [hare-raylib](https://git.sr.ht/~evantj/hare-raylib) | **auto** | [Hare](https://harelang.org) | Zlib |
|
||||||
|
| [raylib-sunder](https://github.com/ashn-dot-dev/raylib-sunder) | **auto** | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD |
|
||||||
|
| [raylib-bqn](https://github.com/Brian-ED/raylib-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
||||||
|
| [rayjs](https://github.com/mode777/rayjs) | 4.6-dev | [QuickJS](https://bellard.org/quickjs) | MIT |
|
||||||
|
| [rayjule](https://github.com/SabeDoesThings/rayjule) | **5.5** | [Jule](https://jule.dev/) | MIT |
|
||||||
|
| [raylib-raku](https://github.com/vushu/raylib-raku) | **auto** | [Raku](https://www.raku.org) | Artistic License 2.0 |
|
||||||
|
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
|
||||||
|
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
|
||||||
|
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |
|
||||||
|
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
|
||||||
|
| [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT |
|
||||||
|
| [Rayua](https://github.com/uiua-lang/rayua) | **5.5** | [Uiua](https://www.uiua.org/) | **???** |
|
||||||
|
| [Target](https://github.com/FinnDemonCat/Target/tree/main/libs/raylib) | **5.5** | [Dart](https://dart.dev/) | Apache-2.0 license |
|
||||||
|
|
||||||
|
|
||||||
|
### Utility Wrapers
|
||||||
|
|
||||||
|
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's paradigm.
|
||||||
|
| Name | raylib Version | Language | License |
|
||||||
|
| ---------------------------------------------------- | :------------: | :------------------------------------------: | :-----: |
|
||||||
|
| [raylib-cpp](https://github.com/robloach/raylib-cpp) | **5.5** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib |
|
||||||
|
| [claylib](https://github.com/defun-games/claylib) | 4.5 | [Common Lisp](https://common-lisp.net) | Zlib |
|
||||||
|
| [rayed-bqn](https://github.com/Brian-ED/rayed-bqn) | **5.0** | [BQN](https://mlochbaum.github.io/BQN) | MIT |
|
||||||
|
| [DOOR](https://github.com/RealDoigt/DOOR) | 4.0 | [D](https://dlang.org) | MIT |
|
||||||
|
| [Iris](https://github.com/Marcos-cat/iris) | **5.5** | [Uiua](https://www.uiua.org/) | MIT |
|
||||||
|
|
||||||
|
### Older or Unmaintained Language Bindings
|
||||||
|
|
||||||
|
These are older raylib bindings that are more than 2 versions old or have not been maintained.
|
||||||
|
| Name | raylib Version | Language |
|
||||||
|
| ---------------------------------------------------------------------------------- | :------------: | :---------------------------------------------------------------------: |
|
||||||
|
| [raylib-cppsharp](https://github.com/phxvyper/raylib-cppsharp) | 2.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) |
|
||||||
|
| [RaylibFS](https://github.com/dallinbeutler/RaylibFS) | 2.5 | [F#](https://fsharp.org) |
|
||||||
|
| [raylib\*d](https://github.com/Sepheus/raylib_d) | 2.5 | [D](https://dlang.org) |
|
||||||
|
| [bindbc-raylib](https://github.com/o3o/bindbc-raylib) | 3.0 | [D](https://dlang.org) |
|
||||||
|
| [go-raylib](https://github.com/chunqian/go-raylib) | 3.5 | [Go](https://golang.org) |
|
||||||
|
| [raylib-goplus](https://github.com/Lachee/raylib-goplus) | 2.6-dev | [Go](https://golang.org) |
|
||||||
|
| [ray-go](https://github.com/hecate-tech/ray-go) | 2.6-dev | [Go](https://golang.org) |
|
||||||
|
| [raylib-luamore](https://github.com/HDPLocust/raylib-luamore) | 3.0 | [Lua](http://www.lua.org) |
|
||||||
|
| [LuaJIT-Raylib](https://github.com/Bambofy/LuaJIT-Raylib) | 2.6 | [Lua](http://www.lua.org) |
|
||||||
|
| [raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) | 2.5 | [Lua](http://www.lua.org) |
|
||||||
|
| [raylib-lua-ffi](https://github.com/raysan5/raylib/issues/693) | 2.0 | [Lua](http://www.lua.org) |
|
||||||
|
| [raylib-lua](https://github.com/raysan5/raylib-lua) | 1.7 | [Lua](http://www.lua.org) |
|
||||||
|
| [raylib-nelua](https://github.com/Andre-LA/raylib-nelua) | 3.0 | [Nelua](https://nelua.io) |
|
||||||
|
| [raylib-nim](https://github.com/Skrylar/raylib-nim) | 2.0 | [Nim](https://nim-lang.org) |
|
||||||
|
| [raylib-Nim](https://gitlab.com/define-private-public/raylib-Nim) | 1.7 | [Nim](https://nim-lang.org) |
|
||||||
|
| [nim-raylib](https://github.com/tomc1998/nim-raylib) | 3.1-dev | [Nim](https://nim-lang.org) |
|
||||||
|
| [raylib-Forever](https://github.com/Guevara-chan/Raylib-Forever) | auto | [Nim](https://nim-lang.org) |
|
||||||
|
| [NimraylibNow!](https://github.com/greenfork/nimraylib_now) | 4.2 | [Nim](https://nim-lang.org) |
|
||||||
|
| [raylib-haskell](https://github.com/DevJac/raylib-haskell) | 2.0 | [Haskell](https://www.haskell.org) |
|
||||||
|
| [raylib-cr](https://github.com/AregevDev/raylib-cr) | 2.5-dev | [Crystal](https://crystal-lang.org) |
|
||||||
|
| [raylib.cr](https://github.com/sam0x17/raylib.cr) | 2.0 | [Crystal](https://crystal-lang.org) |
|
||||||
|
| [cray](https://gitlab.com/Zatherz/cray) | 1.8 | [Crystal](https://crystal-lang.org) |
|
||||||
|
| [raylib-pas](https://github.com/tazdij/raylib-pas) | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal*(programming*language)) |
|
||||||
|
| [raylib-pascal](https://github.com/drezgames/raylib-pascal) | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal*(programming*language)) |
|
||||||
|
| [Graphics-Raylib](https://github.com/athreef/Graphics-Raylib) | 1.4 | [Perl](https://www.perl.org) |
|
||||||
|
| [raylib-ruby](https://github.com/a0/raylib-ruby) | 2.6 | [Ruby](https://www.ruby-lang.org/en) |
|
||||||
|
| [raylib-ruby-ffi](https://github.com/D3nX/raylib-ruby-ffi) | 2.0 | [Ruby](https://www.ruby-lang.org/en) |
|
||||||
|
| [raylib-mruby](https://github.com/lihaochen910/raylib-mruby) | 2.5-dev | [mruby](https://github.com/mruby/mruby) |
|
||||||
|
| [raylib-java](https://github.com/XoanaIO/raylib-java) | 2.0 | [Java](https://en.wikipedia.org/wiki/Java*(programming_language)) |
|
||||||
|
| [clj-raylib](https://github.com/lsevero/clj-raylib) | 3.0 | [Clojure](https://clojure.org) |
|
||||||
|
| [QuickJS-raylib](https://github.com/sntg-p/QuickJS-raylib) | 3.0 | [QuickJS](https://bellard.org/quickjs) |
|
||||||
|
| [raylib-duktape](https://github.com/RobLoach/raylib-duktape) | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) |
|
||||||
|
| [raylib-chaiscript](https://github.com/RobLoach/raylib-chaiscript) | 2.6 | [ChaiScript](http://chaiscript.com) |
|
||||||
|
| [raylib-squirrel](https://github.com/RobLoach/raylib-squirrel) | 2.5 | [Squirrel](http://www.squirrel-lang.org) |
|
||||||
|
| [racket-raylib-2d](https://github.com/arvyy/racket-raylib-2d) | 2.5 | [Racket](https://racket-lang.org) |
|
||||||
|
| [raylib-php-ffi](https://github.com/oraoto/raylib-php-ffi) | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) |
|
||||||
|
| [raylib-haxe](https://github.com/ibilon/raylib-haxe) | 2.4 | [Haxe](https://haxe.org) |
|
||||||
|
| [ringraylib](https://github.com/ringpackages/ringraylib) | 2.6 | [Ring](http://ring-lang.sourceforge.net) |
|
||||||
|
| [raylib-scm](https://github.com/yashrk/raylib-scm) | 2.5 | [Chicken Scheme](https://www.call-cc.org) |
|
||||||
|
| [raylib-chibi](https://github.com/VincentToups/raylib-chibi) | 2.5 | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) |
|
||||||
|
| [raylib-gambit-scheme](https://github.com/georgjz/raylib-gambit-scheme) | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) |
|
||||||
|
| [Euraylib](https://github.com/gAndy50/Euraylib) | 3.0 | [Euphoria](https://openeuphoria.org) |
|
||||||
|
| [raylib-odin](https://github.com/kevinw/raylib-odin) | 3.0 | [Odin](https://odin-lang.org) |
|
||||||
|
| [vraylib](https://github.com/waotzi/vraylib) | 3.5 | [V](https://vlang.io) |
|
||||||
|
| [raylib-vala](https://code.guddler.uk/mart/raylibVapi) | 3.0 | [Vala](https://wiki.gnome.org/Projects/Vala) |
|
||||||
|
| [raylib-jai](https://github.com/kujukuju/raylib-jai) | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) |
|
||||||
|
| [ray.zig](https://github.com/BitPuffin/zig-raylib-experiments) | 2.5 | [Zig](https://ziglang.org) |
|
||||||
|
| [raylib-Ada](https://github.com/mimo/raylib-Ada) | 3.0 | [Ada](https://www.adacore.com/about-ada) |
|
||||||
|
| [raykit](https://github.com/Gamerfiend/raykit) | **???** | [Kit](https://www.kitlang.org) |
|
||||||
|
| [ray.mod](https://github.com/bmx-ng/ray.mod) | 3.0 | [BlitzMax](https://blitzmax.org) |
|
||||||
|
| [raylib-mosaic](https://github.com/pluckyporcupine/raylib-mosaic) | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) |
|
||||||
|
| [raylib-xdpw](https://github.com/vtereshkov/raylib-xdpw) | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) |
|
||||||
|
| [raylib-carp](https://github.com/sacredbirdman/raylib-carp) | 3.0 | [Carp](https://github.com/carp-lang/Carp) |
|
||||||
|
| [raylib-fb](https://github.com/IchMagBier/raylib-fb) | 3.0 | [FreeBasic](https://www.freebasic.net) |
|
||||||
|
| [raylib-purebasic](https://github.com/D-a-n-i-l-o/raylib-purebasic) | 3.0 | [PureBasic](https://www.purebasic.com) |
|
||||||
|
| [raylib-ats2](https://github.com/mephistopheles-8/raylib-ats2) | 3.0 | [ATS2](http://www.ats-lang.org) |
|
||||||
|
| [raylib-beef](https://github.com/M0n7y5/raylib-beef) | 3.0 | [Beef](https://www.beeflang.org) |
|
||||||
|
| [raylib-never](https://github.com/never-lang/raylib-never) | 3.0 | [Never](https://github.com/never-lang/never) |
|
||||||
|
| [raylib.cbl](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib) | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) |
|
||||||
|
|
||||||
|
Missing some language or wrapper? Feel free to create a new one! :)
|
||||||
|
|
||||||
|
Usually, raylib bindings follow the convention: `raylib-{language}`
|
||||||
|
|
||||||
|
Let me know if you're writing a new binding for raylib, I will list it here!
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.25)
|
||||||
|
#this change avoid the warning that appear when we include raylib using Cmake fatch content
|
||||||
|
project(raylib)
|
||||||
|
|
||||||
|
# Avoid excessive expansion of variables in conditionals. In particular, if
|
||||||
|
# "PLATFORM" is "DRM" then:
|
||||||
|
#
|
||||||
|
# if (${PLATFORM} MATCHES "DRM")
|
||||||
|
#
|
||||||
|
# may expand e.g to:
|
||||||
|
#
|
||||||
|
# if (/usr/lib/aarch64-linux-gnu/libdrm.so MATCHES "DRM")
|
||||||
|
#
|
||||||
|
# See https://cmake.org/cmake/help/latest/policy/CMP0054.html
|
||||||
|
cmake_policy(SET CMP0054 NEW)
|
||||||
|
|
||||||
|
# Makes a hidden visibility preset on a static lib respected
|
||||||
|
# This is used to hide glfw's symbols from the library exports when building an so/dylib
|
||||||
|
# See https://cmake.org/cmake/help/latest/policy/CMP0063.html
|
||||||
|
cmake_policy(SET CMP0063 NEW)
|
||||||
|
|
||||||
|
# Directory for easier includes
|
||||||
|
# Anywhere you see include(...) you can check <root>/cmake for that file
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
|
# Sets compiler flags and language standard
|
||||||
|
include(CompilerFlags)
|
||||||
|
|
||||||
|
# Registers build options that are exposed to cmake
|
||||||
|
include(CMakeOptions.txt)
|
||||||
|
|
||||||
|
if (UNIX AND NOT APPLE AND NOT "${PLATFORM}" MATCHES "DRM" AND NOT "${PLATFORM}" MATCHES "Web")
|
||||||
|
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
|
||||||
|
message(FATAL_ERROR "Cannot disable both Wayland and X11")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Main sources directory (the second parameter sets the output directory name to raylib)
|
||||||
|
add_subdirectory(src raylib)
|
||||||
|
|
||||||
|
# Uninstall target, only create when building raylib by itself
|
||||||
|
# Avoid conflicting target names when using raylib with other libraries
|
||||||
|
if(NOT TARGET uninstall AND PROJECT_IS_TOP_LEVEL)
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Uninstall.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
|
IMMEDIATE @ONLY)
|
||||||
|
|
||||||
|
add_custom_target(uninstall
|
||||||
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${BUILD_EXAMPLES})
|
||||||
|
message(STATUS "Building examples is enabled")
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# ## Config options ###
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
include(EnumOption)
|
||||||
|
|
||||||
|
if(EMSCRIPTEN)
|
||||||
|
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
|
||||||
|
SET(PLATFORM Web CACHE STRING "Platform to build for.")
|
||||||
|
endif()
|
||||||
|
enum_option(PLATFORM "Desktop;Web;WebRGFW;Android;Raspberry Pi;DRM;SDL;RGFW" "Platform to build for.")
|
||||||
|
|
||||||
|
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?")
|
||||||
|
|
||||||
|
# Configuration options
|
||||||
|
option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
|
||||||
|
option(CUSTOMIZE_BUILD "Show options for customizing your Raylib library build." OFF)
|
||||||
|
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
|
||||||
|
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
|
||||||
|
option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended to run with ASAN)" OFF)
|
||||||
|
|
||||||
|
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
||||||
|
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
||||||
|
option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF)
|
||||||
|
cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON)
|
||||||
|
|
||||||
|
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
||||||
|
|
||||||
|
# GLFW build options
|
||||||
|
option(GLFW_BUILD_WAYLAND "Build the bundled GLFW with Wayland support" OFF)
|
||||||
|
option(GLFW_BUILD_X11 "Build the bundled GLFW with X11 support" ON)
|
||||||
|
|
||||||
|
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage)" OFF)
|
||||||
|
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
|
||||||
|
|
||||||
|
include(ParseConfigHeader)
|
||||||
|
|
||||||
|
foreach(FLAG IN LISTS CONFIG_HEADER_FLAGS)
|
||||||
|
string(REGEX MATCH "([^=]+)=(.+)" _ ${FLAG})
|
||||||
|
cmake_dependent_option(${CMAKE_MATCH_1} "" ${CMAKE_MATCH_2} CUSTOMIZE_BUILD ${CMAKE_MATCH_2})
|
||||||
|
endforeach()
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
## Contributing to raylib
|
||||||
|
|
||||||
|
Hello contributors! Welcome to raylib!
|
||||||
|
|
||||||
|
Do you enjoy raylib and want to contribute? Nice! You can help with the following points:
|
||||||
|
|
||||||
|
- `C programming` - Can you write/review/test/improve the code?
|
||||||
|
- `Documentation/Tutorials/Example` - Can you write some tutorials/examples?
|
||||||
|
- `Porting to other platforms` - Can you port/adapt/compile raylib on other systems?
|
||||||
|
- `Web Development` - Can you help [with the website](https://github.com/raysan5/raylib.com)?
|
||||||
|
- `Testing` - Can you find some bugs in raylib?
|
||||||
|
|
||||||
|
This document contains a set of guidelines to contribute to the project. These are mostly guidelines, not rules.
|
||||||
|
Use your best judgment, and feel free to propose changes to this document in a pull request.
|
||||||
|
|
||||||
|
### raylib philosophy
|
||||||
|
|
||||||
|
- raylib is a tool to **ENJOY** videogames programming, every function in raylib is designed as a mini-tutorial on itself.
|
||||||
|
- raylib is **SIMPLE** and **EASY-TO-USE**, I tried to keep it compact with a small set of functions, if a function is too complex, better not including it.
|
||||||
|
- raylib is open source and free; educators and institutions can use this tool to **TEACH** videogames programming completely for free.
|
||||||
|
- raylib is collaborative; contribution of tutorials / code examples / bug fixes / code comments are highly appreciated.
|
||||||
|
- raylib's license (and its external libs respective licenses) allow using raylib on commercial projects.
|
||||||
|
|
||||||
|
### Some interesting reads to start with
|
||||||
|
|
||||||
|
- [raylib history](HISTORY.md)
|
||||||
|
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
|
||||||
|
- [raylib license](LICENSE)
|
||||||
|
- [raylib roadmap](ROADMAP.md)
|
||||||
|
|
||||||
|
[raylib Wiki](https://github.com/raysan5/raylib/wiki) contains some information about the library and is open to anyone to edit.
|
||||||
|
Feel free to review it if required, just take care not to break something.
|
||||||
|
|
||||||
|
### raylib C coding conventions
|
||||||
|
|
||||||
|
Despite being written in C, raylib does not follow the standard Hungarian notation for C,
|
||||||
|
it [follows Pascal-case/camel-case notation](https://github.com/raysan5/raylib/wiki/raylib-coding-conventions),
|
||||||
|
more common in C# language. All code formatting decisions have been carefully taken
|
||||||
|
to make it easier for students/users to read, write and understand code.
|
||||||
|
|
||||||
|
Source code is extensively commented for that purpose, raylib primary learning method is:
|
||||||
|
|
||||||
|
> `Learn by reading code and examples`
|
||||||
|
|
||||||
|
For detailed information on building raylib and examples, please check [raylib Wiki](https://github.com/raysan5/raylib/wiki).
|
||||||
|
|
||||||
|
### Opening new Issues
|
||||||
|
|
||||||
|
To open new issues for raylib (bug, enhancement, discussion...), just try to follow these rules:
|
||||||
|
|
||||||
|
- Make sure the issue has not already been reported before by searching on GitHub under Issues.
|
||||||
|
- If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a
|
||||||
|
title and clear description, as much relevant information as possible, and a code sample demonstrating the unexpected behavior.
|
||||||
|
- If applicable, attach some screenshot of the issue and a .zip file with the code sample and required resources.
|
||||||
|
- On issue description, add a brackets tag about the raylib module that relates to this issue.
|
||||||
|
If don't know which module, just report the issue, I will review it.
|
||||||
|
- You can check other issues to see how it's being done!
|
||||||
|
|
||||||
|
### Sending a Pull-Request
|
||||||
|
|
||||||
|
- Make sure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
|
||||||
|
- Don't send big pull requests (lots of changelists), they are difficult to review. It's better to send small pull requests, one at a time.
|
||||||
|
- Verify that changes don't break the build (at least on Windows platform). The more platforms where you can test it, the better, but don't worry
|
||||||
|
if you cannot test all the platforms.
|
||||||
|
|
||||||
|
### Contact information
|
||||||
|
|
||||||
|
If you have any doubt, don't hesitate to [contact me](mailto:ray@raylib.com)!.
|
||||||
|
You can write me a direct mail but you can also contact me on the following networks:
|
||||||
|
|
||||||
|
- [raylib Discord](https://discord.gg/raylib) - A direct communication channel for project discussions.
|
||||||
|
- [raylib reddit](https://www.reddit.com/r/raylib/) - A good place for discussions or to ask for help.
|
||||||
|
- [raylib web](http://www.raylib.com/) - On top-right corner there is a bunch of networks where you can find me.
|
||||||
|
- [raylib X](https://x.com/raysan5) - My personal X account, I usually post about raylib, you can send me PMs.
|
||||||
|
|
||||||
|
Thank you very much for your time! :)
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
## C Coding Style Conventions
|
||||||
|
|
||||||
|
Here is a list with some of the code conventions used by raylib:
|
||||||
|
|
||||||
|
Code element | Convention | Example
|
||||||
|
--- | :---: | ---
|
||||||
|
Defines | ALL_CAPS | `#define PLATFORM_DESKTOP`
|
||||||
|
Macros | ALL_CAPS | `#define MIN(a,b) (((a)<(b))?(a):(b))`
|
||||||
|
Variables | lowerCase | `int screenWidth = 0;`, `float targetFrameTime = 0.016f;`
|
||||||
|
Local variables | lowerCase | `Vector2 playerPosition = { 0 };`
|
||||||
|
Global variables | lowerCase | `bool windowReady = false;`
|
||||||
|
Constants | lowerCase | `const int maxValue = 8;`
|
||||||
|
Pointers | MyType *pointer | `Texture2D *array = NULL;`
|
||||||
|
float values | always x.xf | `float gravity = 10.0f` (avoid `10.f`)
|
||||||
|
Operators | value1*value2 | `int product = value*6;`
|
||||||
|
Operators | value1/value2 | `int division = value/4;`
|
||||||
|
Operators | value1 + value2 | `int sum = value + 10;`
|
||||||
|
Operators | value1 - value2 | `int res = value - 5;`
|
||||||
|
Enum | TitleCase | `enum TextureFormat`
|
||||||
|
Enum members | ALL_CAPS | `PIXELFORMAT_UNCOMPRESSED_R8G8B8`
|
||||||
|
Struct | TitleCase | `struct Texture2D`, `struct Material`
|
||||||
|
Struct members | lowerCase | `texture.width`, `color.r`
|
||||||
|
Functions | TitleCase | `InitWindow()`, `LoadImageFromMemory()`
|
||||||
|
Functions params | lowerCase | `width`, `height`
|
||||||
|
Ternary Operator | (condition)? result1 : result2 | `printf("Value is 0: %s", (value == 0)? "yes" : "no");`
|
||||||
|
|
||||||
|
Some other conventions to follow:
|
||||||
|
- **ALWAYS** initialize all defined variables.
|
||||||
|
- **Do not use TABS**, use 4 spaces instead.
|
||||||
|
- Avoid trailing spaces, please, avoid them
|
||||||
|
- Comments always start with space + capital letter and never end with a '.', place them **before** the line(s) they refer to
|
||||||
|
```c
|
||||||
|
// This is a comment in raylib or raylib examples
|
||||||
|
```
|
||||||
|
- Control flow statements always are followed **by a space**:
|
||||||
|
```c
|
||||||
|
if (condition) value = 0;
|
||||||
|
|
||||||
|
while (!WindowShouldClose())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always use accumulators as `x++` instead of `++x`
|
||||||
|
for (int i = 0; i < NUM_VALUES; i++) printf("%i", i);
|
||||||
|
|
||||||
|
// Be careful with the switch formatting!
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case 2: break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- All conditions checks are **always between parenthesis** but not boolean values:
|
||||||
|
```c
|
||||||
|
if ((value > 1) && (value < 50) && valueActive)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- When dealing with braces or curly brackets, open-close them in aligned mode:
|
||||||
|
```c
|
||||||
|
void SomeFunction()
|
||||||
|
{
|
||||||
|
// TODO: Do something here!
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**If proposing new functions, please try to use a clear naming for function-name and functions-parameters, in case of doubt, open an issue for discussion.**
|
||||||
|
|
||||||
|
## Files and Directories Naming Conventions
|
||||||
|
|
||||||
|
- Directories will be named using `snake_case`: `resources/models`, `resources/fonts`
|
||||||
|
|
||||||
|
- Files will be named using `snake_case`: `main_title.png`, `cubicmap.png`, `sound.wav`
|
||||||
|
|
||||||
|
_NOTE: Avoid any space or special character in the files/dir naming!_
|
||||||
|
|
||||||
|
## Games/Examples Directories Organization Conventions
|
||||||
|
|
||||||
|
- Data files should be organized by context and usage in the game, think about the loading requirements for data and put all the resources that need to be loaded at the same time together.
|
||||||
|
- Use descriptive names for the files, it would be perfect if just reading the name of the file, it was possible to know what is that file and where fits in the game.
|
||||||
|
- Here is an example, note that some resources require to be loaded all at once while other require to be loaded only at initialization (gui, font).
|
||||||
|
|
||||||
|
```
|
||||||
|
resources/audio/fx/long_jump.wav
|
||||||
|
resources/audio/music/main_theme.ogg
|
||||||
|
resources/screens/logo/logo.png
|
||||||
|
resources/screens/title/title.png
|
||||||
|
resources/screens/gameplay/background.png
|
||||||
|
resources/characters/player.png
|
||||||
|
resources/characters/enemy_slime.png
|
||||||
|
resources/common/font_arial.ttf
|
||||||
|
resources/common/gui.png
|
||||||
|
```
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
# Frequently Asked Questions
|
||||||
|
|
||||||
|
- [What is raylib?](#what-is-raylib)
|
||||||
|
- [What can I do with raylib?](#what-can-i-do-with-raylib)
|
||||||
|
- [Which kinds of games can I make with raylib?](#which-kinds-of-games-can-i-make-with-raylib)
|
||||||
|
- [Can I create non-game applications with raylib?](#can-i-create-non-game-applications-with-raylib)
|
||||||
|
- [How can I learn to use raylib? Is there some official documentation or tutorials?](#how-can-i-learn-to-use-raylib-is-there-some-official-documentation-or-tutorials)
|
||||||
|
- [How much does it cost?](#how-much-does-it-cost)
|
||||||
|
- [What is the raylib license?](#what-is-the-raylib-license)
|
||||||
|
- [What platforms are supported by raylib?](#what-platforms-are-supported-by-raylib)
|
||||||
|
- [What programming languages can I use with raylib?](#what-programming-languages-can-i-use-with-raylib)
|
||||||
|
- [Why is it coded in C?](#why-is-it-coded-in-c)
|
||||||
|
- [Is raylib a videogames engine?](#is-raylib-a-videogames-engine)
|
||||||
|
- [What does raylib provide that other engines or libraries don't?](#what-does-raylib-provide-that-other-engines-or-libraries-dont)
|
||||||
|
- [How does raylib compare to Unity/Unreal/Godot?](#how-does-raylib-compare-to-unityunrealgodot)
|
||||||
|
- [What development tools are required for raylib?](#what-development-tools-are-required-for-raylib)
|
||||||
|
- [What are raylib's external dependencies?](#what-are-raylibs-external-dependencies)
|
||||||
|
- [Can I use raylib with other technologies or libraries?](#can-i-use-raylib-with-other-technologies-or-libraries)
|
||||||
|
- [What file formats are supported by raylib?](#what-file-formats-are-supported-by-raylib)
|
||||||
|
- [Does raylib support the Vulkan API?](#does-raylib-support-the-vulkan-api)
|
||||||
|
- [What could I expect to see in raylib in the future?](#what-could-i-expect-to-see-in-raylib-in-the-future)
|
||||||
|
- [Who are the raylib developers?](#who-are-the-raylib-developers)
|
||||||
|
- [MORE QUESTIONS...](https://github.com/raysan5/raylib/wiki/Frequently-Asked-Questions)
|
||||||
|
|
||||||
|
### What is raylib?
|
||||||
|
|
||||||
|
raylib is a C programming library, designed to be simple and easy-to-use. It provides a set of functions intended for graphics/multimedia applications programming.
|
||||||
|
|
||||||
|
### What can I do with raylib?
|
||||||
|
|
||||||
|
raylib can be used to create any kind of graphics/multimedia applications: videogames, tools, mobile apps, web applications... Actually it can be used to create any application that requires something to be shown in a display with graphic hardware acceleration (OpenGL); including [IoT](https://en.wikipedia.org/wiki/Internet_of_things) devices with a graphics display.
|
||||||
|
|
||||||
|
### Which kinds of games can I make with raylib?
|
||||||
|
|
||||||
|
With enough time and effort any kind of game/application can be created but small-mid sized 2d videogames are the best fit. The raylib [examples](https://www.raylib.com/examples.html)/[games](https://www.raylib.com/games.html) and [raylibtech](https://raylibtech.itch.io/) tools are an example of what can be accomplished with raylib.
|
||||||
|
|
||||||
|
### Can I create non-game applications with raylib?
|
||||||
|
|
||||||
|
Yes, raylib can be used to create any kind of application, not just videogames. For example, it can be used to create [desktop/web tools](https://raylibtech.itch.io/) or also applications for an IoT devices like [Raspberry Pi](https://www.raspberrypi.org/).
|
||||||
|
|
||||||
|
### How can I learn to use raylib? Is there some official documentation or tutorials?
|
||||||
|
|
||||||
|
raylib does not provide a "standard" API reference documentation like other libraries, all of the raylib functionality is exposed in a simple [cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html). Most of the functions are self-explanatory and the required parameters are very intuitive. It's also highly recommended to take a look at [`raylib.h`](https://github.com/raysan5/raylib/blob/master/src/raylib.h) header file or even the source code, that is very clean and organized, intended for teaching.
|
||||||
|
|
||||||
|
raylib also provides a big [collection of examples](https://www.raylib.com/examples.html), to showcase the multiple functionality usage (+120 examples). Examples are categorized by the internal module functionality and also define an estimated level of difficulty to guide the users checking them.
|
||||||
|
|
||||||
|
There is also a [FAQ on the raylib Wiki](https://github.com/raysan5/raylib/wiki/Frequently-Asked-Questions) with common technical questions.
|
||||||
|
|
||||||
|
There are also many tutorials on the internet and YouTube created by the growing raylib community over the years.
|
||||||
|
|
||||||
|
[raylib Discord Community](https://discord.gg/raylib) is also a great place to join and ask questions, the community is very friendly and always ready to help.
|
||||||
|
|
||||||
|
### How much does it cost?
|
||||||
|
|
||||||
|
raylib is [free and open source](https://github.com/raysan5/raylib). Anyone can use raylib library for free to create games/tools/apps but also the source code of raylib is open for anyone to check it, modify it, adapt it as required or just learn how it works internally.
|
||||||
|
|
||||||
|
### What is the raylib license?
|
||||||
|
|
||||||
|
raylib source code is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed-source software. Check [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE) for further details.
|
||||||
|
|
||||||
|
### What platforms are supported by raylib?
|
||||||
|
|
||||||
|
raylib source code can be compiled for the following platforms:
|
||||||
|
|
||||||
|
- Windows (7, 8.1, 10, 11)
|
||||||
|
- Linux - Desktop (multiple distributions, X11 and Wayland based)
|
||||||
|
- Linux - Native (no windowing system, [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager))
|
||||||
|
- macOS (multiple versions, including ARM64)
|
||||||
|
- FreeBSD, OpenBSD, NetBSD, DragonFly
|
||||||
|
- Raspberry Pi (desktop and native)
|
||||||
|
- Android (multiple API versions and architectures)
|
||||||
|
- HTML5 (WebAssembly)
|
||||||
|
- Haiku
|
||||||
|
|
||||||
|
raylib code has also been ported to several [homebrew](https://en.wikipedia.org/wiki/Homebrew_(video_games)) platforms: N3DS, Switch, PS4, PSVita.
|
||||||
|
|
||||||
|
Also note that raylib is a low-level library that can be easily ported to any platform with OpenGL support (or similar API).
|
||||||
|
|
||||||
|
### What programming languages can I use with raylib?
|
||||||
|
|
||||||
|
raylib original version is coded in C language (using some C99 features) but it has bindings to +60 programming languages. Check [BINDINGS.md](https://github.com/raysan5/raylib/blob/master/BINDINGS.md) for details.
|
||||||
|
|
||||||
|
### Why is it coded in C?
|
||||||
|
|
||||||
|
It's a simple language, no high-level code abstractions like [OOP](https://en.wikipedia.org/wiki/Object-oriented_programming), just data types and functions. It's a very enjoyable language to code.
|
||||||
|
|
||||||
|
### Is raylib a videogames engine?
|
||||||
|
|
||||||
|
I personally consider raylib a graphics library with some high-level features rather than an engine. The line that separates a library/framework from an engine could be very confusing; raylib provides all the required functionality to create simple games or small applications but it does not provide 3 elements that I personally consider any "engine" should provide: Screen manager, GameObject/Entity manager and Resource Manager. Still, most users do not need those elements or just code simple approaches on their own.
|
||||||
|
|
||||||
|
### What does raylib provide that other engines or libraries don't?
|
||||||
|
|
||||||
|
I would say "simplicity" and "enjoyment" at a really low level of coding but actually it is up to the user to discover it, to try it and to see if it fits their needs. raylib is not good for everyone but it's worth a try.
|
||||||
|
|
||||||
|
### How does raylib compare to Unity/Unreal/Godot?
|
||||||
|
|
||||||
|
Those engines are usually big and complex to use, providing lot of functionality. They require some time to learn and test, they usually abstract many parts of the game development process and they usually provide a set of tools to assist users on their creations (like a GUI editor).
|
||||||
|
|
||||||
|
raylib is a simple programming library, with no integrated tools or editors. It gives full control to users at a very low level to create graphics applications in a more handmade way.
|
||||||
|
|
||||||
|
### What development tools are required for raylib?
|
||||||
|
|
||||||
|
To develop raylib programs you only need a text editor (with recommended code syntax highlighting) and a compiler.
|
||||||
|
|
||||||
|
A [raylib Windows Installer](https://raysan5.itch.io/raylib) package is distributed including the Notepad++ editor and MinGW (GCC) compiler pre-configured for Windows for new users as an starter-pack but for more advanced configurations with other editors/compilers, [raylib Wiki](https://github.com/raysan5/raylib/wiki) provides plenty of configuration tutorials.
|
||||||
|
|
||||||
|
### What are raylib's external dependencies?
|
||||||
|
|
||||||
|
raylib is self-contained, it has no external dependencies to build it. But internally raylib uses several libraries from other developers, mostly used to load specific file formats.
|
||||||
|
|
||||||
|
A detailed list of raylib dependencies can be found on the [raylib Wiki](https://github.com/raysan5/raylib/wiki/raylib-dependencies).
|
||||||
|
|
||||||
|
### Can I use raylib with other technologies or libraries?
|
||||||
|
|
||||||
|
Yes, raylib can be used with other libraries that provide specific functionality. There are multiple examples of raylib integrations with libraries like Spine, Tiled, Dear Imgui and several physics engines.
|
||||||
|
|
||||||
|
### What file formats are supported by raylib?
|
||||||
|
|
||||||
|
raylib can load data from multiple standard file formats:
|
||||||
|
|
||||||
|
- Image/Textures: PNG, BMP, TGA, JPG, GIF, QOI, PSD, DDS, HDR, KTX, ASTC, PKM, PVR
|
||||||
|
- Fonts: FNT (sprite font), TTF, OTF
|
||||||
|
- Models/Meshes: OBJ, IQM, GLTF, VOX, M3D
|
||||||
|
- Audio: WAV, OGG, MP3, FLAC, XM, MOD, QOA
|
||||||
|
|
||||||
|
### Does raylib support the Vulkan API?
|
||||||
|
|
||||||
|
No, raylib is built on top of OpenGL API, and there are currently no plans to support any other graphics APIs. In any case, raylib uses rlgl as an abstraction layer to support different OpenGL versions. If really required, a Vulkan backend equivalent could be added but creating that abstraction layer would imply a considerable amount of work.
|
||||||
|
|
||||||
|
### What could I expect to see in raylib in the future?
|
||||||
|
|
||||||
|
The main focus of the library is simplicity. Most of the efforts are invested in maintainability and bug-fixing. Despite new small features being regularly added, it's not the objective for raylib to become a full-featured engine. Personally I prefer to keep it small and enjoyable.
|
||||||
|
|
||||||
|
### Who are the raylib developers?
|
||||||
|
|
||||||
|
The main raylib developer and maintainer is [Ramon Santamaria](https://www.linkedin.com/in/raysan/) but there are 360+ contributors that have helped by adding new features, testing the library and solving issues in the 9+ years life of raylib.
|
||||||
|
|
||||||
|
The full list of raylib contributors can be seen [on GitHub](https://github.com/raysan5/raylib/graphs/contributors).
|
||||||
@@ -0,0 +1,551 @@
|
|||||||
|

|
||||||
|
|
||||||
|
introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
I started developing videogames in 2006 and some years later I started teaching videogames development to young people with artistic profiles, most of students had never written a single line of code.
|
||||||
|
|
||||||
|
I decided to start with C language basis and, after searching for the most simple and easy-to-use library to teach videogames programming, I found [WinBGI](https://winbgim.codecutter.org/); it was great and it worked very well with students, in just a couple of weeks, those students that had never written a single line of code were able to program (and understand) a simple PONG game, some of them even a BREAKOUT!
|
||||||
|
|
||||||
|
But WinBGI was not the clearest and most organized library for my taste. There were lots of things I found confusing and some function names were not clear enough for most of the students; not to mention the lack of transparencies support and no hardware acceleration.
|
||||||
|
|
||||||
|
So, I decided to create my own library, hardware accelerated, clear function names, quite organized, well structured, plain C coding and, most importantly, primarily intended to learn videogames programming.
|
||||||
|
|
||||||
|
My previous videogames development experience was mostly in C# and [XNA](https://en.wikipedia.org/wiki/Microsoft_XNA) and I really loved it, so, I decided to use C# language style notation and XNA naming conventions. That way, students were able to move from raylib to XNA, MonoGame or similar libs extremely easily.
|
||||||
|
|
||||||
|
raylib started as a weekend project and after three months of hard work, **raylib 1.0 was published on November 2013**.
|
||||||
|
|
||||||
|
Enjoy it.
|
||||||
|
|
||||||
|
notes on raylib 1.1
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On April 2014, after 6 months of first raylib release, raylib 1.1 was released. This new version presents a complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
||||||
|
|
||||||
|
- A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translates raylib-OpenGL-style immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
||||||
|
|
||||||
|
- [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
||||||
|
|
||||||
|
Some other big changes of this new version have been the support for OGG file loading and stream playing, and the support of DDS texture files (compressed and uncompressed) along with mipmaps support.
|
||||||
|
|
||||||
|
Lots of code changes and a lot of testing have concluded in this amazing new raylib 1.1.
|
||||||
|
|
||||||
|
notes on raylib 1.2
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On September 2014, after 5 months of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/rcore.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
|
||||||
|
|
||||||
|
It's been some months of really hard work to accommodate raylib to those new platforms while keeping it easy for the users. On Android, raylib manages internally the activity cycle, as well as the inputs; on Raspberry Pi, a complete raw input system has been written from scratch.
|
||||||
|
|
||||||
|
- A new display initialization system has been created to support multiple resolutions, adding black bars if required; the user only defines the desired screen size and it gets properly displayed.
|
||||||
|
|
||||||
|
- Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
|
||||||
|
|
||||||
|
Lots of code changes and a lot of testing have concluded in this amazing new raylib 1.2.
|
||||||
|
|
||||||
|
In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
|
||||||
|
|
||||||
|
notes on raylib 1.3
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality, improves tremendously textures module and also provides some new modules (camera system, gestures system, immediate-mode gui).
|
||||||
|
|
||||||
|
- Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be attached to 3d models or used as fullscreen post-processing effects. A bunch of postprocessing shaders are also included in this release, check raylib/shaders folder.
|
||||||
|
|
||||||
|
- Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
|
||||||
|
|
||||||
|
- A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/rcamera.h) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core/core_3d_camera_first_person.c).
|
||||||
|
|
||||||
|
- New [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||||
|
|
||||||
|
- [raygui](https://github.com/raysan5/raylib/blob/master/examples/shapes/raygui.h), the new immediate-mode GUI module offers a set of functions to create simple user interfaces, primarily intended for tools development. It's still in an experimental state but already fully functional.
|
||||||
|
|
||||||
|
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
|
||||||
|
|
||||||
|
Lots of code changes and a lot of testing have concluded in this amazing new raylib 1.3.
|
||||||
|
|
||||||
|
notes on raylib 1.4
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version, lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
|
||||||
|
|
||||||
|
- First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1331) that have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image. Now basic image processing can be done before converting the image to texture for usage.
|
||||||
|
|
||||||
|
- SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library). Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
|
||||||
|
|
||||||
|
- New [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) physics module for basic 2D physics support. Still in development but already functional. Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
|
||||||
|
|
||||||
|
- [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
|
||||||
|
|
||||||
|
- [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.h) module has been redesigned and simplified, now it can process touch events from any source, including the mouse. This way, gestures system can be used on any platform providing a unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
|
||||||
|
|
||||||
|
- Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
|
||||||
|
|
||||||
|
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
|
||||||
|
and the addition of two simple functions for persistent data storage. Now raylib users can save and load game data in a file (only some platforms are supported). A simple [easings](https://github.com/raysan5/raylib/blob/master/examples/shapes/reasings.h) module has also been added for values animation.
|
||||||
|
|
||||||
|
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
|
||||||
|
how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
|
||||||
|
|
||||||
|
Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
|
||||||
|
|
||||||
|
notes on raylib 1.5
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
|
||||||
|
|
||||||
|
- VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameters, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/master/examples/core_oculus_rift.c).
|
||||||
|
|
||||||
|
- New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
|
||||||
|
|
||||||
|
- New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages to render internally for every 3d object using standard material.
|
||||||
|
|
||||||
|
- Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
|
||||||
|
|
||||||
|
- Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/master/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/master/examples/physics_basic_rigidbody.c). Performance has also been significantly improved, now physic objects are managed internally in a second thread.
|
||||||
|
|
||||||
|
- Audio chiptunes support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All these features thanks to the amazing work of @kd7tck.
|
||||||
|
|
||||||
|
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core/core_2d_rcamera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
|
||||||
|
|
||||||
|
This new version is so massive that is difficult to list all the improvements, most of the raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) module has been completely redesigned to accommodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) file for a more detailed list of changes.
|
||||||
|
|
||||||
|
Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/master/examples/audio_standalone.c) raylib modules as standalone libraries.
|
||||||
|
|
||||||
|
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
||||||
|
|
||||||
|
notes on raylib 1.6
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version commemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
|
||||||
|
|
||||||
|
- Complete [raylib Lua binding](https://github.com/raysan5/raylib-lua). All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
|
||||||
|
|
||||||
|
- Completely redesigned [audio module](https://github.com/raysan5/raylib/blob/master/src/raudio.c). Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. [FLAC file format support](https://github.com/raysan5/raylib/blob/master/src/external/dr_flac.h) has also been added. In the same line, [OpenAL Soft](https://github.com/kcat/openal-soft) backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completely self-contained, no external libraries are required anymore!
|
||||||
|
|
||||||
|
- [Physac](https://github.com/victorfisac/Physac) module has been moved to its own repository and it has been improved A LOT, actually, the library has been completely rewritten from scratch by [@victorfisac](https://github.com/victorfisac), multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
|
||||||
|
|
||||||
|
- Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
|
||||||
|
|
||||||
|
- Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
|
||||||
|
|
||||||
|
- Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
|
||||||
|
|
||||||
|
Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advanced users, it has been added pre-configured [Visual Studio C++ 2015 solution](https://github.com/raysan5/raylib/tree/master/projects/vs2015) with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
|
||||||
|
|
||||||
|
New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
|
||||||
|
|
||||||
|
notes on raylib 1.7
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
On May 2017, around 6 months after raylib 1.6, comes another raylib installment, raylib 1.7. This time library has been improved a lot in terms of consistency and cleanness. As stated in [this patreon article](https://www.patreon.com/posts/raylib-future-7501034), this new raylib version has focused efforts in becoming more simple and easy-to-use to learn videogames programming. Some highlights of this new version are:
|
||||||
|
|
||||||
|
- More than 30 new functions added to the library, functions to control Window, utils to work with filenames and extensions, functions to draw lines with custom thick, mesh loading, functions for 3d ray collisions detailed detection, functions for VR simulation and much more... Just check [CHANGELOG](CHANGELOG) for a detailed list of additions!
|
||||||
|
|
||||||
|
- Support of [configuration flags](https://github.com/raysan5/raylib/issues/200) on every raylib module. Advanced users can customize raylib just by choosing desired features, and defining some configuration flags on modules compilation. That way users can control library size and available functionality.
|
||||||
|
|
||||||
|
- Improved [build system](https://github.com/raysan5/raylib/blob/master/src/Makefile) for all supported platforms (Windows, Linux, OSX, RPI, Android, HTML5) with a unique Makefile to compile sources. Added support for Android compilation with a custom standalone toolchain and also multiple build compilation flags.
|
||||||
|
|
||||||
|
- New [examples](http://www.raylib.com/examples.html) and [sample games](http://www.raylib.com/games.html) added. All sample material has been reviewed, removing useless examples and adding more comprehensive ones; all material has been ported to the latest raylib version and tested on multiple platforms. Examples folder structure has been improved and also build systems.
|
||||||
|
|
||||||
|
- Improved library consistency and organization in general. Functions and parameters have been renamed, some parts of the library have been cleaned and simplified, some functions have been moved to examples (lighting, Oculus Rift CV1 support) towards a more generic library implementation. Lots of hours have been invested in this process...
|
||||||
|
|
||||||
|
Some other features: Gamepad support on HTML5, RPI touch screen support, 32bit audio support, frames timing improvements, public log system, rres file format support, automatic GIF recording...
|
||||||
|
|
||||||
|
And here is another version of **raylib, a simple and easy-to-use library to enjoy videogames programming**. Enjoy it.
|
||||||
|
|
||||||
|
notes on raylib 1.8
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
October 2017, around 5 months after latest raylib version, another release is published: raylib 1.8. Again, several modules of the library have been reviewed and some new functionality added. Main changes of this new release are:
|
||||||
|
|
||||||
|
- [Procedural image generation](https://github.com/raysan5/raylib/blob/master/examples/textures/textures_image_generation.c) function, a set of new functions have been added to generate gradients, checked, noise and cellular images from scratch. Image generation could be useful for certain textures or learning purposes.
|
||||||
|
|
||||||
|
- [Parametric mesh generation](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_generation.c) functions, create 3d meshes from scratch just defining a set of parameters, meshes like cube, sphere, cylinder, torus, knot and more can be very useful for prototyping or for lighting and texture testing.
|
||||||
|
|
||||||
|
- PBR Materials support, a completely redesigned shaders and material system allows advanced materials definition and usage, with fully customizable shaders. Some new functions have been added to generate the environment textures required for PBR shading and a a new complete [PBR material example](https://github.com/raysan5/raylib/blob/master/examples/models/models_material_pbr.c) is also provided for reference.
|
||||||
|
|
||||||
|
- Custom Android APK build pipeline with [simple Makefile](https://github.com/raysan5/raylib/blob/master/templates/simple_game/Makefile). Actually, full code building mechanism based on plain Makefile has been completely reviewed and Android building has been added for sources and also for examples and templates building into the final APK package. This way, raylib Android building has been greatly simplified and integrated seamlessly into standard build scripts.
|
||||||
|
|
||||||
|
- [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) module has been completely reviewed and most of the functions renamed for consistency. This way, standalone usage of rlgl is promoted, with a [complete example provided](https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c). rlgl offers a pseudo-OpenGL 1.1 immediate-mode programming-style layer, with backends to multiple OpenGL versions.
|
||||||
|
|
||||||
|
- [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) library has been also reviewed to align with other advance math libraries like [GLM](https://github.com/g-truc/glm). Matrix math has been improved and simplified, some new Quaternion functions have been added and Vector3 functions have been renamed all around the library for consistency with new Vector2 functionality.
|
||||||
|
|
||||||
|
Additionally, as always, examples and templates have been reviewed to work with new version (some new examples have been added), all external libraries have been updated to latest stable version and latest Notepad++ and MinGW have been configured to work with new raylib. For a full list of changes, just check [CHANGELOG](CHANGELOG).
|
||||||
|
|
||||||
|
New installer provided, web updated, examples re-builded, documentation reviewed... **new raylib 1.8 published**. Enjoy coding games.
|
||||||
|
|
||||||
|
notes on raylib 2.0
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
It's been 9 months since last raylib version was published, a lot of things have changed since then... This new raylib version represents an inflection point in the development of the library and so, we jump to a new major version... Here is the result of almost **5 years and thousands of hours of hard work**... here is... **raylib 2.0**
|
||||||
|
|
||||||
|
In **raylib 2.0** the full API has been carefully reviewed for better consistency, some new functionality has been added and the overall raylib experience has been greatly improved... The key features of new version are:
|
||||||
|
|
||||||
|
- **Complete removal of external dependencies.** Finally, raylib does not require external libraries to be installed and linked along with raylib, all required libraries are contained and compiled within raylib. Obviously some external libraries are required but only the strictly platform-dependent ones, the ones that come installed with the OS. So, raylib becomes a self-contained platform-independent games development library.
|
||||||
|
|
||||||
|
- **Full redesign of audio module to use the amazing miniaudio library**, along with external dependencies removal, OpenAL library has been replaced by [miniaudio](https://github.com/dr-soft/miniaudio), this brand new library offers automatic dynamic linking with default OS audio systems. Undoubtedly, the perfect low-level companion for raylib audio module!
|
||||||
|
|
||||||
|
- **Support for continuous integration building*** through AppVeyor and Travis CI. Consequently, raylib GitHub develop branch has been removed, simplifying the code-base to a single master branch, always stable. Every time a new commit is deployed, library is compiled for **up-to 12 different configurations**, including multiple platforms, 32bit/64bit and multiple compiler options! All those binaries are automatically attached to any new release!
|
||||||
|
|
||||||
|
- **More platforms supported and tested**, including BSD family (FreeBSD, openBSD, NetBSD, DragonFly) and Linux-based family platforms (openSUSE, Debian, Ubuntu, Arch, NixOS...). raylib has already been added to some package managers! Oh, and last but not less important, **Android 64bit** is already supported by raylib!
|
||||||
|
|
||||||
|
- **Support for TCC compiler!** Thanks to the lack of external dependencies, raylib can now be easily compiled with a **minimal toolchain**, like the one provided by Tiny C Compiler. It opens the door to an amazing future, allowing, for example, static linkage of libtcc for **runtime compilation of raylib-based code**... and the library itself if required! Moreover, TCC is blazing fast, it can compile all raylib in a couple of seconds!
|
||||||
|
|
||||||
|
- Refactored all raylib configuration #defines into a **centralized `config.h` header**, with more than **40 possible configuration options** to compile a totally customizable raylib version including only desired options like supported file formats or specific functionality support. It allows generating a trully ligth-weight version of the library if desired!
|
||||||
|
|
||||||
|
A part of that, lots of new features, like a brand **new font rendering and packaging system** for TTF fonts with **SDF support** (thanks to the amazing STB headers), new functions for **CPU image data manipulation**, new orthographic 3d camera mode, a complete review of `raymath.h` single-file header-only library for better consistency and performance, new examples and way, [way more](https://github.com/raysan5/raylib/blob/master/CHANGELOG).
|
||||||
|
|
||||||
|
Probably by now, **raylib 2.0 is the simplest and easiest-to-use library to enjoy (and learn) videogames programming**... but, undoubtedly its development has exceeded any initial objective; raylib has become a simple and easy-to-use truly multiplatform portable standalone media library with thousands of possibilities... and that's just the beginning!
|
||||||
|
|
||||||
|
notes on raylib 2.5
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
After almost one years since latest raylib installment, here is **raylib 2.5**. A lot of work has been put on this new version and consequently I decided to bump versioning several digits. The complete list of changes and additions is humungous, details can be found in the [CHANGELOG](CHANGELOG), and here is a short recap with the highlight improvements.
|
||||||
|
|
||||||
|
- New **window management and file system functions** to query monitor information, deal with clipboard, check directory files info and even launch a URL with default system web browser. Experimental **High-DPI monitor support** has also been added through a compile flag.
|
||||||
|
|
||||||
|
- **Redesigned Gamepad mechanism**, now generic for all platforms and gamepads, no more specific gamepad configurations.
|
||||||
|
**Redesigned UWP input system**, now raylib supports UWP seamlessly, previous implementation required a custom input system implemented in user code.
|
||||||
|
|
||||||
|
- `rlgl` module has been redesigned to **support a unique buffer for shapes drawing batching**, including LINES, TRIANGLES, QUADS in the same indexed buffer, also added support for multi-buffering if required. Additionally, `rlPushMatrix()`/`rlPopMatrix()` functionality has been reviewed to behave exactly like OpenGL 1.1, `models_rlgl_solar_system` example has been added to illustrate this behavior.
|
||||||
|
|
||||||
|
- **VR simulator** has been reviewed to **allow custom configuration of Head-Mounted-Device parameters and distortion shader**, `core_vr_simulator` has been properly adapted to showcase this new functionality, now the VR simulator is a generic configurable stereo rendering system that allows any VR device simulation with just a few lines of code or even dynamic tweaking of HMD parameters.
|
||||||
|
|
||||||
|
- Support for **Unicode text drawing**; now raylib processes UTF8 strings on drawing, supporting Unicode codepoints, allowing rendering mostly any existent language (as long as the font with the glyphs is provided). An amazing example showing this feature has also been added: `text_unicode`.
|
||||||
|
|
||||||
|
- Brand **new text management API**, with the addition of multiple functions to deal with string data, including functionality like replace, insert, join, split, append, to uppercase, to lower... Note that most of those functions are intended for text management on rendering, using pre-loaded internal buffers, avoiding new memory allocation that user should free manually.
|
||||||
|
|
||||||
|
- Multiple **new shapes and textures drawing functions** to support rings (`DrawRing()`, `DrawRingLines()`), circle sectors (`DrawCircleSector()`, `DrawCircleSectorLines()`), rounded rectangles (`DrawRectangleRounded()`, `DrawRectangleRoundedLines()`) and also n-patch textures (`DrawTextureNPatch()`), detailed examples have been added to illustrate all this new functionality.
|
||||||
|
|
||||||
|
- Experimental **cubemap support**, to automatically load multiple cubemap layouts (`LoadTextureCubemap()`). It required some internal `rlgl` redesign to allow cubemap textures.
|
||||||
|
|
||||||
|
- **Skeletal animation support for 3d models**, this addition implied a redesign of `Model` data structure to accommodate multiple mesh/multiple materials support and bones information. Multiple models functions have been reviewed and added on this process, also **glTF models loading support** has been added.
|
||||||
|
|
||||||
|
This is just a brief list with some of the changes of the new **raylib 2.5** but there is way more, about **70 new functions** have been added and several subsystems have been redesigned. More than **30 new examples** have been created to show the new functionalities and better illustrate already available ones.
|
||||||
|
|
||||||
|
It has been a long year of hard work to make raylib a solid technology to develop new products over it.
|
||||||
|
|
||||||
|
notes on raylib 3.0
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
After **10 months of intense development**, new raylib version is ready. Despite primary intended as a minor release, the [CHANGELIST](CHANGELOG) has grown so big and the library has changed so much internally that it finally became a major release. Library **internal ABI** has received a big redesign and review, targeting portability, integration with other platforms and making it a perfect option for other programming [language bindings](BINDINGS.md).
|
||||||
|
|
||||||
|
- All **global variables** from the multiple raylib modules have been moved to a **global context state**, it has several benefits, first, better code readability with more comprehensive variable naming and categorization (organized by types, i.e. `CORE.Window.display.width`, `CORE.Input.Keyboard.currentKeyState` or `RLGL.State.modelview`). Second, it allows better memory management to load global context state dynamically when required (not at the moment), making it easy to implement a **hot-reloading mechanism** if desired.
|
||||||
|
|
||||||
|
- All **memory allocations** on raylib and its dependencies now use `RL_MALLOC`, `RL_FREE` and similar macros. Now users can easily hook their own memory allocation mechanism if desired, having more control over memory allocated internally by the library. Additionally, it makes it easier to port the library to embedded devices where memory control is critical. For more info check raylib issue #1074.
|
||||||
|
|
||||||
|
- All **I/O file accesses** from raylib are being moved to **memory data access**, now all I/O file access is centralized into just four functions: `LoadFileData()`, `SaveFileData()`, `LoadFileText()`, `SaveFileText()`. Users can just update those functions to any I/O file system. This change makes it easier to integrate raylib with **Virtual File Systems** or custom I/O file implementations.
|
||||||
|
|
||||||
|
- All **raylib data structures** have been reviewed and optimized for pass-by-value usage. One of raylib distinctive design decisions is that most of its functions receive and return data by value. This design makes raylib really simple for newcomers, avoiding pointers and allowing complete access to all structures data in a simple way. The downside is that data is copied on stack every function call and that copy could be costly so, all raylib data structures have been optimized to **stay under 64 bytes** for fast copy and retrieve.
|
||||||
|
|
||||||
|
- All **raylib tracelog messages** have been reviewed and categorized for a more comprehensive output information when developing raylib applications, now all display, input, timer, platform, auxiliar libraries, file-accesses, data loading/unloading issues are properly reported with more detailed and visual messages.
|
||||||
|
|
||||||
|
- `raudio` module has been internally reviewed to accommodate the new `Music` structure (converted from previous pointer format) and the module has been adapted to the **highly improved** [`miniaudio v0.10`](https://github.com/dr-soft/miniaudio).
|
||||||
|
|
||||||
|
- `text` module reviewed to **improve fonts generation** and text management functions, `Font` structure has been redesigned to better accommodate characters data, decoupling individual characters as `Image` glyphs from the font atlas parameters. Several improvements have been made to better support Unicode strings with UTF-8 encoding.
|
||||||
|
|
||||||
|
- **Multiple new examples added** (most of them contributed by raylib users) and all examples reviewed for correct execution on most of the supported platforms, specially Web and Raspberry Pi. A detailed categorized table has been created on github for easy examples navigation and code access.
|
||||||
|
|
||||||
|
- New **GitHub Actions CI** system has been implemented for Windows, Linux and macOS code and examples compilation on every new commit or PR to make sure library keeps stable and usable with no breaking bugs.
|
||||||
|
|
||||||
|
Note that only key changes are listed here but there is way more! About **30 new functions**, multiple functions reviewed, bindings to [+40 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md) and great samples/demos/tutorials [created by the community](https://discord.gg/raylib), including raylib integration with [Spine](https://github.com/WEREMSOFT/spine-raylib-runtimes), [Unity](https://unitycoder.com/blog/2019/12/09/using-raylib-dll-in-unity/), [Tiled](https://github.com/OnACoffeeBreak/raylib_tiled_import_with_tmx), [Nuklear](http://bedroomcoders.co.uk/implementing-a-3d-gui-with-raylib/), [enet](https://github.com/nxrighthere/NetDynamics) and [more](https://github.com/raysan5/raylib/issues/1079)!
|
||||||
|
|
||||||
|
It has been **10 months of improvements** to create the best raylib ever.
|
||||||
|
|
||||||
|
Welcome to **raylib 3.0**.
|
||||||
|
|
||||||
|
notes on raylib 3.5 - 7th Anniversary Edition
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
It's December 25th... this crazy 2020 is about to finish and finally the holidays gave me some time to put a new version of raylib. It's been **9 months since last release** and last November raylib become 7 years old... I was not able to release this new version back then but here it is. Many changes and improvements have happened in those months and, even, last August, raylib was awarded with an [Epic Megagrant](https://www.unrealengine.com/en-US/blog/epic-megagrants-fall-2020-update)! Bindings list kept growing to [+50 programming languages](BINDINGS.md) and some new platforms have been supported. Let's see this new version details:
|
||||||
|
|
||||||
|
First, some general numbers of this new update:
|
||||||
|
|
||||||
|
- **+650** commits since previous RELEASE
|
||||||
|
- **+30** functions ADDED (for a TOTAL of **475**!)
|
||||||
|
- **+90** functions REVIEWED/REDESIGNED
|
||||||
|
- **+30** contributors (for a TOTAL of **170**!)
|
||||||
|
- **+8** new examples (for a TOTAL of **+120**!)
|
||||||
|
|
||||||
|
Here the list with some highlights for `raylib 3.5`.
|
||||||
|
|
||||||
|
- NEW **Platform** supported: **Raspberry Pi 4 native mode** (no X11 windows) through [DRM](https://en.wikipedia.org/wiki/Direct_Rendering_Manager) subsystem and GBM API. Actually this is a really interesting improvement because it opens the door to raylib to support other embedded platforms (Odroid, GameShell, NanoPi...). Also worth mentioning the un-official homebrew ports of raylib for [PS4](https://github.com/orbisdev/orbisdev-orbisGl2) and [PSVita](https://github.com/psp2dev/raylib4Vita).
|
||||||
|
|
||||||
|
- NEW **configuration options** exposed: For custom raylib builds, `config.h` now exposes **more than 150 flags and defines** to build raylib with only the desired features, for example, it allows to build a minimal raylib library in just some KB removing all external data filetypes supported, very useful to generate **small executables or embedded devices**.
|
||||||
|
|
||||||
|
- NEW **automatic GIF recording** feature: Actually, automatic GIF recording (**CTRL+F12**) for any raylib application has been available for some versions but this feature was really slow and low-performant using an old gif library with many file accesses. It has been replaced by a **high-performant alternative** (`msf_gif.h`) that operates directly on memory... and actually works very well! Try it out!
|
||||||
|
|
||||||
|
- NEW **RenderBatch** system: `rlgl` module has been redesigned to support custom **render batches** to allow grouping draw calls as desired, previous implementation just had one default render batch. This feature has not been exposed to raylib API yet but it can be used by advanced users dealing with `rlgl` directly. For example, multiple `RenderBatch` can be created for 2D sprites and 3D geometry independently.
|
||||||
|
|
||||||
|
- NEW **Framebuffer** system: `rlgl` module now exposes an API for custom **Framebuffer attachments** (including cubemaps!). raylib `RenderTexture` is a basic use-case, just allowing color and depth textures, but this new API allows the creation of more advanced Framebuffers with multiple attachments, like the **G-Buffers**. `GenTexture*()` functions have been redesigned to use this new API.
|
||||||
|
|
||||||
|
- Improved **software rendering**: raylib `Image*()` API is intended for software rendering, for those cases when **no GPU or no Window is available**. Those functions operate directly with **multi-format** pixel data on RAM and they have been completely redesigned to be way faster, specially for small resolutions and retro-gaming. Low-end embedded devices like **microcontrollers with custom displays** could benefit of this raylib functionality!
|
||||||
|
|
||||||
|
- File **loading from memory**: Multiple functions have been redesigned to load data from memory buffers **instead of directly accessing the files**, now all raylib file loading/saving goes through a couple of functions that load data into memory. This feature allows **custom virtual-file-systems** and it gives more control to the user to access data already loaded in memory (i.e. images, fonts, sounds...).
|
||||||
|
|
||||||
|
- NEW **Window states** management system: raylib `core` module has been redesigned to support Window **state check and setup more easily** and also **before/after Window initialization**, `SetConfigFlags()` has been reviewed and `SetWindowState()` has been added to control Window minification, maximization, hiding, focusing, topmost and more.
|
||||||
|
|
||||||
|
- NEW **GitHub Actions** CI/CD system: Previous CI implementation has been reviewed and improved a lot to support **multiple build configurations** (platforms, compilers, static/shared build) and also an **automatic deploy system** has been implemented to automatically attach the different generated artifacts to every new release. As the system seems to work very good, previous CI platforms (AppVeyor/TravisCI) have been removed.
|
||||||
|
|
||||||
|
A part of those changes, many new functions have been added, some redundant functions removed and many functions have been reviewed for consistency with the full API (function name, parameters name and order, code formatting...). Again, this release represents is a **great improvement for raylib and marks the way forward** for the library. Make sure to check [CHANGELOG](CHANGELOG) for details! Hope you enjoy it!
|
||||||
|
|
||||||
|
Happy holidays! :)
|
||||||
|
|
||||||
|
notes on raylib 3.7
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
April 2021, it's been about 4 months since the last raylib release and here is already a new one, this time with a bunch of internal redesigns and improvements. Surprisingly, on April 8th I was awarded for a second time with the [Google Open Source Peer Bonus Award](https://opensource.googleblog.com/2021/04/announcing-first-group-of-google-open-source-peer-bonus-winners.html) for my contribution to open source world with raylib and it seems the library is getting some traction, what a better moment for a new release? Let's see what can be found in this new version:
|
||||||
|
|
||||||
|
Let's start with some numbers:
|
||||||
|
|
||||||
|
- **+100** closed issues (for a TOTAL of **+900**!)
|
||||||
|
- **+400** commits since previous RELEASE
|
||||||
|
- **+50** functions ADDED (**+30** of them to rlgl API)
|
||||||
|
- **+30** functions REVIEWED/REDESIGNED
|
||||||
|
- **+40** new contributors (for a TOTAL of **+210**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 3.7`:
|
||||||
|
|
||||||
|
- **REDESIGNED: `rlgl` module for greater abstraction level**. This suppose an **important change in raylib architecture**, now `rlgl` functionality is self-contained in the module and used by higher-level layers (specially by `core` module), those upper layers are the ones that expose functionality to the main API when required, for example the `Shaders`, `Mesh` and `Materials` functionality. Multiple `rlgl` functions have been renamed for consistency, in this case, following the `rl*()` prefix convention. Functions have also been reorganized internally by categories and `GenTexture*()` functions have been removed from the library and moved to [`models_material_pbr`](https://github.com/raysan5/raylib/blob/master/examples/models/models_material_pbr.c) example.
|
||||||
|
|
||||||
|
- **REDESIGNED: VR simulator and stereo rendering mechanism**. A **brand new API** has been added, more comprehensive and better integrated with raylib, the **new stereo rendering** can be combined with `RenderTexture` and `Shader` API allowing the user to **manage fbo and distortion shader directly**. Also, the new rendering mechanism supports **instancing on stereo rendering**! Check the updated [`core_vr_simulator`](https://github.com/raysan5/raylib/blob/master/examples/core/core_vr_simulator.c) example for reference!
|
||||||
|
|
||||||
|
- **ADDED: New file access callbacks system**. Several new callback functions have been added to the API to allow custom file loaders. A [nice example](https://github.com/RobLoach/raylib-physfs) it's the **raylib integration with a virtual file system** [PhysFS](https://icculus.org/physfs/).
|
||||||
|
|
||||||
|
- **ADDED: glTF animations support**. glTF is the preferred models file format to be used with raylib and along the addition of a models animation API on latest raylib versions, now animations support for glTF format has come to raylib, thanks for this great contribution to [Hristo Stamenov](@object71)
|
||||||
|
|
||||||
|
- **ADDED: Music streaming support from memory**. raylib has been adding the `Load*FromMemory()` option to all its supported file formats but **music streaming** was not supported yet... until now. Thanks to this great contribution by [Agnis "NeZvērs" Aldiņš](@nezvers), now raylib supports music streaming from memory data for all supported file formats: WAV, OGG, MP3, FLAC, XM and MOD.
|
||||||
|
|
||||||
|
- **RENAMED: enums values for consistency**. Most raylib enums names and values names have been renamed for consistency, now all value names start with the type of data they represent. It increases clarity and readability when using those values and also **improves overall library consistency**.
|
||||||
|
|
||||||
|
Besides those key changes, many functions have been reviewed with improvements and bug fixes, many of them contributed by the community! Thanks! And again, this release sets a **new milestone for raylib library**. Make sure to check [CHANGELOG](CHANGELOG) for detailed list of changes! Hope you enjoy this new raylib installment!
|
||||||
|
|
||||||
|
Happy **gamedev/tools/graphics** programming! :)
|
||||||
|
|
||||||
|
notes on raylib 4.0 - 8th Anniversary Edition
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
It's been about 6 months since last raylib release and it's been **8 years since I started with this project**, what an adventure! It's time for a new release: `raylib 4.0`, **the biggest release ever** and an inflection point for the library. Many hours have been put in this release to make it special, **many library details have been polished**: syntax, naming conventions, code comments, functions descriptions, log outputs... Almost all the issues have been closed (only 3 remain open at the moment of this writing) and some amazing new features have been added. I expect this **`raylib 4.0`** to be a long-term version (LTS), stable and complete enough for any new graphic/game/tool application development.
|
||||||
|
|
||||||
|
Let's start with some numbers:
|
||||||
|
|
||||||
|
- **+130** closed issues (for a TOTAL of **+1030**!)
|
||||||
|
- **+550** commits since previous RELEASE
|
||||||
|
- **+20** functions ADDED to raylib API
|
||||||
|
- **+60** functions ADDED to rlgl API
|
||||||
|
- **+40** functions RENAMED/REVIEWED/REDESIGNED
|
||||||
|
- **+60** new contributors (for a TOTAL of **+275**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 4.0`:
|
||||||
|
|
||||||
|
- **Naming consistency and coherency**: `raylib` API has been completely reviewed to be consistent on naming conventions for data structures and functions, comments and descriptions have been reviewed, also the syntax of many symbols for consistency; some functions and structs have been renamed (i.e. `struct CharInfo` to `struct GlyphInfo`). Output log messages have been also improved to show more info to the users. Several articles have been written in this process: [raylib_syntax analysis](https://github.com/raysan5/raylib/wiki/raylib-syntax-analysis) and [raylib API usage analysis](https://gist.github.com/raysan5/7c0c9fff1b6c19af24bb4a51b7383f1e). In general, a big polishment of the library to make it more consistent and coherent.
|
||||||
|
|
||||||
|
- **Event Automation System**: This new _experimental_ feature has been added for future usage, it allows to **record input events and re-play them automatically**. This feature could be very useful to automatize examples testing but also for tutorials with assisted game playing, in-game cinematics, speedruns, AI playing and more! Note this feature is still experimental.
|
||||||
|
|
||||||
|
- **Custom game-loop control**: As requested by some advanced users, **the game-loop control can be exposed** compiling raylib with the config flag: `SUPPORT_CUSTOM_FRAME_CONTROL`. It's intended for advanced users that want to control the events polling and also the timing mechanisms of their games.
|
||||||
|
|
||||||
|
- [**`rlgl 4.0`**](https://github.com/raysan5/raylib/blob/master/src/rlgl.h): This module has been completely **decoupled from platform layer** and raylib, now `rlgl` single-file header-only library only depends on the multiple OpenGL backends supported, even the dependency on `raymath` has been removed. Additionally, **support for OpenGL 4.3** has been added, supporting compute shaders and Shader Storage Buffer Objects (SSBO). Now `rlgl` can be used as a complete standalone portable library to wrap several OpenGL version and providing **a simple and easy-to-use pseudo-OpenGL immediate-mode API**.
|
||||||
|
|
||||||
|
- [**`raymath 1.5`**](https://github.com/raysan5/raylib/blob/master/src/raymath.h): This module has been reviewed and some new conventions have been adopted to make it **more portable and self-contained**:
|
||||||
|
- Functions are self-contained, no function use other raymath function inside, required code is directly re-implemented
|
||||||
|
- Functions input parameters are always received by value
|
||||||
|
- Functions use always a "result" variable for return
|
||||||
|
- Angles are always in radians (`DEG2RAD`/`RAD2DEG` macros provided for convenience)
|
||||||
|
|
||||||
|
- [**`raygui 3.0`**](https://github.com/raysan5/raygui): The **official raylib immediate-mode gui library** (included in `raylib/src/extras`) has been updated to a new version, embedding the icons collection and adding mulstiple improvements. It has been simplified and constrained for a better focus on its task: provide a simple and easy-to-use immediate-mode-gui library for small tools development.
|
||||||
|
|
||||||
|
- [**`raylib_parser`**](https://github.com/raysan5/raylib/tree/master/parser): Added **new tool to parse `raylib.h`** and tokenize its enums, structs and functions, extracting all required info (name, params, descriptions...) into custom output formats (TXT, XML, JSON...) for further processing. This tool is specially useful to **automatize bindings generation**. Hopefully, this tool will make life easier to binding creators to update their bindings for raylib 4.0 or adding new ones!
|
||||||
|
|
||||||
|
- **Zig and Odin official support for raylib**: Those two new amazing programming languages are officially supporting raylib, `Zig` lists raylib as an [official example for C interoperatibility](https://ziglang.org/learn/samples/#c-interoperability) and Odin [officially supports raylib as a vendor library](https://github.com/odin-lang/Odin/tree/master/vendor/raylib). Both languages also have several bingings to raylib. Additionally, Zig build system supported has been added to compile raylib library and examples.
|
||||||
|
|
||||||
|
Those are some of the key features for this new release but actually there is way more! **Support for `VOX` ([MagikaVoxel](https://ephtracy.github.io/)) 3d model format** has been added, **new [raylib_game_template](https://github.com/raysan5/raylib-game-template)** repo shared, **new `EncodeDataBase64()` and `DecodeDataBase64()` functions** added, **improved HiDPI support**, new `DrawTextPro()` with support for text rotations, completely **reviewed `glTF` models loading**, added **`SeekMusicStream()` for music seeking**, many new examples and +20 examples reviewed... **hundreds of improvements and bug fixes**! Make sure to check [CHANGELOG](CHANGELOG) for a detailed list of changes!
|
||||||
|
|
||||||
|
Undoubtedly, **this is the best raylib ever**. Enjoy gamedev/tools/graphics programming! :)
|
||||||
|
|
||||||
|
notes on raylib 4.2
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
**New raylib release!** Nine months after latest raylib, here is a new version. It was supposed to be just a small update but, actually, it's a huge update with lots of changes a improvements. It has been possible thanks to the many contributors that has helped with issues and improvements, it's the **update with more contributors to date** and that's amazing!
|
||||||
|
|
||||||
|
Some numbers to start with:
|
||||||
|
|
||||||
|
- **+200** closed issues (for a TOTAL of **1230**!)
|
||||||
|
- **+540** commits since previous RELEASE (for a TOTAL of **+6000**!)
|
||||||
|
- **+20** functions ADDED to raylib API (for a TOTAL of **502**!)
|
||||||
|
- **+60** functions REVIEWED/REDESIGNED
|
||||||
|
- **+70** new contributors (for a TOTAL of **+360**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 4.2`:
|
||||||
|
|
||||||
|
- **raylib extra libraries cleanup**: raylib has been on diet and all the _extra_ libraries included on previous releases have been removed from raylib. Now raylib only includes the original **7** raylib modules: `rcore`, `rlgl`, `rshapes`, `rtextures`, `rtext`, `rmodels` and `raudio`. But no worries, _extra_ libraries have not been deleted, they have been moved to their own repos for better maintainability and more focus on its functionality. The libraries moved out from raylib repo are: [`raygui`](https://github.com/raysan5/raygui), [`physac`](https://github.com/raysan5/physac), [`rmem`](https://github.com/raylib-extras/rmem), [`reasings`](https://github.com/raylib-extras/reasings) and [`raudio`](https://github.com/raysan5/raudio) (standalone mode). On that same line, a new **amazing GitHub group:** [`raylib-extras`](https://github.com/raylib-extras) has been created by @JeffM2501 to contain raylib extra libraries as well as other raylib add-ons provided by the community. Jeff has done an amazing work on that line, providing multiple libraries and examples for raylib, like [custom first-person and third person camera systems](https://github.com/raylib-extras/extras-c/tree/main/cameras), [Dear ImGui raylib integration](https://github.com/raylib-extras/rlImGui), [multiple specific examples](https://github.com/raylib-extras/examples-c) and even a complete [RPG Game Example](https://github.com/raylib-extras/RPGExample)! Great work Jeff! :D
|
||||||
|
|
||||||
|
- **raylib examples review**: The +120 raylib examples have been reviewed to add clearer information about when the were first created (raylib version used) and when they were updated for the last time. But the greatest improvement for users has been the **addition of an estimated difficulty level** for every example, [web has been updated accordingly](https://www.raylib.com/examples.html) to reflect those difficulty levels. Now examples are classified with **1 to 4 stars** depending on difficulty to help users with their learning process. Personally, I think this "small" addition could be a game-changer to better guide new users on the library adoption! Additionally, this new raylib release includes 7 new examples; the most interesting one: [`text_codepoints_loading`](https://www.raylib.com/examples/text/loader.html?name=text_codepoints_loading) that illustrates how to load and draw custom codepoints from a font file, very useful for Asian languages.
|
||||||
|
|
||||||
|
- [**`rres 1.0`**](https://github.com/raysan5/rres): New `rres` **resources packaging file-format**, including a [`rres-raylib`](https://github.com/raysan5/rres/blob/master/src/rres-raylib.h) library implementation and [`rrespacker`](https://raylibtech.itch.io/rrespacker) tool. `rres` file format has been [under development for +8 years](https://github.com/raysan5/rres#design-history) and it was originally created to be part of raylib. It was highly inspired by _XNA XNB_ resources file format but design has changed a lot along the years. This first release of the format specs is engine-agnostic and has been designed to be portable to any engine, including lots of professional features like data processing, compression and encryption.
|
||||||
|
|
||||||
|
- [**`raygui 3.2`**](https://github.com/raysan5/raygui): The **official raylib immediate-mode gui library** designed for tools development has been updated to a new version aligned with raylib 4.2. Multiple controls have been reviewed for library consistency, now all controls follow a similar function signature. It has been battle-tested with the development of +8 published tools in the last months. The tools can be seen and used for free in the [raylib technologies tools page](https://raylibtech.itch.io/). Worth mentioning that several of those **tools have been open sourced** for anyone to use, compile, contribute or learn how the code works.
|
||||||
|
|
||||||
|
- [**`raylib_parser`**](https://github.com/raysan5/raylib/tree/master/parser): Multiple contributors **using the tool to automatize bindings creation** have contributed with improvements of this **tool to parse `raylib.h`** (and other raylib-style headers) to tokenize its enums, structs and functions. Processed data can be exported to custom file formats (i.e XML, JSON, LUA) for bindings generation or even docs generation if required.
|
||||||
|
|
||||||
|
- **New file system API**: Current API has been redesigned to be more comprehensive and better aligned with raylib naming conventions, two new functions are provided `LoadDirectoryFiles()`/`LoadDirectoryFilesEx()` to load a `FilePathList` for provided path, supporting extension filtering and recursive directory scan. `LoadDroppedFiles()` has been renamed to better reflect its internal functionality. Now, all raylib functions that start with `Load*()` allocate memory internally and a equivalent `Unload*()` function is defined to take care of that memory internally when not required any more!
|
||||||
|
|
||||||
|
- **New audio stream processors API** (_experimental_): Now real-time audio stream data processors can be added using callbacks to played Music. It allows users to create custom effects for audio like delays of low-pass-filtering (example provided). The new API uses a callback system and it's still _ highly experimental_, it differs from the usual level of complexity that provides raylib and it is intended for advanced users. It could change in the future but, actually, `raudio` module is in the spotlight for future updates; [miniaudio](https://github.com/mackron/miniaudio) implements a new higher-level API that can be useful in the future for raylib.
|
||||||
|
|
||||||
|
As always, there are more improvements than the key features listed, make sure to check raylib [CHANGELOG](CHANGELOG) for the detailed list of changes; for this release a `WARNING` flag has been added to all the changes that could affect bindings or productivity code. **raylib keeps improving one more version** and a special focus on maintainability has been put on the library for the future. Specific/advance functionality will be provided through **raylib-extras** repos and raylib main repo devlelopment will be focused on what made raylib popular: being a simple and easy-to-use library to **enjoy videogames programming**.
|
||||||
|
|
||||||
|
**Enjoy gamedev/tools/graphics programming!** :)
|
||||||
|
|
||||||
|
notes on raylib 4.5
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
It's been **7 months** since latest raylib release. As usual, **many parts of the library have been reviewed and improved** along those months. Many issues have been closed, staying under 10 open issues at the moment of this writting and also many PRs from contributors have been received, reviewed and merged into raylib library. Some new functions have been added and some others have been removed to improve library coherence and avoid moving too high level, giving the users the tools to implement advance functionality themselfs over raylib. Again, this is a big release with a considerable amount of changes and improvements. Here is a small summary highlighting this new **rayib 4.5**.
|
||||||
|
|
||||||
|
Some numbers for this release:
|
||||||
|
|
||||||
|
- **+100** closed issues (for a TOTAL of **+1340**!)
|
||||||
|
- **+350** commits since previous RELEASE (for a TOTAL of **+6350**!)
|
||||||
|
- **+25** functions ADDED to raylib API (for a TOTAL of **516**!)
|
||||||
|
- **+40** functions REVIEWED/REDESIGNED
|
||||||
|
- **+40** new contributors (for a TOTAL of **405**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 4.5`:
|
||||||
|
|
||||||
|
- **`NEW` Improved ANGLE support on Desktop platforms**: Support for OpenGL ES 2.0 on Desktop platforms (Windows, Linux, macOS) has been reviewed by @wtnbgo GitHub user. Now raylib can be compiled on desktop for OpenGL ES 2.0 and linked against [`ANGLE`](https://github.com/google/angle). This _small_ addition open the door to building raylib for all **ANGLE supported backends: Direct3D 11, Vulkan and Metal**. Please note that this new feature is still experimental and requires further testing!
|
||||||
|
|
||||||
|
- **`NEW` Camera module**: A brand new implementation from scratch for `rcamera` module, contributed by @Crydsch GitHub user! **New camera system is simpler, more flexible, more granular and more extendable**. Specific camera math transformations (movement/rotation) have been moved to individual functions, exposing them to users if required. Global state has been removed from the module and standalone usage has been greatly improved; now `rcamera.h` single-file header-only library can be used externally, independently of raylib. A new `UpdateCameraPro()` function has been added to address input-dependency of `UpdateCamera()`, now advanced users have **full control over camera inputs and movement/rotation speeds**!
|
||||||
|
|
||||||
|
- **`NEW` Support for M3D models and M3D/GLTF animations**: 3d models animations support has been a limited aspect of raylib for long time, some versions ago IQM animations were supported but raylib 4.5 also adds support for the brand new [M3D file format](https://bztsrc.gitlab.io/model3d/), including animations and the long expected support for **GLTF animations**! The new M3D file format is **simple, portable, feature complete, extensible and open source**. It also provides a complete set of tools to export/visualize M3D models from/to Blender! Now raylib supports up to **3 model file-formats with animations**: `IQM`, `GLTF` and `M3D`.
|
||||||
|
|
||||||
|
- **`NEW` Support QOA audio format (import/export)**: Just a couple of months ago the new [QOA file format](https://qoaformat.org/) was published, a very simple, portable and open source quite-ok-audio file format. raylib already supports it, added to `raudio` module and including audio loading from file, loading from memory, streaming from file, streaming from memory and **exporting to QOA** audio format. **Because simplicity really matters to raylib!**
|
||||||
|
|
||||||
|
- **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rltexgpu.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
|
||||||
|
|
||||||
|
- **Reviewed `rlgl` module for automatic limits checking**: Again, [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been reviewed to simplify usage. Now users do not need to worry about reaching the internal render-batch limits when they send their triangles to draw 2d/3d, `rlgl` manages it automatically! This change allows a **great simplification for other modules** like `rshapes`, `rtextures` and `rmodels` that do not need to worry about bufffer overflows and can just define as many vertex as desired!
|
||||||
|
|
||||||
|
- **Reviewed `rshapes` module to minimize the rlgl dependency**: Now `rshapes` 2d shapes drawing functions **only depend on 6 low-level functions**: `rlBegin()`, `rlEnd()`, `rlVertex3f()`, `rlTexCoord2f()`, `rlNormal3f()`, `rlSetTexture()`. With only those pseudo-OpenGl 1.1 minimal functionality, everything can be drawn! This improvement converts `rshapes` module in a **self-contained, portable shapes-drawing library that can be used independently of raylib**, as far as entry points for those 6 functions are provided by the user. It even allows to be used for software rendering, with the proper backend!
|
||||||
|
|
||||||
|
- **Added data structures validation functions**: Multiple functions have been added by @RobLoach GitHub user to ease the validation of raylib data structures: `IsImageReady()`, `IsTextureReady()`, `IsSoundReady()`... Now users have a simple mechanism to **make sure data has been correctly loaded**, instead of checking internal structure values by themselves.
|
||||||
|
|
||||||
|
As usual, those are only some highlights but there is much more! New image generators, new color transformation functionality, improved blending support for color/alpha, etc... Make sure to check raylib [CHANGELOG]([CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG)) for a detailed list of changes! Please, note that all breaking changes have been flagged with a `WARNING` in the CHANGELOG, specially useful for binding creators!
|
||||||
|
|
||||||
|
**raylib keeps improving one more version** with a special focus on maintainability and sustainability. Always working towards making the library more **simple and easy-to-use**.
|
||||||
|
|
||||||
|
Let's keep **enjoying games/tools/graphics programming!** :)
|
||||||
|
|
||||||
|
notes on raylib 5.0
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
It's been **7 months** since latest raylib release and **10 years** since raylib 1.0 was officially released... what an adventure! In the last 10 years raylib has improved a lot, new functions have been added, many new features and improvements implemented, up to **500 contributors** have helped to shape the library as it is today. `raylib 5.0` is the final result of all this incredible amount of work and dedication. Here is the summary with the key features and additions of this NEW major version of raylib.
|
||||||
|
|
||||||
|
Some numbers for this release:
|
||||||
|
|
||||||
|
- **+200** closed issues (for a TOTAL of **+1540**!)
|
||||||
|
- **+550** commits since previous RELEASE (for a TOTAL of **+6950**!)
|
||||||
|
- **+35** functions ADDED to raylib API (for a TOTAL of **552**!)
|
||||||
|
- **+60** functions REVIEWED/REDESIGNED
|
||||||
|
- **+80** new contributors (for a TOTAL of **+500**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 5.0`:
|
||||||
|
|
||||||
|
- **`rcore` module platform-split**: Probably the biggest raylib redesign in the last 10 years. raylib started as a library targeting 3 desktop platforms: `Windows`, `Linux` and `macOS` (thanks to `GLFW` underlying library) but with the years support for several new platforms has been added (`Android`, `Web`, `Rapsberry Pi`, `RPI native`...); lot of the platform code was shared so the logic was all together on `rcore.c` module, separated by compilation flags. This approach was very handy but also made it very difficult to support new platforms and specially painful for contributors not familiar with the module, navigating +8000 lines of code in a single file. A big redesign was really needed but the amount of work required was humungous and quite scary for a solo-developer like me, moreover considering that everything was working and the chances to break things were really high. Fortunately, some contributors were ready for the task (@ubkp, @michaelfiber, @Bigfoot71) and thanks to their initiative and super-hard work, the `rcore` [platform split](https://github.com/raysan5/raylib/blob/master/src/platforms) has been possible! This new raylib architecture greatly improves the platforms maintenance but also greatly simplifies the addition of new platforms. A [`platforms/rcore_template.c`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_template.c) file is provided with the required structure and functions to be filled for the addition of new platforms, actually it has been simplified to mostly filling some pre-defined functions: `InitPlatform()`, `ClosePlatform`, `PollInputEvents`... Undoubtedly, **this redesign opens the doors to a new era for raylib**, letting the users to plug new platforms as desired.
|
||||||
|
|
||||||
|
- **`NEW` Platform backend supported: SDL**: Thanks to the new `rcore` platform-split, the addition of new platforms/backends to raylib has been greatly simplified. As a proof of concept, [`SDL2`](https://libsdl.org/) platform backend has been added to raylib as an alternative for `GLFW` library for desktop builds: [`platforms/rcore_desktop_sdl`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_sdl.c). Lot of work has been put to provide exactly the same features as the other platforms and carefully test the new implementation. Now `SDL2` fans can use this new backend, just providing the required include libraries on compilation and linkage (not included in raylib, like `GLFW`). `SDL` backend support also **eases the process of supporting a wider range of platforms** that already support `SDL`.
|
||||||
|
|
||||||
|
- **`NEW` Platform backend supported: Nintendo Switch (closed source)**: The addition of the `SDL` backend was quite a challenge but to really verify the robustness and ease of the new platform plugin system, adding support for a console was a more demanding adventure. Surprisingly, only two days of work were required to add support for `Nintendo Switch` to raylib! Implementation result showed an outstanding level of simplicity, with a **self-contained module** (`rcore_swith.cpp`) supporting graphics and inputs. Unfortunately this module can not be open-sourced due to licensing restrictions.
|
||||||
|
|
||||||
|
- **`NEW` Splines drawing and evaluation API**: A complete set of functions has been added to [draw](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1258) and [evaluate](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1270) different types of splines: `Linear`, `Basis`, `Catmull-Rom`, `Quadratic Bezier` and `Cubic Bezier`. Splines are extremely useful for game development (describe paths, control NPC movement...) but they can also be very useful on tools development (node-conections, elements-movement, 3d modelling, animations...). This was the missing feature on the raylib [`rshapes`](https://github.com/raysan5/raylib/blob/master/src/rshapes.h) module to make it complete! Note that `rshapes` module can also be used independently of raylib just providing the **only 6 functions required for vertex definition and drawing**.
|
||||||
|
|
||||||
|
- **`NEW` Pseudo-random numbers generator: rprand**: After several years of users asking for this missing piece, a brand new pseudo-random generator module has been added to raylib. [`rprand`](https://github.com/raysan5/raylib/blob/master/src/external/rprand.h) implements the `Xoshiro128**` algorithm combined with `SplitMix64`, specially suited for **fast software pseudo-random numbers generation**. The module also implies some useful functions to generate non-repetitive random numbers sequences, functionality exposed by raylib. usage of this module can be controlled by a compilation flag, in case the default libc `rand()` function was preferred.
|
||||||
|
|
||||||
|
- **`NEW` Automation Events System API**: This new system was first added in `raylib 4.0` as an experimental feature but it was a bit clumsy and there was no API exposed to users. For the new `raylib 5.0` the system has been redesigned and [proper API](https://github.com/raysan5/raylib/blob/master/src/raylib.h#L1135) added for the users. With this new events automation system, users can **record input events for later replay**, very useful feature for testing automation, tutorials generation, assisted game playing, in-game cinematics, speedruns saving or even AI assited game playing!
|
||||||
|
|
||||||
|
- **`NEW` [`raygui 4.0`](https://github.com/raysan5/raygui)**: The **official raylib immediate-mode gui library** designed for tools development has been updated to a new version, aligned with raylib 5.0. This new version is a complete redesign of raygui to unify all controls structure and usage, now all controls have the same function signature!. `raygui` has been battle-tested with the development of +12 published tools in the last few years. The tools can be seen and used for free in the [raylib technologies tools page](https://raylibtech.itch.io/). Worth mentioning that several of those **tools have been open sourced** for anyone to use, compile, contribute or learn how the code works.
|
||||||
|
|
||||||
|
- **`NEW` raylib web examples functionality**: Beside the addition of several new examples, the web examples functionality has been improved. Examples have been organized by [complexity level](https://www.raylib.com/examples.html), marked with one star for simple examples and up to 4 stars for more complex ones. A new option has been added to web to allow to **filter examples by function-name** usage, to ease the learning process when looking for an usage example of some function. Finally, **open-graph metadata** information has been added to all examples individual webpages, improving a the visuals and information when sharing those webpages on social networks, sharing the example screenshot and details.
|
||||||
|
|
||||||
|
As always, those are only some highlights of the new `raylib 5.0` but there is many more improvements! Support for 16-bit HDR images/textures, SVG loading and scaling support, new OpenGL ES 3.0 graphic backend, new image gradient generators, sound alias loading, improved 3d models loading, multiple optimizations, new bindings, CodeQL integration and much more!
|
||||||
|
|
||||||
|
Make sure to check raylib [CHANGELOG]([CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG)) for a detailed list of changes!
|
||||||
|
|
||||||
|
Undoubtedly, this is the **biggest raylib update in 10 years**. Many new features and improvements with a special focus on maintainability and long-term sustainability. **Undoubtedly, this is the raylib of the future**.
|
||||||
|
|
||||||
|
**Enjoy programming!** :)
|
||||||
|
|
||||||
|
notes on raylib 5.5
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
One year after raylib 5.0 release, arrives `raylib 5.5`, the next big revision of the library. It's been **11 years** since raylib 1.0 release and in all this time it has never stopped growing and improving. With an outstanding number of new contributors and improvements, it's, again, the biggest raylib release to date.
|
||||||
|
|
||||||
|
Some numbers for this release:
|
||||||
|
|
||||||
|
- **+270** closed issues (for a TOTAL of **+1810**!)
|
||||||
|
- **+800** commits since previous RELEASE (for a TOTAL of **+7770**!)
|
||||||
|
- **+30** functions ADDED to raylib API (for a TOTAL of **580**!)
|
||||||
|
- **+110** functions REVIEWED with fixes and improvements
|
||||||
|
- **+140** new contributors (for a TOTAL of **+640**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 5.5`:
|
||||||
|
|
||||||
|
- **`NEW` raylib pre-configured Windows package**: The new raylib **portable and self-contained Windows package** for `raylib 5.5`, intended for nobel devs that start in programming world, comes with one big addition: support for **C code building for Web platform with one-single-mouse-click!** For the last 10 years, the pre-configured raylib Windows package allowed to edit simple C projects on Notepad++ and easely compile Windows executables with an automatic script; this new release adds the possibility to compile the same C projects for Web platform with a simple mouse click. This new addition **greatly simplifies C to WebAssembly project building for new users**. The `raylib Windows Installer` package can be downloaded for free from [raylib on itch.io](https://raysan5.itch.io/raylib).
|
||||||
|
|
||||||
|
- **`NEW` raylib project creator tool**: A brand new tool developed to help raylib users to **setup new projects in a professional way**. `raylib project creator` generates a complete project structure with **multiple build systems ready-to-use** and **GitHub CI/CD actions pre-configured**. It only requires providing some C files and basic project parameters! The tools is [free and open-source](https://raysan5.itch.io/raylib-project-creator), and [it can be used online](https://raysan5.itch.io/raylib-project-creator)!.
|
||||||
|
|
||||||
|
- **`NEW` Platform backend supported: RGFW**: Thanks to the `rcore` platform-split implemented in `raylib 5.0`, **adding new platforms backends has been greatly simplified**, new backends can be added using provided template, self-contained in a single C module, completely portable. A new platform backend has been added: [`RGFW`](https://github.com/raysan5/raylib/blob/master/src/platforms/rcore_desktop_rgfw.c). `RGFW` is a **new single-file header-only portable library** ([`RGFW.h`](https://github.com/ColleagueRiley/RGFW)) intended for platform-functionality management (windowing and inputs); in this case for **desktop platforms** (Windows, Linux, macOS) but also for **Web platform**. It adds a new alternative to the already existing `GLFW` and `SDL` platform backends.
|
||||||
|
|
||||||
|
- **`NEW` Platform backend version supported: SDL3**: Previous `raylib 5.0` added support for `SDL2` library, and `raylib 5.5` not only improves SDL2 functionality, with several issues reviewed, but also adds support for the recently released big SDL update in years: [`SDL3`](https://wiki.libsdl.org/SDL3/FrontPage). Now users can **select at compile time the desired SDL version to use**, increasing the number of potential platforms supported in the future!
|
||||||
|
|
||||||
|
- **`NEW` Retro-console platforms supported: Dreamcast, N64, PSP, PSVita, PS4**: Thanks to the platform-split on `raylib 5.0`, **supporting new platform backends is easier than ever!** Along the raylib `rlgl` module support for the `OpenGL 1.1` graphics API, it opened the door to [**multiple homebrew retro-consoles backend implementations!**](https://github.com/raylib4Consoles) It's amazing to see raylib running on +20 year old consoles like [Dreamcast](https://github.com/raylib4Consoles/raylib4Dreamcast), [PSP](https://github.com/raylib4Consoles/raylib4Psp) or [PSVita](https://github.com/psp2dev/raylib4Vita), considering the hardware constraints of those platforms and proves **raylib outstanding versability!** Those additional platforms can be found in separate repositories and have been created by the amazing programmer Antonio Jose Ramos Marquez (@psxdev).
|
||||||
|
|
||||||
|
- **`NEW` GPU Skinning support**: After lots of requests for this feature, it has been finally added to raylib thanks to the contributor Daniel Holden (@orangeduck), probably the developer that has further pushed models animations with raylib, developing two amazing tools to visualize and test animations: [GenoView](https://github.com/orangeduck/GenoView) and [BVHView](https://github.com/orangeduck/BVHView). Adding GPU skinning was a tricky feature, considering it had to be **available for all raylib supported platforms**, including limited ones like Raspberry Pi with OpenGL ES 2.0, where some advance OpenGL features are not available (UBO, SSBO, Transform Feedback) but a multi-platform solution was found to make it possible. A new example, [`models_gpu_skinning`](https://github.com/raysan5/raylib/blob/master/examples/models/models_gpu_skinning.c) has been added to illustrate this new functionality. As an extra, previous existing CPU animation system has been greatly improved, multiplying performance by a factor (simplifiying required maths).
|
||||||
|
|
||||||
|
- **`NEW` [`raymath`](https://github.com/raysan5/raylib/blob/master/src/raymath.h) C++ operators**: After several requested for this feature, C++ math operators for `Vector2`, `Vector3`, `Vector4`, `Quaternion` and `Matrix` has been added to `raymath` as an extension to current implementation. Despite being only available for C++ because C does not support it, these operators **simplify C++ code when doing math operations**.
|
||||||
|
|
||||||
|
Beside those new big features, `raylib 5.5` comes with MANY other improvements:
|
||||||
|
|
||||||
|
- Normals support on batching system
|
||||||
|
- Clipboard images reading support
|
||||||
|
- CRC32/MD5/SHA1 hash computation
|
||||||
|
- Gamepad vibration support
|
||||||
|
- Improved font loading (no GPU required) with BDF fonts support
|
||||||
|
- Time-based camera movement
|
||||||
|
- Improved GLTF animations loading
|
||||||
|
|
||||||
|
...and [much much more](https://github.com/raysan5/raylib/blob/master/CHANGELOG), including **many functions reviews and new functions added!**
|
||||||
|
|
||||||
|
Make sure to check raylib [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) for a detailed list of changes!
|
||||||
|
|
||||||
|
To end with, I want to **thank all the contributors (+640!**) that along the years have **greatly improved raylib** and pushed it further and better day after day. Thanks to all of them, raylib is the amazing library it is today.
|
||||||
|
|
||||||
|
Last but not least, I want to thank **raylib sponsors and all the raylib community** for their support and continuous engagement with the library, creating and sharing amazing raylib projects on a daily basis. **Thanks for making raylib a great platform to enjoy games/tools/graphic programming!**
|
||||||
|
|
||||||
|
**After 11 years of development, `raylib 5.5` is the best raylib ever.**
|
||||||
|
|
||||||
|
**Enjoy programming with raylib!** :)
|
||||||
|
|
||||||
|
notes on raylib 6.0
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
A new raylib release is finally ready, after almost 1.5 years since last release. This is the biggest release ever with many improvements to the library, thanks to the support of many amazing contributors and also thanks to the financial support of NLnet/NGI0 funds.
|
||||||
|
|
||||||
|
Some astonishing numbers for this release:
|
||||||
|
|
||||||
|
- **+320** closed issues (for a TOTAL of **+2130**!)
|
||||||
|
- **+1800** commits since previous RELEASE (for a TOTAL of **+9600**!)
|
||||||
|
- **18** functions ADDED to raylib API (for a TOTAL of **599**!)
|
||||||
|
- **+50** new examples to learn from (for a TOTAL of **212**!)
|
||||||
|
- **+200** new contributors (for a TOTAL of **+840**!)
|
||||||
|
|
||||||
|
Highlights for `raylib 6.0`:
|
||||||
|
|
||||||
|
- New Software Renderer backend [rlsw]
|
||||||
|
- New rcore platform backend: Memory (memory buffer)
|
||||||
|
- New rcore platform backend: Win32 (experimental)
|
||||||
|
- New rcore platform backend: Emscripten (experimental)
|
||||||
|
- Redesigned Skeletal Animation System
|
||||||
|
- Redesigned fullscreen modes and high-dpi content scaling
|
||||||
|
- Redesigned Build Config System [config.h]
|
||||||
|
- New File System API
|
||||||
|
- New Text Management API
|
||||||
|
- New tool: [rexm] raylib examples manager
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
|
will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose, including commercial
|
||||||
|
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not claim that you
|
||||||
|
wrote the original software. If you use this software in a product, an acknowledgment
|
||||||
|
in the product documentation would be appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||||
|
as being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
<img align="left" style="width:260px" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
|
||||||
|
|
||||||
|
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
|
||||||
|
|
||||||
|
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
||||||
|
|
||||||
|
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
|
||||||
|
|
||||||
|
Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
[](https://github.com/raysan5/raylib/releases)
|
||||||
|
[](https://github.com/raysan5/raylib/stargazers)
|
||||||
|
[](https://github.com/raysan5/raylib/commits/master)
|
||||||
|
[](https://github.com/sponsors/raysan5)
|
||||||
|
[](https://repology.org/project/raylib/versions)
|
||||||
|
[](LICENSE)
|
||||||
|
|
||||||
|
[](https://discord.gg/raylib)
|
||||||
|
[](https://www.reddit.com/r/raylib/)
|
||||||
|
[](https://www.youtube.com/c/raylib)
|
||||||
|
[](https://www.twitch.tv/raysan5)
|
||||||
|
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_windows.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_linux.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_macos.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_webassembly.yml)
|
||||||
|
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_cmake.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_examples_windows.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_examples_linux.yml)
|
||||||
|
|
||||||
|
features
|
||||||
|
--------
|
||||||
|
- **NO external dependencies**, all required libraries are [included into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||||
|
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
|
||||||
|
- Written in plain C code (C99) using PascalCase/camelCase notation
|
||||||
|
- Hardware accelerated with OpenGL: **1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0**
|
||||||
|
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||||
|
- Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts)
|
||||||
|
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||||
|
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||||
|
- Flexible Materials system, supporting classic maps and **PBR maps**
|
||||||
|
- **Animated 3D models** supported (skeletal bones animation) (IQM, M3D, glTF)
|
||||||
|
- Shaders support, including model shaders and **postprocessing** shaders
|
||||||
|
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
|
||||||
|
- Audio loading and playing with streaming support (WAV, QOA, OGG, MP3, FLAC, XM, MOD)
|
||||||
|
- **VR stereo rendering** support with configurable HMD device parameters
|
||||||
|
- Huge examples collection with [+140 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
|
||||||
|
- Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
||||||
|
- **Free and open source**
|
||||||
|
|
||||||
|
basic example
|
||||||
|
--------------
|
||||||
|
This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
|
||||||
|
```c
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
InitWindow(800, 450, "raylib [core] example - basic window");
|
||||||
|
|
||||||
|
while (!WindowShouldClose())
|
||||||
|
{
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseWindow();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
build and installation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||||
|
|
||||||
|
raylib is also available via multiple package managers on multiple OS distributions.
|
||||||
|
|
||||||
|
#### Installing and building raylib on multiple platforms
|
||||||
|
|
||||||
|
[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms.
|
||||||
|
|
||||||
|
- [Working on Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows)
|
||||||
|
- [Working on macOS](https://github.com/raysan5/raylib/wiki/Working-on-macOS)
|
||||||
|
- [Working on GNU Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux)
|
||||||
|
- [Working on Chrome OS](https://github.com/raysan5/raylib/wiki/Working-on-Chrome-OS)
|
||||||
|
- [Working on FreeBSD](https://github.com/raysan5/raylib/wiki/Working-on-FreeBSD)
|
||||||
|
- [Working on Raspberry Pi](https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi)
|
||||||
|
- [Working for Android](https://github.com/raysan5/raylib/wiki/Working-for-Android)
|
||||||
|
- [Working for Web (HTML5)](https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5))
|
||||||
|
- [Working anywhere with CMake](https://github.com/raysan5/raylib/wiki/Working-with-CMake)
|
||||||
|
|
||||||
|
*Note that the Wiki is open for edit, if you find some issues while building raylib for your target platform, feel free to edit the Wiki or open an issue related to it.*
|
||||||
|
|
||||||
|
#### Setup raylib with multiple IDEs
|
||||||
|
|
||||||
|
raylib has been developed on Windows platform using [Notepad++](https://notepad-plus-plus.org/) and [MinGW GCC](https://www.mingw-w64.org/) compiler but it can be used with other IDEs on multiple platforms.
|
||||||
|
|
||||||
|
[Projects directory](https://github.com/raysan5/raylib/tree/master/projects) contains several ready-to-use **project templates** to build raylib and code examples with multiple IDEs.
|
||||||
|
|
||||||
|
*Note that there are lots of IDEs supported, some of the provided templates could require some review, so please, if you find some issue with a template or you think they could be improved, feel free to send a PR or open a related issue.*
|
||||||
|
|
||||||
|
learning and docs
|
||||||
|
------------------
|
||||||
|
|
||||||
|
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
|
||||||
|
|
||||||
|
Some additional documentation about raylib design can be found in [raylib GitHub Wiki](https://github.com/raysan5/raylib/wiki). Here are the relevant links:
|
||||||
|
|
||||||
|
- [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html)
|
||||||
|
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
|
||||||
|
- [raylib library design](https://github.com/raysan5/raylib/wiki)
|
||||||
|
- [raylib examples collection](https://github.com/raysan5/raylib/tree/master/examples)
|
||||||
|
- [raylib games collection](https://github.com/raysan5/raylib-games)
|
||||||
|
|
||||||
|
|
||||||
|
contact and networks
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our [Discord server](https://discord.gg/raylib)! :)
|
||||||
|
|
||||||
|
- Webpage: [https://www.raylib.com](https://www.raylib.com)
|
||||||
|
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
|
||||||
|
- X: [https://x.com/raysan5](https://x.com/raysan5)
|
||||||
|
- BlueSky: [https://bsky.app/profile/raysan5](https://bsky.app/profile/raysan5.bsky.social)
|
||||||
|
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
|
||||||
|
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
|
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||||
|
- YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib)
|
||||||
|
|
||||||
|
contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
<a href="https://github.com/raysan5/raylib/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=raysan5/raylib&max=800&columns=24&anon=0" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
license
|
||||||
|
-------
|
||||||
|
|
||||||
|
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
|
||||||
|
|
||||||
|
raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for details.
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
# raylib roadmap
|
||||||
|
|
||||||
|
Here is a wishlist with features and ideas to improve the library. Note that features listed here are usually long term improvements or just describe a route to follow for the library. There are also some additional places to look for raylib improvements and ideas:
|
||||||
|
|
||||||
|
- [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix.
|
||||||
|
- [GitHub PRs](https://github.com/raysan5/raylib/pulls) open with improvements to be reviewed.
|
||||||
|
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
|
||||||
|
- raylib wishlists discussions are open to everyone to ask for improvements, feel free to check and comment:
|
||||||
|
- [raylib 6.0 wishlist](https://github.com/raysan5/raylib/discussions/4660)
|
||||||
|
- [raylib 5.0 wishlist](https://github.com/raysan5/raylib/discussions/2952)
|
||||||
|
- [raylib wishlist 2022](https://github.com/raysan5/raylib/discussions/2272)
|
||||||
|
- [raylib wishlist 2021](https://github.com/raysan5/raylib/discussions/1502)
|
||||||
|
|
||||||
|
_Current version of raylib is complete and functional but there is always room for improvements._
|
||||||
|
|
||||||
|
**raylib 7.0**
|
||||||
|
- [ ] `rcore_desktop_win32`: Improve new Windows platform backend - inputs, highdpi
|
||||||
|
- [ ] `rcore_desktop_emscripten`: Improve new Web platform backend - inputs, highdpi
|
||||||
|
- [ ] `rcore_desktop_cocoa`: Create additional platform backend: macOS
|
||||||
|
- [ ] `rcore_desktop_x11`: Create additional platform backend: Linux/X11
|
||||||
|
- [ ] `rcore_desktop_wayland`: Create additional platform backend: Linux/Wayland
|
||||||
|
- [ ] `rcore`: Investigate alternative embedded platforms and realtime OSs
|
||||||
|
- [ ] `rlsw`: Software renderer optimizations: mipmaps, platform-specific SIMD
|
||||||
|
- [ ] `rtextures`: Consider moving N-patch system to separate example
|
||||||
|
- [ ] `rtextures`: Review blending modes system, provide more options or better samples
|
||||||
|
- [ ] `rtext`: Investigate the recently opened [`Slug`](https://sluglibrary.com/) font rendering algorithm
|
||||||
|
- [ ] `raudio`: Support microphone input, basic API to read microphone
|
||||||
|
- [ ] `rltexgpu`: Improve compressed textures support, loading and saving, improve KTX 2.0
|
||||||
|
- [ ] `rlobj`: Create OBJ loader, supporting material file separately (low priority)
|
||||||
|
|
||||||
|
**raylib 6.0**
|
||||||
|
- [x] `rlsw`: New Software Renderer backend, pseudo-OpenGL 1.1 implementation
|
||||||
|
- [x] `rcore_emscripten`: New emscripten-only backend, avoiding GLFW dependency
|
||||||
|
- [x] `rlgl`: Review GLSL shaders naming conventions for consistency, redesigned shader API
|
||||||
|
- [x] `rmodels`: Improve 3d objects loading, specially animations (obj, gltf)
|
||||||
|
- [x] `examples`: Review all examples, add more and better code explanations
|
||||||
|
|
||||||
|
**raylib 5.0**
|
||||||
|
- [x] Split core module into separate platforms?
|
||||||
|
- [x] Redesign gestures system, improve touch inputs management
|
||||||
|
- [x] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
|
||||||
|
- [x] Better documentation and improved examples, reviewed webpage with examples complexity level
|
||||||
|
- [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs)
|
||||||
|
- [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)
|
||||||
|
|
||||||
|
**raylib 4.0**
|
||||||
|
- [x] Improved consistency and coherency in raylib API
|
||||||
|
- [x] Continuous Deployment using GitHub Actions
|
||||||
|
- [x] rlgl improvements for standalone usage (avoid raylib coupling)
|
||||||
|
- Basic CPU/GPU stats system (memory, draws, time...) ([#1295](https://github.com/raysan5/raylib/issues/1295)) - _DISCARDED_
|
||||||
|
- Software rendering backend (avoiding OpenGL) ([#1370](https://github.com/raysan5/raylib/issues/1370)) - _DISCARDED_
|
||||||
|
- Network module (UDP): `rnet` ([#753](https://github.com/raysan5/raylib/issues/753)) - _DISCARDED_ - Use [nbnet](https://github.com/nathhB/nbnet).
|
||||||
|
|
||||||
|
**raylib 3.0**
|
||||||
|
- [x] Custom memory allocators support
|
||||||
|
- [x] Global variables moved to global context
|
||||||
|
- [x] Optimize data structures for pass-by-value
|
||||||
|
- [x] Trace log messages redesign ([#1065](https://github.com/raysan5/raylib/issues/1065))
|
||||||
|
- [x] Continuous Integration using GitHub Actions
|
||||||
|
|
||||||
|
**raylib 2.5**
|
||||||
|
- [x] Support Animated models
|
||||||
|
- [x] Support glTF models file format
|
||||||
|
- [x] Unicode support on text drawing
|
||||||
|
|
||||||
|
**raylib 2.0**
|
||||||
|
- [x] Removed external dependencies (GLFW3 and OpenAL)
|
||||||
|
- [x] Support TCC compiler (32bit and 64bit)
|
||||||
|
|
||||||
|
**raylib 1.8**
|
||||||
|
- [x] Improved Materials system with PBR support
|
||||||
|
- [x] Procedural image generation functions (spot, gradient, noise...)
|
||||||
|
- [x] Procedural mesh generation functions (cube, sphere...)
|
||||||
|
- [x] Custom Android APK build pipeline (default Makefile)
|
||||||
|
|
||||||
|
**raylib 1.7**
|
||||||
|
- [x] Support configuration flags
|
||||||
|
- [x] Improved build system for Android
|
||||||
|
- [x] Gamepad support on HTML5
|
||||||
|
|
||||||
|
**raylib 1.6**
|
||||||
|
- [x] Lua scripting support (raylib Lua wrapper)
|
||||||
|
- [x] Redesigned audio module
|
||||||
|
- [x] Support FLAC file format
|
||||||
|
|
||||||
|
**raylib 1.5**
|
||||||
|
- [x] Support Oculus Rift CV1 and VR stereo rendering (simulator)
|
||||||
|
- [x] Redesign Shaders/Textures system -> New Materials system
|
||||||
|
- [x] Support lighting: Omni, Directional and Spotlights
|
||||||
|
- [x] Redesign physics module (physac)
|
||||||
|
- [x] Chiptunes audio modules support
|
||||||
|
|
||||||
|
**raylib 1.4**
|
||||||
|
- [x] TTF fonts support (using stb_truetype)
|
||||||
|
- [x] Raycast system for 3D picking (including collisions detection)
|
||||||
|
- [x] Floyd-Steinberg dithering on 16bit image format conversion
|
||||||
|
- [x] Basic image manipulation functions (crop, resize, draw...)
|
||||||
|
- [x] Storage load/save data functionality
|
||||||
|
- [x] Add Physics module (physac)
|
||||||
|
- [x] Remove GLEW dependency -> Replaced by GLAD
|
||||||
|
- [x] Redesign Raspberry PI inputs system
|
||||||
|
- [x] Redesign gestures module to be multiplatform
|
||||||
|
- [x] Module raymath as header-only and functions inline
|
||||||
|
- [x] Add Easings module (easings.h)
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
Most considerations of errors and defects can be handled using the project Issues and/or Discussions.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 6.0.x | :white_check_mark: |
|
||||||
|
| < 5.5 | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Discovered vulnerability can be directly reported using the project Issues and/or Discussions.
|
||||||
|
|
||||||
|
_TODO: Tell them where to go, how often they can expect to get an update on a
|
||||||
|
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||||
|
declined, etc._
|
||||||
@@ -0,0 +1,652 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
|
/// Minimum supported version of Zig
|
||||||
|
const min_ver = "0.16.0-dev.3013+abd131e33";
|
||||||
|
|
||||||
|
const emccOutputDir = "zig-out" ++ std.fs.path.sep_str ++ "htmlout" ++ std.fs.path.sep_str;
|
||||||
|
const emccOutputFile = "index.html";
|
||||||
|
|
||||||
|
comptime {
|
||||||
|
const order = std.SemanticVersion.order;
|
||||||
|
const parse = std.SemanticVersion.parse;
|
||||||
|
if (order(builtin.zig_version, parse(min_ver) catch unreachable) == .lt)
|
||||||
|
@compileError("Raylib requires zig version " ++ min_ver);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const emsdk = struct {
|
||||||
|
const zemscripten = @import("zemscripten");
|
||||||
|
|
||||||
|
pub fn shell(b: *std.Build) std.Build.LazyPath {
|
||||||
|
return b.dependency("raylib", .{}).path("src/shell.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const FlagsOptions = struct {
|
||||||
|
optimize: std.builtin.OptimizeMode,
|
||||||
|
asyncify: bool = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn emccDefaultFlags(allocator: std.mem.Allocator, options: FlagsOptions) zemscripten.EmccFlags {
|
||||||
|
var emcc_flags = zemscripten.emccDefaultFlags(allocator, .{
|
||||||
|
.optimize = options.optimize,
|
||||||
|
.fsanitize = true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (options.asyncify)
|
||||||
|
emcc_flags.put("-sASYNCIFY", {}) catch unreachable;
|
||||||
|
|
||||||
|
return emcc_flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const SettingsOptions = struct {
|
||||||
|
optimize: std.builtin.OptimizeMode,
|
||||||
|
es3: bool = true,
|
||||||
|
emsdk_allocator: zemscripten.EmsdkAllocator = .emmalloc,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn emccDefaultSettings(allocator: std.mem.Allocator, options: SettingsOptions) zemscripten.EmccSettings {
|
||||||
|
var emcc_settings = zemscripten.emccDefaultSettings(allocator, .{
|
||||||
|
.optimize = options.optimize,
|
||||||
|
.emsdk_allocator = options.emsdk_allocator,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (options.es3)
|
||||||
|
emcc_settings.put("FULL_ES3", "1") catch unreachable;
|
||||||
|
emcc_settings.put("USE_GLFW", "3") catch unreachable;
|
||||||
|
emcc_settings.put("EXPORTED_RUNTIME_METHODS", "['requestFullscreen']") catch unreachable;
|
||||||
|
|
||||||
|
return emcc_settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn emccStep(b: *std.Build, raylib: *std.Build.Step.Compile, wasm: *std.Build.Step.Compile, options: zemscripten.StepOptions) *std.Build.Step {
|
||||||
|
const activate_emsdk_step = zemscripten.activateEmsdkStep(b);
|
||||||
|
|
||||||
|
const emsdk_dep = b.dependency("emsdk", .{});
|
||||||
|
raylib.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include"));
|
||||||
|
wasm.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include"));
|
||||||
|
|
||||||
|
const emcc_step = zemscripten.emccStep(b, wasm, options);
|
||||||
|
emcc_step.dependOn(activate_emsdk_step);
|
||||||
|
|
||||||
|
return emcc_step;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn emrunStep(
|
||||||
|
b: *std.Build,
|
||||||
|
html_path: []const u8,
|
||||||
|
extra_args: []const []const u8,
|
||||||
|
) *std.Build.Step {
|
||||||
|
return zemscripten.emrunStep(b, html_path, extra_args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fn setDesktopPlatform(raylib: *std.Build.Step.Compile, platform: PlatformBackend) void {
|
||||||
|
switch (platform) {
|
||||||
|
.glfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_GLFW", ""),
|
||||||
|
.rgfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_RGFW", ""),
|
||||||
|
.sdl => raylib.root_module.addCMacro("PLATFORM_DESKTOP_SDL", ""),
|
||||||
|
.android => raylib.root_module.addCMacro("PLATFORM_ANDROID", ""),
|
||||||
|
else => {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, options: Options) !*std.Build.Step.Compile {
|
||||||
|
const raylib = b.addLibrary(.{
|
||||||
|
.name = "raylib",
|
||||||
|
.linkage = options.linkage,
|
||||||
|
.root_module = b.createModule(.{
|
||||||
|
.optimize = optimize,
|
||||||
|
.target = target,
|
||||||
|
.link_libc = true,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
raylib.root_module.addCMacro("_GNU_SOURCE", "");
|
||||||
|
raylib.root_module.addCMacro("GL_SILENCE_DEPRECATION", "199309L");
|
||||||
|
|
||||||
|
var raylib_flags_arr: std.ArrayList([]const u8) = .empty;
|
||||||
|
defer raylib_flags_arr.deinit(b.allocator);
|
||||||
|
|
||||||
|
try raylib_flags_arr.append(
|
||||||
|
b.allocator,
|
||||||
|
"-std=gnu99",
|
||||||
|
);
|
||||||
|
|
||||||
|
if (options.linkage == .dynamic) {
|
||||||
|
try raylib_flags_arr.append(
|
||||||
|
b.allocator,
|
||||||
|
"-fPIC",
|
||||||
|
);
|
||||||
|
|
||||||
|
raylib.root_module.addCMacro("BUILD_LIBTYPE_SHARED", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.config.len > 0) {
|
||||||
|
// Splits a space-separated list of config flags into multiple flags
|
||||||
|
//
|
||||||
|
// Note: This means certain flags like `-x c++` won't be processed properly.
|
||||||
|
// `-xc++` or similar should be used when possible
|
||||||
|
var config_iter = std.mem.tokenizeScalar(u8, options.config, ' ');
|
||||||
|
|
||||||
|
// Apply config flags supplied by the user
|
||||||
|
while (config_iter.next()) |config_flag| {
|
||||||
|
try raylib_flags_arr.append(b.allocator, config_flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No GLFW required on PLATFORM_DRM
|
||||||
|
if (options.platform != .drm) {
|
||||||
|
raylib.root_module.addIncludePath(b.path("src/external/glfw/include"));
|
||||||
|
}
|
||||||
|
|
||||||
|
var c_source_files: std.ArrayList([]const u8) = try .initCapacity(b.allocator, 2);
|
||||||
|
c_source_files.appendSliceAssumeCapacity(&.{"src/rcore.c"});
|
||||||
|
|
||||||
|
if (options.rshapes) {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RSHAPES", "1");
|
||||||
|
try c_source_files.append(b.allocator, "src/rshapes.c");
|
||||||
|
} else {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RSHAPES", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.rtextures) {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RTEXTURES", "1");
|
||||||
|
try c_source_files.append(b.allocator, "src/rtextures.c");
|
||||||
|
} else {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RTEXTURES", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.rtext) {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RTEXT", "1");
|
||||||
|
try c_source_files.append(b.allocator, "src/rtext.c");
|
||||||
|
} else {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RTEXT", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.rmodels) {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RMODELS", "1");
|
||||||
|
try c_source_files.append(b.allocator, "src/rmodels.c");
|
||||||
|
} else {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RMODELS", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.raudio) {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RAUDIO", "1");
|
||||||
|
try c_source_files.append(b.allocator, "src/raudio.c");
|
||||||
|
} else {
|
||||||
|
raylib.root_module.addCMacro("SUPPORT_MODULE_RAUDIO", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.opengl_version != .auto) {
|
||||||
|
raylib.root_module.addCMacro(options.opengl_version.toCMacroStr(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.root_module.addIncludePath(b.path("src/platforms"));
|
||||||
|
switch (target.result.os.tag) {
|
||||||
|
.windows => {
|
||||||
|
switch (options.platform) {
|
||||||
|
.glfw => try c_source_files.append(b.allocator, "src/rglfw.c"),
|
||||||
|
.rgfw, .sdl, .drm, .android => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.root_module.linkSystemLibrary("winmm", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("gdi32", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("opengl32", .{});
|
||||||
|
|
||||||
|
setDesktopPlatform(raylib, options.platform);
|
||||||
|
},
|
||||||
|
.linux => {
|
||||||
|
if (options.platform == .drm) {
|
||||||
|
if (options.opengl_version == .auto) {
|
||||||
|
raylib.root_module.linkSystemLibrary("GLESv2", .{});
|
||||||
|
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.root_module.linkSystemLibrary("EGL", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("gbm", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("libdrm", .{ .use_pkg_config = .force });
|
||||||
|
|
||||||
|
raylib.root_module.addCMacro("PLATFORM_DRM", "");
|
||||||
|
raylib.root_module.addCMacro("EGL_NO_X11", "");
|
||||||
|
raylib.root_module.addCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", "");
|
||||||
|
} else if (target.result.abi.isAndroid()) {
|
||||||
|
|
||||||
|
//these are the only tag options per https://developer.android.com/ndk/guides/other_build_systems
|
||||||
|
const hostTuple = switch (builtin.target.os.tag) {
|
||||||
|
.linux => "linux-x86_64",
|
||||||
|
.windows => "windows-x86_64",
|
||||||
|
.macos => "darwin-x86_64",
|
||||||
|
else => @panic("unsupported host OS"),
|
||||||
|
};
|
||||||
|
|
||||||
|
const androidTriple = switch (target.result.cpu.arch) {
|
||||||
|
.x86 => "i686-linux-android",
|
||||||
|
.x86_64 => "x86_64-linux-android",
|
||||||
|
.arm => "arm-linux-androideabi",
|
||||||
|
.aarch64 => "aarch64-linux-android",
|
||||||
|
.riscv64 => "riscv64-linux-android",
|
||||||
|
else => error.InvalidAndroidTarget,
|
||||||
|
} catch @panic("invalid android target!");
|
||||||
|
const androidNdkPathString: []const u8 = options.android_ndk;
|
||||||
|
if (androidNdkPathString.len < 1) @panic("no ndk path provided and ANDROID_NDK_HOME is not set");
|
||||||
|
const androidApiLevel: []const u8 = options.android_api_version;
|
||||||
|
|
||||||
|
const androidSysroot = try std.fs.path.join(b.allocator, &.{ androidNdkPathString, "/toolchains/llvm/prebuilt/", hostTuple, "/sysroot" });
|
||||||
|
const androidLibPath = try std.fs.path.join(b.allocator, &.{ androidSysroot, "/usr/lib/", androidTriple });
|
||||||
|
const androidApiSpecificPath = try std.fs.path.join(b.allocator, &.{ androidLibPath, androidApiLevel });
|
||||||
|
const androidIncludePath = try std.fs.path.join(b.allocator, &.{ androidSysroot, "/usr/include" });
|
||||||
|
const androidArchIncludePath = try std.fs.path.join(b.allocator, &.{ androidIncludePath, androidTriple });
|
||||||
|
const androidAsmPath = try std.fs.path.join(b.allocator, &.{ androidIncludePath, "/asm-generic" });
|
||||||
|
const androidGluePath = try std.fs.path.join(b.allocator, &.{ androidNdkPathString, "/sources/android/native_app_glue/" });
|
||||||
|
|
||||||
|
raylib.root_module.addLibraryPath(.{ .cwd_relative = androidLibPath });
|
||||||
|
raylib.root_module.addLibraryPath(.{ .cwd_relative = androidApiSpecificPath });
|
||||||
|
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidIncludePath });
|
||||||
|
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidArchIncludePath });
|
||||||
|
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidAsmPath });
|
||||||
|
raylib.root_module.addSystemIncludePath(.{ .cwd_relative = androidGluePath });
|
||||||
|
|
||||||
|
var libcData: std.ArrayList(u8) = .empty;
|
||||||
|
var aw: std.Io.Writer.Allocating = .fromArrayList(b.allocator, &libcData);
|
||||||
|
try (std.zig.LibCInstallation{
|
||||||
|
.include_dir = androidIncludePath,
|
||||||
|
.sys_include_dir = androidIncludePath,
|
||||||
|
.crt_dir = androidApiSpecificPath,
|
||||||
|
}).render(&aw.writer);
|
||||||
|
const libcFile = b.addWriteFiles().add("android-libc.txt", try libcData.toOwnedSlice(b.allocator));
|
||||||
|
raylib.setLibCFile(libcFile);
|
||||||
|
|
||||||
|
if (options.opengl_version == .auto) {
|
||||||
|
raylib.root_module.linkSystemLibrary("GLESv2", .{});
|
||||||
|
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", "");
|
||||||
|
}
|
||||||
|
raylib.root_module.linkSystemLibrary("EGL", .{});
|
||||||
|
|
||||||
|
setDesktopPlatform(raylib, .android);
|
||||||
|
} else {
|
||||||
|
switch (options.platform) {
|
||||||
|
.glfw => try c_source_files.append(b.allocator, "src/rglfw.c"),
|
||||||
|
.rgfw, .sdl, .drm, .android => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.linux_display_backend == .X11 or options.linux_display_backend == .Both) {
|
||||||
|
raylib.root_module.addCMacro("_GLFW_X11", "");
|
||||||
|
raylib.root_module.linkSystemLibrary("GLX", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("X11", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xcursor", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xext", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xfixes", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xi", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xinerama", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xrandr", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xrender", .{});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.linux_display_backend == .Wayland or options.linux_display_backend == .Both) {
|
||||||
|
_ = b.findProgram(&.{"wayland-scanner"}, &.{}) catch {
|
||||||
|
std.log.err(
|
||||||
|
\\ `wayland-scanner` may not be installed on the system.
|
||||||
|
\\ You can switch to X11 in your `build.zig` by changing `Options.linux_display_backend`
|
||||||
|
, .{});
|
||||||
|
@panic("`wayland-scanner` not found");
|
||||||
|
};
|
||||||
|
raylib.root_module.addCMacro("_GLFW_WAYLAND", "");
|
||||||
|
raylib.root_module.linkSystemLibrary("EGL", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("wayland-client", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("xkbcommon", .{});
|
||||||
|
waylandGenerate(b, raylib, "wayland.xml", "wayland-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "xdg-shell.xml", "xdg-shell-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "xdg-decoration-unstable-v1.xml", "xdg-decoration-unstable-v1-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "viewporter.xml", "viewporter-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "relative-pointer-unstable-v1.xml", "relative-pointer-unstable-v1-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "pointer-constraints-unstable-v1.xml", "pointer-constraints-unstable-v1-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "fractional-scale-v1.xml", "fractional-scale-v1-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "xdg-activation-v1.xml", "xdg-activation-v1-client-protocol");
|
||||||
|
waylandGenerate(b, raylib, "idle-inhibit-unstable-v1.xml", "idle-inhibit-unstable-v1-client-protocol");
|
||||||
|
}
|
||||||
|
setDesktopPlatform(raylib, options.platform);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.freebsd, .openbsd, .netbsd, .dragonfly => {
|
||||||
|
try c_source_files.append(b.allocator, "src/rglfw.c");
|
||||||
|
raylib.root_module.linkSystemLibrary("GL", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("rt", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("dl", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("m", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("X11", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xrandr", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xinerama", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xi", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xxf86vm", .{});
|
||||||
|
raylib.root_module.linkSystemLibrary("Xcursor", .{});
|
||||||
|
|
||||||
|
setDesktopPlatform(raylib, options.platform);
|
||||||
|
},
|
||||||
|
.macos => {
|
||||||
|
// Include xcode_frameworks for cross compilation
|
||||||
|
if (b.lazyDependency("xcode_frameworks", .{})) |dep| {
|
||||||
|
raylib.root_module.addSystemFrameworkPath(dep.path("Frameworks"));
|
||||||
|
raylib.root_module.addSystemIncludePath(dep.path("include"));
|
||||||
|
raylib.root_module.addLibraryPath(dep.path("lib"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// On macos rglfw.c include Objective-C files.
|
||||||
|
try raylib_flags_arr.append(b.allocator, "-ObjC");
|
||||||
|
raylib.root_module.addCSourceFile(.{
|
||||||
|
.file = b.path("src/rglfw.c"),
|
||||||
|
.flags = raylib_flags_arr.items,
|
||||||
|
});
|
||||||
|
_ = raylib_flags_arr.pop();
|
||||||
|
raylib.root_module.linkFramework("Foundation", .{});
|
||||||
|
raylib.root_module.linkFramework("CoreServices", .{});
|
||||||
|
raylib.root_module.linkFramework("CoreGraphics", .{});
|
||||||
|
raylib.root_module.linkFramework("AppKit", .{});
|
||||||
|
raylib.root_module.linkFramework("IOKit", .{});
|
||||||
|
|
||||||
|
setDesktopPlatform(raylib, options.platform);
|
||||||
|
},
|
||||||
|
.emscripten => {
|
||||||
|
const activate_emsdk_step = emsdk.zemscripten.activateEmsdkStep(b);
|
||||||
|
raylib.step.dependOn(activate_emsdk_step);
|
||||||
|
raylib.root_module.addCMacro("PLATFORM_WEB", "");
|
||||||
|
if (options.opengl_version == .auto) {
|
||||||
|
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES3", "");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
else => {
|
||||||
|
@panic("Unsupported OS");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.root_module.addCSourceFiles(.{
|
||||||
|
.files = c_source_files.items,
|
||||||
|
.flags = raylib_flags_arr.items,
|
||||||
|
});
|
||||||
|
|
||||||
|
return raylib;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn addRaygui(b: *std.Build, raylib: *std.Build.Step.Compile, raygui_dep: *std.Build.Dependency, options: Options) void {
|
||||||
|
const raylib_dep = b.dependencyFromBuildZig(@This(), options);
|
||||||
|
var gen_step = b.addWriteFiles();
|
||||||
|
raylib.step.dependOn(&gen_step.step);
|
||||||
|
|
||||||
|
const raygui_c_path = gen_step.add("raygui.c", "#define RAYGUI_IMPLEMENTATION\n#include \"raygui.h\"\n");
|
||||||
|
raylib.root_module.addCSourceFile(.{ .file = raygui_c_path });
|
||||||
|
raylib.root_module.addIncludePath(raygui_dep.path("src"));
|
||||||
|
raylib.root_module.addIncludePath(raylib_dep.path("src"));
|
||||||
|
|
||||||
|
raylib.installHeader(raygui_dep.path("src/raygui.h"), "raygui.h");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const Options = struct {
|
||||||
|
raudio: bool = true,
|
||||||
|
rmodels: bool = true,
|
||||||
|
rshapes: bool = true,
|
||||||
|
rtext: bool = true,
|
||||||
|
rtextures: bool = true,
|
||||||
|
platform: PlatformBackend = .glfw,
|
||||||
|
linkage: std.builtin.LinkMode = .static,
|
||||||
|
linux_display_backend: LinuxDisplayBackend = .X11,
|
||||||
|
opengl_version: OpenglVersion = .auto,
|
||||||
|
android_ndk: []const u8 = "",
|
||||||
|
android_api_version: []const u8 = "35",
|
||||||
|
/// config should be a list of space-separated cflags, eg, "-DSUPPORT_CUSTOM_FRAME_CONTROL"
|
||||||
|
config: []const u8 = &.{},
|
||||||
|
|
||||||
|
const defaults = Options{};
|
||||||
|
|
||||||
|
pub fn getOptions(b: *std.Build) Options {
|
||||||
|
return .{
|
||||||
|
.platform = b.option(PlatformBackend, "platform", "Choose the platform backend for desktop target") orelse defaults.platform,
|
||||||
|
.raudio = b.option(bool, "raudio", "Compile with audio support") orelse defaults.raudio,
|
||||||
|
.rmodels = b.option(bool, "rmodels", "Compile with models support") orelse defaults.rmodels,
|
||||||
|
.rtext = b.option(bool, "rtext", "Compile with text support") orelse defaults.rtext,
|
||||||
|
.rtextures = b.option(bool, "rtextures", "Compile with textures support") orelse defaults.rtextures,
|
||||||
|
.rshapes = b.option(bool, "rshapes", "Compile with shapes support") orelse defaults.rshapes,
|
||||||
|
.linkage = b.option(std.builtin.LinkMode, "linkage", "Compile as shared or static library") orelse defaults.linkage,
|
||||||
|
.linux_display_backend = b.option(LinuxDisplayBackend, "linux_display_backend", "Linux display backend to use") orelse defaults.linux_display_backend,
|
||||||
|
.opengl_version = b.option(OpenglVersion, "opengl_version", "OpenGL version to use") orelse defaults.opengl_version,
|
||||||
|
.config = b.option([]const u8, "config", "Compile with custom define macros overriding config.h") orelse &.{},
|
||||||
|
.android_ndk = b.option([]const u8, "android_ndk", "specify path to android ndk") orelse b.graph.environ_map.get("ANDROID_NDK_HOME") orelse "",
|
||||||
|
.android_api_version = b.option([]const u8, "android_api_version", "specify target android API level") orelse defaults.android_api_version,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const OpenglVersion = enum {
|
||||||
|
auto,
|
||||||
|
gl_1_1,
|
||||||
|
gl_2_1,
|
||||||
|
gl_3_3,
|
||||||
|
gl_4_3,
|
||||||
|
gles_2,
|
||||||
|
gles_3,
|
||||||
|
|
||||||
|
pub fn toCMacroStr(self: @This()) []const u8 {
|
||||||
|
switch (self) {
|
||||||
|
.auto => @panic("OpenglVersion.auto cannot be turned into a C macro string"),
|
||||||
|
.gl_1_1 => return "GRAPHICS_API_OPENGL_11",
|
||||||
|
.gl_2_1 => return "GRAPHICS_API_OPENGL_21",
|
||||||
|
.gl_3_3 => return "GRAPHICS_API_OPENGL_33",
|
||||||
|
.gl_4_3 => return "GRAPHICS_API_OPENGL_43",
|
||||||
|
.gles_2 => return "GRAPHICS_API_OPENGL_ES2",
|
||||||
|
.gles_3 => return "GRAPHICS_API_OPENGL_ES3",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const LinuxDisplayBackend = enum {
|
||||||
|
None,
|
||||||
|
X11,
|
||||||
|
Wayland,
|
||||||
|
Both,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const PlatformBackend = enum {
|
||||||
|
glfw,
|
||||||
|
rgfw,
|
||||||
|
sdl,
|
||||||
|
drm,
|
||||||
|
android,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn build(b: *std.Build) !void {
|
||||||
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
const lib = try compileRaylib(b, target, optimize, Options.getOptions(b));
|
||||||
|
|
||||||
|
lib.installHeader(b.path("src/raylib.h"), "raylib.h");
|
||||||
|
lib.installHeader(b.path("src/rcamera.h"), "rcamera.h");
|
||||||
|
lib.installHeader(b.path("src/raymath.h"), "raymath.h");
|
||||||
|
lib.installHeader(b.path("src/rlgl.h"), "rlgl.h");
|
||||||
|
|
||||||
|
b.installArtifact(lib);
|
||||||
|
|
||||||
|
const examples = b.step("examples", "Build/Install all examples");
|
||||||
|
examples.dependOn(try addExamples("audio", b, target, optimize, lib));
|
||||||
|
examples.dependOn(try addExamples("core", b, target, optimize, lib));
|
||||||
|
examples.dependOn(try addExamples("models", b, target, optimize, lib));
|
||||||
|
examples.dependOn(try addExamples("others", b, target, optimize, lib));
|
||||||
|
examples.dependOn(try addExamples("shaders", b, target, optimize, lib));
|
||||||
|
examples.dependOn(try addExamples("shapes", b, target, optimize, lib));
|
||||||
|
examples.dependOn(try addExamples("text", b, target, optimize, lib));
|
||||||
|
examples.dependOn(try addExamples("textures", b, target, optimize, lib));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn addExamples(
|
||||||
|
comptime module: []const u8,
|
||||||
|
b: *std.Build,
|
||||||
|
target: std.Build.ResolvedTarget,
|
||||||
|
optimize: std.builtin.OptimizeMode,
|
||||||
|
raylib: *std.Build.Step.Compile,
|
||||||
|
) !*std.Build.Step {
|
||||||
|
const all = b.step(module, "All " ++ module ++ " examples");
|
||||||
|
const module_subpath = b.pathJoin(&.{ "examples", module });
|
||||||
|
|
||||||
|
var dir = try std.Io.Dir.cwd().openDir(b.graph.io, b.pathFromRoot(module_subpath), .{ .iterate = true });
|
||||||
|
defer dir.close(b.graph.io);
|
||||||
|
|
||||||
|
var iter = dir.iterate();
|
||||||
|
while (try iter.next(b.graph.io)) |entry| {
|
||||||
|
if (entry.kind != .file) continue;
|
||||||
|
const extension_idx = std.mem.lastIndexOf(u8, entry.name, ".c") orelse continue;
|
||||||
|
const name = entry.name[0..extension_idx];
|
||||||
|
const filename = try std.fmt.allocPrint(b.allocator, "{s}.c", .{name});
|
||||||
|
const path = b.pathJoin(&.{ module_subpath, filename });
|
||||||
|
|
||||||
|
// zig's mingw headers do not include pthread.h
|
||||||
|
if (std.mem.eql(u8, "core_loading_thread", name) and target.result.os.tag == .windows) continue;
|
||||||
|
|
||||||
|
const exe_mod = b.createModule(.{
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
exe_mod.addCSourceFile(.{ .file = b.path(path), .flags = &.{} });
|
||||||
|
exe_mod.linkLibrary(raylib);
|
||||||
|
|
||||||
|
const run_step = b.step(name, name);
|
||||||
|
|
||||||
|
if (target.result.os.tag == .emscripten) {
|
||||||
|
const wasm = b.addLibrary(.{
|
||||||
|
.name = name,
|
||||||
|
.linkage = .static,
|
||||||
|
.root_module = exe_mod,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (std.mem.eql(u8, name, "rlgl_standalone")) {
|
||||||
|
exe_mod.addIncludePath(b.path("src"));
|
||||||
|
exe_mod.addIncludePath(b.path("src/external/glfw/include"));
|
||||||
|
}
|
||||||
|
if (std.mem.eql(u8, name, "raylib_opengl_interop")) {
|
||||||
|
exe_mod.addIncludePath(b.path("src/external"));
|
||||||
|
}
|
||||||
|
|
||||||
|
const emcc_flags = emsdk.emccDefaultFlags(b.allocator, .{ .optimize = optimize });
|
||||||
|
const emcc_settings = emsdk.emccDefaultSettings(b.allocator, .{ .optimize = optimize });
|
||||||
|
|
||||||
|
const install_dir: std.Build.InstallDir = .{ .custom = "htmlout" };
|
||||||
|
const emcc_step = emsdk.emccStep(b, raylib, wasm, .{
|
||||||
|
.optimize = optimize,
|
||||||
|
.flags = emcc_flags,
|
||||||
|
.settings = emcc_settings,
|
||||||
|
.shell_file_path = b.path("src/shell.html"),
|
||||||
|
.embed_paths = &.{
|
||||||
|
.{
|
||||||
|
.src_path = b.pathJoin(&.{ module_subpath, "resources" }),
|
||||||
|
.virtual_path = "resources",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.install_dir = install_dir,
|
||||||
|
});
|
||||||
|
|
||||||
|
const html_filename = try std.fmt.allocPrint(b.allocator, "{s}.html", .{wasm.name});
|
||||||
|
const emrun_step = emsdk.emrunStep(
|
||||||
|
b,
|
||||||
|
b.getInstallPath(install_dir, html_filename),
|
||||||
|
&.{"--no_browser"},
|
||||||
|
);
|
||||||
|
emrun_step.dependOn(emcc_step);
|
||||||
|
|
||||||
|
run_step.dependOn(emrun_step);
|
||||||
|
all.dependOn(emcc_step);
|
||||||
|
} else {
|
||||||
|
// special examples that test using these external dependencies directly
|
||||||
|
// alongside raylib
|
||||||
|
if (std.mem.eql(u8, name, "rlgl_standalone")) {
|
||||||
|
exe_mod.addIncludePath(b.path("src"));
|
||||||
|
exe_mod.addIncludePath(b.path("src/external/glfw/include"));
|
||||||
|
if (!hasCSource(raylib.root_module, "rglfw.c")) {
|
||||||
|
exe_mod.addCSourceFile(.{ .file = b.path("src/rglfw.c"), .flags = &.{} });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (std.mem.eql(u8, name, "raylib_opengl_interop")) {
|
||||||
|
exe_mod.addIncludePath(b.path("src/external"));
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (target.result.os.tag) {
|
||||||
|
.windows => {
|
||||||
|
exe_mod.linkSystemLibrary("winmm", .{});
|
||||||
|
exe_mod.linkSystemLibrary("gdi32", .{});
|
||||||
|
exe_mod.linkSystemLibrary("opengl32", .{});
|
||||||
|
|
||||||
|
exe_mod.addCMacro("PLATFORM_DESKTOP", "");
|
||||||
|
},
|
||||||
|
.linux => {
|
||||||
|
exe_mod.linkSystemLibrary("GL", .{});
|
||||||
|
exe_mod.linkSystemLibrary("rt", .{});
|
||||||
|
exe_mod.linkSystemLibrary("dl", .{});
|
||||||
|
exe_mod.linkSystemLibrary("m", .{});
|
||||||
|
exe_mod.linkSystemLibrary("X11", .{});
|
||||||
|
|
||||||
|
exe_mod.addCMacro("PLATFORM_DESKTOP", "");
|
||||||
|
},
|
||||||
|
.macos => {
|
||||||
|
exe_mod.linkFramework("Foundation", .{});
|
||||||
|
exe_mod.linkFramework("Cocoa", .{});
|
||||||
|
exe_mod.linkFramework("OpenGL", .{});
|
||||||
|
exe_mod.linkFramework("CoreAudio", .{});
|
||||||
|
exe_mod.linkFramework("CoreVideo", .{});
|
||||||
|
exe_mod.linkFramework("IOKit", .{});
|
||||||
|
|
||||||
|
exe_mod.addCMacro("PLATFORM_DESKTOP", "");
|
||||||
|
},
|
||||||
|
else => {
|
||||||
|
@panic("Unsupported OS");
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const exe = b.addExecutable(.{
|
||||||
|
.name = name,
|
||||||
|
.root_module = exe_mod,
|
||||||
|
});
|
||||||
|
|
||||||
|
const install_cmd = b.addInstallArtifact(exe, .{});
|
||||||
|
|
||||||
|
const run_cmd = b.addRunArtifact(exe);
|
||||||
|
run_cmd.cwd = b.path(module_subpath);
|
||||||
|
run_cmd.step.dependOn(&install_cmd.step);
|
||||||
|
|
||||||
|
run_step.dependOn(&run_cmd.step);
|
||||||
|
all.dependOn(&install_cmd.step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn waylandGenerate(
|
||||||
|
b: *std.Build,
|
||||||
|
raylib: *std.Build.Step.Compile,
|
||||||
|
comptime protocol: []const u8,
|
||||||
|
comptime basename: []const u8,
|
||||||
|
) void {
|
||||||
|
const waylandDir = "src/external/glfw/deps/wayland";
|
||||||
|
const protocolDir = b.pathJoin(&.{ waylandDir, protocol });
|
||||||
|
const clientHeader = basename ++ ".h";
|
||||||
|
const privateCode = basename ++ "-code.h";
|
||||||
|
|
||||||
|
const client_step = b.addSystemCommand(&.{ "wayland-scanner", "client-header" });
|
||||||
|
client_step.addFileArg(b.path(protocolDir));
|
||||||
|
raylib.root_module.addIncludePath(client_step.addOutputFileArg(clientHeader).dirname());
|
||||||
|
|
||||||
|
const private_step = b.addSystemCommand(&.{ "wayland-scanner", "private-code" });
|
||||||
|
private_step.addFileArg(b.path(protocolDir));
|
||||||
|
raylib.root_module.addIncludePath(private_step.addOutputFileArg(privateCode).dirname());
|
||||||
|
|
||||||
|
raylib.step.dependOn(&client_step.step);
|
||||||
|
raylib.step.dependOn(&private_step.step);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hasCSource(module: *std.Build.Module, name: []const u8) bool {
|
||||||
|
for (module.link_objects.items) |o| switch (o) {
|
||||||
|
.c_source_file => |c| if (switch (c.file) {
|
||||||
|
.src_path => |s| std.ascii.endsWithIgnoreCase(s.sub_path, name),
|
||||||
|
.generated, .cwd_relative, .dependency => false,
|
||||||
|
}) return true,
|
||||||
|
.c_source_files => |s| for (s.files) |c| if (std.ascii.endsWithIgnoreCase(c, name)) return true,
|
||||||
|
else => {},
|
||||||
|
};
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
.{
|
||||||
|
.name = .raylib,
|
||||||
|
.version = "5.6.0-dev",
|
||||||
|
.minimum_zig_version = "0.15.1",
|
||||||
|
|
||||||
|
.fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications.
|
||||||
|
|
||||||
|
.dependencies = .{
|
||||||
|
.xcode_frameworks = .{
|
||||||
|
.url = "https://pkg.machengine.org/xcode-frameworks/8a1cfb373587ea4c9bb1468b7c986462d8d4e10e.tar.gz",
|
||||||
|
.hash = "N-V-__8AALShqgXkvqYU6f__FrA22SMWmi2TXCJjNTO1m8XJ",
|
||||||
|
.lazy = true,
|
||||||
|
},
|
||||||
|
.emsdk = .{
|
||||||
|
.url = "git+https://github.com/emscripten-core/emsdk#4.0.9",
|
||||||
|
.hash = "N-V-__8AAJl1DwBezhYo_VE6f53mPVm00R-Fk28NPW7P14EQ",
|
||||||
|
},
|
||||||
|
.zemscripten = .{
|
||||||
|
.url = "git+https://github.com/zig-gamedev/zemscripten#3fa4b778852226c7346bdcc3c1486e875a9a6d02",
|
||||||
|
.hash = "zemscripten-0.2.0-dev-sRlDqApRAACspTbAZnuNKWIzfWzSYgYkb2nWAXZ-tqqt",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
.paths = .{
|
||||||
|
"build.zig",
|
||||||
|
"build.zig.zon",
|
||||||
|
"src",
|
||||||
|
"examples",
|
||||||
|
"LICENSE",
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=@libdir_for_pc_file@
|
||||||
|
includedir=@includedir_for_pc_file@
|
||||||
|
|
||||||
|
Name: raylib
|
||||||
|
Description: A simple and easy-to-use library to enjoy videogames programming
|
||||||
|
URL: https://github.com/raysan5/raylib
|
||||||
|
Version: @PROJECT_VERSION@
|
||||||
|
Libs: -L"${libdir}" -lraylib @PKG_CONFIG_LIBS_EXTRA@
|
||||||
|
Libs.private: @PKG_CONFIG_LIBS_PRIVATE@
|
||||||
|
Requires.private: @GLFW_PKG_DEPS@
|
||||||
|
Cflags: -I"${includedir}"
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
# Setup the project and settings
|
||||||
|
project(raylib C)
|
||||||
|
set(PROJECT_VERSION 6.0.0)
|
||||||
|
set(API_VERSION 600)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
include(JoinPaths)
|
||||||
|
|
||||||
|
# Sets build type if not set by now
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
set(default_build_type Debug)
|
||||||
|
else()
|
||||||
|
message(WARNING "Default build type is not set (CMAKE_BUILD_TYPE)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||||
|
|
||||||
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Used as public API to be included into other projects
|
||||||
|
set(raylib_public_headers
|
||||||
|
raylib.h
|
||||||
|
rcamera.h
|
||||||
|
rlgl.h
|
||||||
|
raymath.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# Sources to be compiled
|
||||||
|
set(raylib_sources
|
||||||
|
raudio.c
|
||||||
|
rcore.c
|
||||||
|
rmodels.c
|
||||||
|
rshapes.c
|
||||||
|
rtext.c
|
||||||
|
rtextures.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# <root>/cmake/GlfwImport.cmake handles the details around the inclusion of glfw
|
||||||
|
if (NOT ${PLATFORM} MATCHES "Web")
|
||||||
|
include(GlfwImport)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Sets additional platform options and link libraries for each platform
|
||||||
|
# also selects the proper graphics API and version for that platform
|
||||||
|
# Produces a variable LIBS_PRIVATE that will be used later
|
||||||
|
include(LibraryConfigurations)
|
||||||
|
|
||||||
|
if (SUPPORT_MODULE_RAUDIO)
|
||||||
|
MESSAGE(STATUS "Audio Backend: miniaudio")
|
||||||
|
else ()
|
||||||
|
MESSAGE(STATUS "Audio Backend: None (-DCUSTOMIZE_BUILD=ON -DSUPPORT_MODULE_RAUDIO=OFF)")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_library(raylib ${raylib_sources} ${raylib_public_headers})
|
||||||
|
|
||||||
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
|
MESSAGE(STATUS "Building raylib static library")
|
||||||
|
add_library(raylib_static ALIAS raylib)
|
||||||
|
else()
|
||||||
|
MESSAGE(STATUS "Building raylib shared library")
|
||||||
|
target_compile_definitions(raylib
|
||||||
|
PRIVATE $<BUILD_INTERFACE:BUILD_LIBTYPE_SHARED>
|
||||||
|
INTERFACE $<INSTALL_INTERFACE:USE_LIBTYPE_SHARED>
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${PLATFORM} MATCHES "Web")
|
||||||
|
target_link_options(raylib PUBLIC "-sUSE_GLFW=3" -sEXPORTED_RUNTIME_METHODS=ccall)
|
||||||
|
if(${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES3")
|
||||||
|
target_link_options(raylib PUBLIC "-sMIN_WEBGL_VERSION=2")
|
||||||
|
target_link_options(raylib PUBLIC "-sMAX_WEBGL_VERSION=2")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${PLATFORM} MATCHES "Android")
|
||||||
|
# Wrap fopen at link time so all code (including third-party libs) goes
|
||||||
|
# through __wrap_fopen, which handles Android APK asset loading
|
||||||
|
target_link_options(raylib PUBLIC -Wl,--wrap=fopen)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(raylib PROPERTIES
|
||||||
|
PUBLIC_HEADER "${raylib_public_headers}"
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
SOVERSION ${API_VERSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WITH_PIC OR BUILD_SHARED_LIBS)
|
||||||
|
set_property(TARGET raylib PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
# Hide raylib's symbols by default so RLAPI can expose them
|
||||||
|
set_property(TARGET raylib PROPERTY C_VISIBILITY_PRESET hidden)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
target_link_libraries(raylib PRIVATE $<BUILD_INTERFACE:${LIBS_PRIVATE}>)
|
||||||
|
target_link_libraries(raylib PUBLIC ${LIBS_PUBLIC})
|
||||||
|
|
||||||
|
# Sets some compile time definitions for the pre-processor
|
||||||
|
# If CUSTOMIZE_BUILD option is on you will not use config.h by default
|
||||||
|
# and you will be able to select more build options
|
||||||
|
include(CompileDefinitions)
|
||||||
|
|
||||||
|
# Registering include directories
|
||||||
|
target_include_directories(raylib
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${OPENGL_INCLUDE_DIR}
|
||||||
|
${OPENAL_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Copy the header files to the build directory for convenience
|
||||||
|
file(COPY ${raylib_public_headers} DESTINATION "include")
|
||||||
|
if (PLATFORM STREQUAL "Desktop")
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
if (GLFW_BUILD_X11)
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
|
target_compile_definitions(raylib PRIVATE _GLFW_X11)
|
||||||
|
|
||||||
|
target_link_libraries(raylib PRIVATE
|
||||||
|
${X11_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
message(STATUS "X11 support enabled for raylib")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Includes information on how the library will be installed on the system
|
||||||
|
# when cmake --install is run
|
||||||
|
include(InstallConfigurations)
|
||||||
|
|
||||||
|
# Print the flags for the user
|
||||||
|
if (DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
message(STATUS "Generated build type: ${CMAKE_BUILD_TYPE}")
|
||||||
|
else ()
|
||||||
|
message(STATUS "Generated config types: ${CMAKE_CONFIGURATION_TYPES}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
message(STATUS "Compiling with the flags:")
|
||||||
|
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
|
||||||
|
message(STATUS " GRAPHICS=" ${GRAPHICS})
|
||||||
|
|
||||||
|
# Options if you want to create an installer using CPack
|
||||||
|
include(PackConfigurations)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
@@ -0,0 +1,993 @@
|
|||||||
|
#******************************************************************************
|
||||||
|
#
|
||||||
|
# raylib makefile
|
||||||
|
#
|
||||||
|
# This file supports building raylib library for the following platforms:
|
||||||
|
#
|
||||||
|
# > PLATFORM_DESKTOP
|
||||||
|
# - Defaults to PLATFORM_DESKTOP_GLFW
|
||||||
|
# > PLATFORM_DESKTOP_GLFW (GLFW backend):
|
||||||
|
# - Windows (Win32, Win64)
|
||||||
|
# - Linux (X11/Wayland desktop mode)
|
||||||
|
# - macOS/OSX (x64, arm64)
|
||||||
|
# - FreeBSD, OpenBSD, NetBSD, DragonFly (X11 desktop)
|
||||||
|
# > PLATFORM_DESKTOP_SDL (SDL backend):
|
||||||
|
# - Windows (Win32, Win64)
|
||||||
|
# - Linux (X11/Wayland desktop mode)
|
||||||
|
# - Others (not tested)
|
||||||
|
# > PLATFORM_DESKTOP_RGFW (RGFW backend):
|
||||||
|
# - Windows (Win32, Win64)
|
||||||
|
# - Linux (X11 desktop mode)
|
||||||
|
# - macOS/OSX (x64, arm64 (not tested))
|
||||||
|
# - Others (not tested)
|
||||||
|
# > PLATFORM_DESKTOP_WIN32 (native Win32):
|
||||||
|
# - Windows (Win32, Win64)
|
||||||
|
# > PLATFORM_WEB (GLFW + Emscripten):
|
||||||
|
# - HTML5 (WebAssembly)
|
||||||
|
# > PLATFORM_WEB_EMSCRIPTEN (Emscripten):
|
||||||
|
# - HTML5 (WebAssembly)
|
||||||
|
# > PLATFORM_WEB_RGFW (Emscripten):
|
||||||
|
# - HTML5 (WebAssembly)
|
||||||
|
# > PLATFORM_DRM (native DRM):
|
||||||
|
# - Raspberry Pi 0-5 (DRM/KMS)
|
||||||
|
# - Linux DRM subsystem (KMS mode)
|
||||||
|
# - Embedded devices (with GPU)
|
||||||
|
# > PLATFORM_ANDROID (native NDK):
|
||||||
|
# - Android (ARM, ARM64)
|
||||||
|
# > PLATFORM_MEMORY
|
||||||
|
# - Memory framebuffer output, using software renderer, no OS required
|
||||||
|
#
|
||||||
|
# Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline.
|
||||||
|
# Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
|
||||||
|
#
|
||||||
|
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
#
|
||||||
|
# Permission is granted to anyone to use this software for any purpose, including commercial
|
||||||
|
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
#
|
||||||
|
# 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||||
|
# wrote the original software. If you use this software in a product, an acknowledgment
|
||||||
|
# in the product documentation would be appreciated but is not required.
|
||||||
|
#
|
||||||
|
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||||
|
# as being the original software.
|
||||||
|
#
|
||||||
|
# 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
#
|
||||||
|
#**************************************************************************************************
|
||||||
|
|
||||||
|
# NOTE: Highly recommended to read the raylib Wiki to know how to compile raylib for different platforms
|
||||||
|
# https://github.com/raysan5/raylib/wiki
|
||||||
|
|
||||||
|
.PHONY: all clean install uninstall
|
||||||
|
|
||||||
|
# Define required environment variables
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
# Define target platform
|
||||||
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
|
||||||
|
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
|
||||||
|
else
|
||||||
|
TARGET_PLATFORM = $(PLATFORM)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define required raylib variables
|
||||||
|
RAYLIB_VERSION = 6.0.0
|
||||||
|
RAYLIB_API_VERSION = 600
|
||||||
|
|
||||||
|
# Define raylib source code path
|
||||||
|
RAYLIB_SRC_PATH ?= ../src
|
||||||
|
|
||||||
|
# Define output directory for compiled library, defaults to src directory
|
||||||
|
# NOTE: If externally provided, make sure directory exists
|
||||||
|
RAYLIB_RELEASE_PATH ?= $(RAYLIB_SRC_PATH)
|
||||||
|
|
||||||
|
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
|
||||||
|
RAYLIB_LIBTYPE ?= STATIC
|
||||||
|
|
||||||
|
# Build mode for library: DEBUG or RELEASE
|
||||||
|
RAYLIB_BUILD_MODE ?= RELEASE
|
||||||
|
|
||||||
|
# Build output name for the library
|
||||||
|
RAYLIB_LIB_NAME ?= raylib
|
||||||
|
|
||||||
|
# Define resource file for DLL properties
|
||||||
|
RAYLIB_RES_FILE ?= ./raylib.dll.rc.data
|
||||||
|
|
||||||
|
# Define external config flags
|
||||||
|
# NOTE: It will override config.h flags with the provided ones,
|
||||||
|
# if NONE, default config.h flags are used
|
||||||
|
RAYLIB_CONFIG_FLAGS ?= NONE
|
||||||
|
|
||||||
|
# To define additional cflags: Use make CUSTOM_CFLAGS=""
|
||||||
|
|
||||||
|
# Include raylib modules on compilation
|
||||||
|
# NOTE: Some programs like tools could not require those modules
|
||||||
|
RAYLIB_MODULE_AUDIO ?= TRUE
|
||||||
|
RAYLIB_MODULE_MODELS ?= TRUE
|
||||||
|
RAYLIB_MODULE_RAYGUI ?= FALSE
|
||||||
|
|
||||||
|
# NOTE: Additional libraries have been moved to their own repos:
|
||||||
|
# raygui: https://github.com/raysan5/raygui
|
||||||
|
RAYLIB_MODULE_RAYGUI_PATH ?= $(RAYLIB_SRC_PATH)/../../raygui/src
|
||||||
|
|
||||||
|
# Use external GLFW library instead of rglfw module
|
||||||
|
USE_EXTERNAL_GLFW ?= FALSE
|
||||||
|
|
||||||
|
# Enable support for X11 by default on Linux when using GLFW
|
||||||
|
# NOTE: Wayland is disabled by default, only enable if you are sure
|
||||||
|
GLFW_LINUX_ENABLE_WAYLAND ?= FALSE
|
||||||
|
GLFW_LINUX_ENABLE_X11 ?= TRUE
|
||||||
|
|
||||||
|
# Enable support for X11 by default on Linux when using RGFW
|
||||||
|
# NOTE: Wayland is disabled by default, only enable if you are sure
|
||||||
|
RGFW_LINUX_ENABLE_WAYLAND ?= FALSE
|
||||||
|
RGFW_LINUX_ENABLE_X11 ?= TRUE
|
||||||
|
|
||||||
|
# PLATFORM_DESKTOP_SDL: It requires SDL library to be provided externally
|
||||||
|
# WARNING: Library is not included in raylib, it MUST be configured by users
|
||||||
|
SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include
|
||||||
|
SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/lib
|
||||||
|
SDL_LIBRARIES ?= -lSDL2 -lSDL2main
|
||||||
|
|
||||||
|
# Determine if the file has root access (only required to install raylib)
|
||||||
|
# "whoami" prints the name of the user that calls him (so, if it is the root user, "whoami" prints "root")
|
||||||
|
ROOT = $(shell whoami)
|
||||||
|
|
||||||
|
# By default we suppose we are working on Windows
|
||||||
|
HOST_PLATFORM_OS ?= WINDOWS
|
||||||
|
PLATFORM_OS ?= WINDOWS
|
||||||
|
|
||||||
|
# Determine PLATFORM_OS when required
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_DESKTOP_WIN32 PLATFORM_WEB PLATFORM_WEB_RGFW PLATFORM_ANDROID))
|
||||||
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||||
|
# ifeq ($(UNAME),Msys) -> Windows
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
PLATFORM_OS = WINDOWS
|
||||||
|
ifndef PLATFORM_SHELL
|
||||||
|
PLATFORM_SHELL = cmd
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
UNAMEOS = $(shell uname)
|
||||||
|
ifeq ($(UNAMEOS),Linux)
|
||||||
|
PLATFORM_OS = LINUX
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),FreeBSD)
|
||||||
|
PLATFORM_OS = BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),OpenBSD)
|
||||||
|
PLATFORM_OS = BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),NetBSD)
|
||||||
|
PLATFORM_OS = BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),DragonFly)
|
||||||
|
PLATFORM_OS = BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),Darwin)
|
||||||
|
PLATFORM_OS = OSX
|
||||||
|
endif
|
||||||
|
ifndef PLATFORM_SHELL
|
||||||
|
PLATFORM_SHELL = sh
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
UNAMEOS = $(shell uname)
|
||||||
|
ifeq ($(UNAMEOS),Linux)
|
||||||
|
PLATFORM_OS = LINUX
|
||||||
|
endif
|
||||||
|
ifndef PLATFORM_SHELL
|
||||||
|
PLATFORM_SHELL = sh
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
ifndef PLATFORM_SHELL
|
||||||
|
PLATFORM_SHELL = sh
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
ifeq ($(PLATFORM_OS), WINDOWS)
|
||||||
|
# Emscripten required variables
|
||||||
|
EMSDK_PATH ?= C:/raylib/emsdk
|
||||||
|
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
|
||||||
|
CLANG_PATH := $(EMSDK_PATH)/upstream/bin
|
||||||
|
PYTHON_PATH := $(EMSDK_PATH)/python/3.13.3_64bit
|
||||||
|
NODE_PATH := $(EMSDK_PATH)/node/22.16.0_64bit/bin
|
||||||
|
export PATH := $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:/raylib/MinGW/bin;$(PATH)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
# Android architecture
|
||||||
|
# Starting at 2019 using arm64 is mandatory for published apps,
|
||||||
|
# Starting on August 2020, minimum required target API is Android 10 (API level 29)
|
||||||
|
ANDROID_ARCH ?= arm64
|
||||||
|
ANDROID_API_VERSION ?= 29
|
||||||
|
|
||||||
|
# Android required path variables
|
||||||
|
# NOTE: Starting with Android NDK r21, no more toolchain generation is required, NDK is the toolchain on itself
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
ANDROID_NDK ?= C:/android-ndk
|
||||||
|
ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64
|
||||||
|
else
|
||||||
|
ANDROID_NDK ?= /usr/lib/android/ndk
|
||||||
|
ifeq ($(PLATFORM_OS), OSX)
|
||||||
|
ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/darwin-x86_64
|
||||||
|
else
|
||||||
|
ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# NOTE: Sysroot can also be reference from $(ANDROID_NDK)/sysroot
|
||||||
|
ANDROID_SYSROOT ?= $(ANDROID_TOOLCHAIN)/sysroot
|
||||||
|
|
||||||
|
ifeq ($(ANDROID_ARCH),arm)
|
||||||
|
ANDROID_COMPILER_ARCH = armv7a
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),arm64)
|
||||||
|
ANDROID_COMPILER_ARCH = aarch64
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86)
|
||||||
|
ANDROID_COMPILER_ARCH = i686
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86_64)
|
||||||
|
ANDROID_COMPILER_ARCH = x86_64
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define raylib graphics api depending on selected platform
|
||||||
|
# NOTE: By default use OpenGL 3.3 on desktop platforms
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_SOFTWARE # Uncomment to use software rendering
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_SOFTWARE # Uncomment to use software rendering
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_SOFTWARE # Uncomment to use software rendering
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_ES2
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_SOFTWARE # Uncomment to use software rendering
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
# On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_ES2
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_ES3
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
# By default use OpenGL ES 2.0 on Android
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_ES2
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define default C compiler and archiver to pack library: CC, AR
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
CC = gcc
|
||||||
|
AR = ar
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# OSX default compiler
|
||||||
|
CC = clang
|
||||||
|
GLFW_OSX = -x objective-c
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
# FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
|
||||||
|
CC = clang
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# OSX default compiler
|
||||||
|
CC = clang
|
||||||
|
GLFW_OSX = -x objective-c
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
# FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
|
||||||
|
CC = clang
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
ifeq ($(USE_RPI_CROSSCOMPILER),TRUE)
|
||||||
|
# Define RPI cross-compiler
|
||||||
|
#CC = armv6j-hardfloat-linux-gnueabi-gcc
|
||||||
|
CC = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-gcc
|
||||||
|
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
# HTML5 emscripten compiler
|
||||||
|
CC = emcc
|
||||||
|
AR = emar
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
# Android toolchain (must be provided for desired architecture and compiler)
|
||||||
|
ifeq ($(ANDROID_ARCH),arm)
|
||||||
|
CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-androideabi$(ANDROID_API_VERSION)-clang
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),arm64)
|
||||||
|
CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-android$(ANDROID_API_VERSION)-clang
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86)
|
||||||
|
CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-android$(ANDROID_API_VERSION)-clang
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86_64)
|
||||||
|
CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-android$(ANDROID_API_VERSION)-clang
|
||||||
|
endif
|
||||||
|
# It seems from Android NDK r22 onwards we need to use llvm-ar
|
||||||
|
AR = $(ANDROID_TOOLCHAIN)/bin/llvm-ar
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define compiler flags: CFLAGS
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
# -O1 defines optimization level
|
||||||
|
# -g include debug information on compilation
|
||||||
|
# -s strip unnecessary data from build --> linker
|
||||||
|
# -Wall turns on most, but not all, compiler warnings
|
||||||
|
# -std=c99 defines C language mode (standard C from 1999 revision)
|
||||||
|
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
|
||||||
|
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
|
||||||
|
# -Wno-unused-value ignore unused return values of some functions (i.e. fread())
|
||||||
|
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
|
||||||
|
# -D_GNU_SOURCE access to lots of nonstandard GNU/Linux extension functions
|
||||||
|
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
|
||||||
|
# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing)
|
||||||
|
CFLAGS = -Wall -D_GNU_SOURCE -D$(TARGET_PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
|
||||||
|
|
||||||
|
ifneq ($(RAYLIB_CONFIG_FLAGS), NONE)
|
||||||
|
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
# NOTE: When using multi-threading in the user code, it requires -pthread enabled
|
||||||
|
CFLAGS += -std=gnu99
|
||||||
|
else
|
||||||
|
CFLAGS += -std=c99
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM_OS), LINUX)
|
||||||
|
CFLAGS += -fPIC
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
CFLAGS += -DUNICODE
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
||||||
|
CFLAGS += -g -D_DEBUG
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(RAYLIB_BUILD_MODE),RELEASE)
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
CFLAGS += -Os
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
CFLAGS += -O1
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
CFLAGS += -O2
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Additional flags for compiler (if desired)
|
||||||
|
# -Wextra enables some extra warning flags that are not enabled by -Wall
|
||||||
|
# -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration
|
||||||
|
# -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types
|
||||||
|
# -Werror=implicit-function-declaration catch function calls without prior declaration
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
CFLAGS += -Werror=implicit-function-declaration
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
# -Os # size optimization
|
||||||
|
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||||
|
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
|
||||||
|
# -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
|
||||||
|
# -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
|
||||||
|
# -sUSE_PTHREADS=1 # multithreading support
|
||||||
|
# -sWASM=0 # disable Web Assembly, emitted by default
|
||||||
|
# -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
|
||||||
|
# -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data
|
||||||
|
# -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
|
||||||
|
# -sMINIFY_HTML=0 # minify generated html from shell.html
|
||||||
|
# --profiling # include information for code profiling
|
||||||
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
|
# --source-map-base # allow debugging in browser with source map
|
||||||
|
# --shell-file shell.html # define a custom shell .html and output extension
|
||||||
|
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
||||||
|
CFLAGS += --profiling
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
# Compiler flags for arquitecture
|
||||||
|
ifeq ($(ANDROID_ARCH),arm)
|
||||||
|
CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),arm64)
|
||||||
|
CFLAGS += -mfix-cortex-a53-835769
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86)
|
||||||
|
CFLAGS += -march=i686
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86_64)
|
||||||
|
CFLAGS += -march=x86-64
|
||||||
|
endif
|
||||||
|
# Compilation functions attributes options
|
||||||
|
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIE -fPIC
|
||||||
|
# Compiler options for the linker
|
||||||
|
# -Werror=format-security
|
||||||
|
CFLAGS += -Wa,--noexecstack -Wformat -no-canonical-prefixes
|
||||||
|
# Preprocessor macro definitions
|
||||||
|
CFLAGS += -D__ANDROID__ -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define required compilation flags for raylib SHARED lib
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
# make sure code is compiled as position independent
|
||||||
|
# BE CAREFUL: It seems that for gcc -fpic is not the same as -fPIC
|
||||||
|
# MinGW32 just doesn't need -fPIC, it shows warnings
|
||||||
|
CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED
|
||||||
|
|
||||||
|
# hide all symbols by default, so RLAPI can expose them
|
||||||
|
ifeq ($(PLATFORM_OS),$(filter $(PLATFORM_OS), LINUX BSD OSX))
|
||||||
|
CFLAGS += -fvisibility=hidden
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
# without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in
|
||||||
|
# which contains a conflicting type Font
|
||||||
|
CFLAGS += -DEGL_NO_X11
|
||||||
|
CFLAGS += -Werror=implicit-function-declaration
|
||||||
|
endif
|
||||||
|
# Use Wayland display on Linux desktop
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
ifeq ($(PLATFORM_OS), LINUX)
|
||||||
|
ifeq ($(GLFW_LINUX_ENABLE_X11),TRUE)
|
||||||
|
CFLAGS += -D_GLFW_X11
|
||||||
|
endif
|
||||||
|
ifeq ($(GLFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
|
CFLAGS += -D_GLFW_WAYLAND
|
||||||
|
|
||||||
|
WL_PROTOCOLS_DIR := external/glfw/deps/wayland
|
||||||
|
|
||||||
|
wl_generate = \
|
||||||
|
$(eval protocol=$(1)) \
|
||||||
|
$(eval basename=$(2)) \
|
||||||
|
$(shell wayland-scanner client-header $(protocol) $(RAYLIB_SRC_PATH)/$(basename).h) \
|
||||||
|
$(shell wayland-scanner private-code $(protocol) $(RAYLIB_SRC_PATH)/$(basename)-code.h)
|
||||||
|
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/wayland.xml, wayland-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-shell.xml, xdg-shell-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-decoration-unstable-v1.xml, xdg-decoration-unstable-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/viewporter.xml, viewporter-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/relative-pointer-unstable-v1.xml, relative-pointer-unstable-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/pointer-constraints-unstable-v1.xml, pointer-constraints-unstable-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/fractional-scale-v1.xml, fractional-scale-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-activation-v1.xml, xdg-activation-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/idle-inhibit-unstable-v1.xml, idle-inhibit-unstable-v1-client-protocol)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
# Use Wayland display on Linux desktop
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||||
|
ifeq ($(PLATFORM_OS), LINUX)
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_X11),TRUE)
|
||||||
|
CFLAGS += -DRGFW_X11 -DRGFW_UNIX
|
||||||
|
endif
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
|
CFLAGS += -DRGFW_WAYLAND -DEGLAPIENTRY=
|
||||||
|
|
||||||
|
WL_PROTOCOLS_DIR := external/RGFW/deps/wayland
|
||||||
|
|
||||||
|
wl_generate = \
|
||||||
|
$(eval protocol=$(1)) \
|
||||||
|
$(eval basename=$(2)) \
|
||||||
|
$(shell wayland-scanner client-header $(protocol) $(RAYLIB_SRC_PATH)/$(basename).h) \
|
||||||
|
$(shell wayland-scanner private-code $(protocol) $(RAYLIB_SRC_PATH)/$(basename)-code.c)
|
||||||
|
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/pointer-constraints-unstable-v1.xml, pointer-constraints-unstable-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/pointer-warp-v1.xml, pointer-warp-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/relative-pointer-unstable-v1.xml, relative-pointer-unstable-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-decoration-unstable-v1.xml, xdg-decoration-unstable-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-output-unstable-v1.xml, xdg-output-unstable-v1-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-shell.xml, xdg-shell-client-protocol)
|
||||||
|
$(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-toplevel-icon-v1.xml, xdg-toplevel-icon-v1-client-protocol)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += $(CUSTOM_CFLAGS)
|
||||||
|
|
||||||
|
# Define include paths for required headers: INCLUDE_PATHS
|
||||||
|
# NOTE: Several external required libraries (stb and others)
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
INCLUDE_PATHS = -I. $(EXTRA_INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Define additional directories containing required header files
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
INCLUDE_PATHS += -Iexternal/glfw/include
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
INCLUDE_PATHS += -I/usr/local/include -I/usr/pkg/include -I/usr/X11R7/include
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||||
|
INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH)
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||||
|
INCLUDE_PATHS += -Iexternal/glfw/include
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
INCLUDE_PATHS += -I/usr/include/libdrm
|
||||||
|
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
|
||||||
|
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include
|
||||||
|
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue
|
||||||
|
# Include android_native_app_glue.h
|
||||||
|
INCLUDE_PATHS += -I$(NATIVE_APP_GLUE)
|
||||||
|
|
||||||
|
# Android required libraries
|
||||||
|
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include
|
||||||
|
ifeq ($(ANDROID_ARCH),arm)
|
||||||
|
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/arm-linux-androideabi
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),arm64)
|
||||||
|
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/aarch64-linux-android
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86)
|
||||||
|
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/i686-linux-android
|
||||||
|
endif
|
||||||
|
ifeq ($(ANDROID_ARCH),x86_64)
|
||||||
|
INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/x86_64-linux-android
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define library paths containing required libs: LDFLAGS
|
||||||
|
# NOTE: This is only required for dynamic library generation
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
LDFLAGS = $(CUSTOM_LDFLAGS) -L. -L$(RAYLIB_RELEASE_PATH)
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_DESKTOP_WIN32))
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
ifneq ($(CC), tcc)
|
||||||
|
LDFLAGS += -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME)dll.a
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
LDFLAGS += -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION)
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so -Lsrc -L/usr/local/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||||
|
LDFLAGS += -L$(SDL_LIBRARY_PATH)
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
||||||
|
LDFLAGS += -sASSERTIONS=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
|
||||||
|
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
|
||||||
|
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
LDFLAGS += -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -Wl,--exclude-libs,libatomic.a
|
||||||
|
LDFLAGS += -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings
|
||||||
|
# Force linking of library module to define symbol
|
||||||
|
LDFLAGS += -u ANativeActivity_onCreate
|
||||||
|
# Library paths containing required libs
|
||||||
|
LDFLAGS += -Lsrc
|
||||||
|
# Avoid unresolved symbol pointing to external main()
|
||||||
|
LDFLAGS += -Wl,-undefined,dynamic_lookup
|
||||||
|
# Wrap fopen at link time so all code (including third-party libs) goes
|
||||||
|
# through __wrap_fopen, which handles Android APK asset loading
|
||||||
|
LDFLAGS += -Wl,--wrap=fopen
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define libraries required on linking: LDLIBS
|
||||||
|
# NOTE: This is only required for dynamic library generation
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
ifeq ($(CC), tcc)
|
||||||
|
LDLIBS = -lopengl32 -lgdi32 -lwinmm -lshell32
|
||||||
|
else
|
||||||
|
LDLIBS = -static-libgcc -lopengl32 -lgdi32 -lwinmm
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
LDLIBS = -lGL -lc -lm -lpthread -ldl -lrt
|
||||||
|
ifeq ($(GLFW_LINUX_ENABLE_X11),TRUE)
|
||||||
|
LDLIBS += -lX11
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(GLFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
|
LDFLAGS += $(shell pkg-config wayland-client wayland-cursor wayland-egl xkbcommon --libs)
|
||||||
|
endif
|
||||||
|
# TODO: On ARM 32bit arch, miniaudio requires atomics library
|
||||||
|
#LDLIBS += -latomic
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
LDLIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
LDLIBS = -lGL -lpthread
|
||||||
|
endif
|
||||||
|
ifeq ($(USE_EXTERNAL_GLFW),TRUE)
|
||||||
|
# Check the version name. If GLFW3 was built manually, it may have produced
|
||||||
|
# a static library known as libglfw3.a. In that case, the name should be -lglfw3
|
||||||
|
LDLIBS = -lglfw
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
LDLIBS = -static-libgcc -lopengl32 -lgdi32
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
LDLIBS = -lGL -lc -lm -lpthread -ldl -lrt
|
||||||
|
ifeq ($(USE_WAYLAND_DISPLAY),FALSE)
|
||||||
|
LDLIBS += -lX11
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
LDLIBS += $(SDL_LIBRARIES)
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# Libraries for Windows desktop compilation
|
||||||
|
LDLIBS = -lgdi32 -lwinmm -lopengl32
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# Libraries for Debian GNU/Linux desktop compipling
|
||||||
|
# NOTE: Required packages: libegl1-mesa-dev
|
||||||
|
LDLIBS = -lm
|
||||||
|
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_X11),TRUE)
|
||||||
|
LDLIBS += -lGL -lX11 -lXrandr -lXinerama -lXi -lXcursor -lpthread -ldl -lrt
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
|
LDFLAGS += $(shell pkg-config wayland-client wayland-cursor wayland-egl xkbcommon --libs)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Explicit link to libc
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
LDLIBS += -lc
|
||||||
|
endif
|
||||||
|
|
||||||
|
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
|
||||||
|
LDLIBS += -latomic
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
# Libraries for Debian MacOS desktop compiling
|
||||||
|
# NOTE: Required packages: libegl1-mesa-dev
|
||||||
|
LDLIBS += -lm -framework Foundation -framework AppKit -framework IOKit -framework OpenGL -framework CoreVideo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
LDLIBS = -ldrm -lgbm -lpthread -lrt -lm -ldl
|
||||||
|
ifeq ($(GRAPHICS),GRAPHICS_API_OPENGL_ES2)
|
||||||
|
LDLIBS += -lGLESv2 -lEGL
|
||||||
|
endif
|
||||||
|
ifeq ($(RAYLIB_MODULE_AUDIO),TRUE)
|
||||||
|
LDLIBS += -latomic
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
|
||||||
|
LDLIBS = -lgdi32 -lwinmm -lshcore
|
||||||
|
ifneq ($(GRAPHICS),GRAPHICS_API_OPENGL_SOFTWARE)
|
||||||
|
LDLIBS += -lopengl32
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define source code object files required
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
OBJS = rcore.o \
|
||||||
|
rshapes.o \
|
||||||
|
rtextures.o \
|
||||||
|
rtext.o
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
||||||
|
OBJS += rglfw.o
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
|
PROTOCOL_CODE_FILES = \
|
||||||
|
pointer-constraints-unstable-v1-client-protocol-code \
|
||||||
|
pointer-warp-v1-client-protocol-code \
|
||||||
|
relative-pointer-unstable-v1-client-protocol-code \
|
||||||
|
xdg-decoration-unstable-v1-client-protocol-code \
|
||||||
|
xdg-output-unstable-v1-client-protocol-code \
|
||||||
|
xdg-shell-client-protocol-code \
|
||||||
|
xdg-toplevel-icon-v1-client-protocol-code
|
||||||
|
|
||||||
|
PROTO_OBJS = $(addsuffix .o, $(PROTOCOL_CODE_FILES))
|
||||||
|
OBJS += $(PROTO_OBJS)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(RAYLIB_MODULE_MODELS),TRUE)
|
||||||
|
OBJS += rmodels.o
|
||||||
|
endif
|
||||||
|
ifeq ($(RAYLIB_MODULE_AUDIO),TRUE)
|
||||||
|
OBJS += raudio.o
|
||||||
|
endif
|
||||||
|
ifeq ($(RAYLIB_MODULE_RAYGUI),TRUE)
|
||||||
|
OBJS += raygui.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
OBJS += android_native_app_glue.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Define processes to execute
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
# Default target entry
|
||||||
|
all: raylib
|
||||||
|
|
||||||
|
# Compile raylib library
|
||||||
|
# NOTE: Release directory is created if not exist
|
||||||
|
raylib: $(OBJS)
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
|
# Compile raylib libray for web
|
||||||
|
#$(CC) $(OBJS) -r -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
@echo "WARNING: $(TARGET_PLATFORM) does not support SHARED libraries. Generating STATIC library."
|
||||||
|
endif
|
||||||
|
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).web.a $(OBJS)
|
||||||
|
@echo "raylib library generated (lib$(RAYLIB_LIB_NAME).web.a)!"
|
||||||
|
else
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
# NOTE: Linking with provided resource file
|
||||||
|
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS)
|
||||||
|
@echo "raylib dynamic library ($(RAYLIB_LIB_NAME).dll) and import library (lib$(RAYLIB_LIB_NAME)dll.a) generated!"
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# Compile raylib shared library version $(RAYLIB_VERSION).
|
||||||
|
# WARNING: you should type "make clean" before doing this target
|
||||||
|
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||||
|
@echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!"
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
$(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||||
|
install_name_tool -id "@rpath/lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).dylib" $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib
|
||||||
|
@echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib)!"
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).dylib
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib lib$(RAYLIB_LIB_NAME).dylib
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
|
# WARNING: you should type "gmake clean" before doing this target
|
||||||
|
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||||
|
@echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!"
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
|
# Compile raylib shared library version $(RAYLIB_VERSION).
|
||||||
|
# WARNING: you should type "make clean" before doing this target
|
||||||
|
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||||
|
@echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!"
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||||
|
@echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!"
|
||||||
|
# WARNING: symbolic links creation on Windows should be done using mklink command, no ln available
|
||||||
|
ifeq ($(HOST_PLATFORM_OS),LINUX)
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
# Compile raylib static library version $(RAYLIB_VERSION)
|
||||||
|
# WARNING: You should type "make clean" before doing this target.
|
||||||
|
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS)
|
||||||
|
@echo "raylib static library generated (lib$(RAYLIB_LIB_NAME).a) in $(RAYLIB_RELEASE_PATH)!"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Compile all modules with their prerequisites
|
||||||
|
|
||||||
|
# Prerequisites of core module
|
||||||
|
rcore.o : platforms/*.c
|
||||||
|
|
||||||
|
# Compile core module
|
||||||
|
rcore.o : rcore.c raylib.h rlgl.h raymath.h rcamera.h rgestures.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Compile rglfw module
|
||||||
|
rglfw.o : rglfw.c
|
||||||
|
$(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS) -U_GNU_SOURCE
|
||||||
|
|
||||||
|
# Compile shapes module
|
||||||
|
rshapes.o : rshapes.c raylib.h rlgl.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Compile textures module
|
||||||
|
rtextures.o : rtextures.c raylib.h rlgl.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Compile text module
|
||||||
|
rtext.o : rtext.c raylib.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Compile models module
|
||||||
|
rmodels.o : rmodels.c raylib.h rlgl.h raymath.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Compile audio module
|
||||||
|
raudio.o : raudio.c raylib.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Compile raygui module
|
||||||
|
# NOTE: raygui header should be distributed with raylib.h
|
||||||
|
raygui.o : raygui.c
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
raygui.c:
|
||||||
|
ifeq ($(PLATFORM_SHELL), cmd)
|
||||||
|
@echo #define RAYGUI_IMPLEMENTATION > raygui.c
|
||||||
|
@echo #include "$(RAYLIB_MODULE_RAYGUI_PATH)/raygui.h" >> raygui.c
|
||||||
|
else
|
||||||
|
@echo "#define RAYGUI_IMPLEMENTATION" > raygui.c
|
||||||
|
@echo "#include \"$(RAYLIB_MODULE_RAYGUI_PATH)/raygui.h\"" >> raygui.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Compile android_native_app_glue module
|
||||||
|
android_native_app_glue.o : $(NATIVE_APP_GLUE)/android_native_app_glue.c
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
# Compile Wayland files
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||||
|
ifeq ($(RGFW_LINUX_ENABLE_WAYLAND),TRUE)
|
||||||
|
%-client-protocol-code.o: %-client-protocol-code.c
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
%-client-protocol-code.h: external/RGFW/deps/wayland/%.xml
|
||||||
|
wayland-scanner private-code $< $@
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Install generated and needed files to desired directories.
|
||||||
|
# On GNU/Linux and BSDs, there are some standard directories that contain extra
|
||||||
|
# libraries and header files. These directories (often /usr/local/lib and
|
||||||
|
# /usr/local/include) are for libraries that are installed manually
|
||||||
|
# (without a package manager). We'll use /usr/local/lib/raysan5 and /usr/local/include/raysan5
|
||||||
|
# for our -L and -I specification to simplify management of the raylib source package.
|
||||||
|
# Customize these locations if you like but don't forget to pass them to make
|
||||||
|
# for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig.
|
||||||
|
# HINT: Add -L$(RAYLIB_INSTALL_PATH) -I$(RAYLIB_H_INSTALL_PATH) to your own makefiles.
|
||||||
|
# See below and ../examples/Makefile for more information.
|
||||||
|
|
||||||
|
# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths.
|
||||||
|
DESTDIR ?= /usr/local
|
||||||
|
RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib
|
||||||
|
# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files.
|
||||||
|
RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include
|
||||||
|
|
||||||
|
install :
|
||||||
|
ifeq ($(ROOT),root)
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# Attention! You are root, writing files to $(RAYLIB_INSTALL_PATH)
|
||||||
|
# and $(RAYLIB_H_INSTALL_PATH). Consult this Makefile for more information.
|
||||||
|
# Prepare the environment as needed.
|
||||||
|
mkdir --parents --verbose $(RAYLIB_INSTALL_PATH)
|
||||||
|
mkdir --parents --verbose $(RAYLIB_H_INSTALL_PATH)
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
# Installing raylib to $(RAYLIB_INSTALL_PATH).
|
||||||
|
cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(RAYLIB_INSTALL_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)
|
||||||
|
cd $(RAYLIB_INSTALL_PATH); ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
|
||||||
|
cd $(RAYLIB_INSTALL_PATH); ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
|
||||||
|
# Uncomment to update the runtime linker cache with RAYLIB_INSTALL_PATH.
|
||||||
|
# Not necessary if later embedding RPATH in your executable. See examples/Makefile.
|
||||||
|
ldconfig $(RAYLIB_INSTALL_PATH)
|
||||||
|
else
|
||||||
|
# Installing raylib to $(RAYLIB_INSTALL_PATH).
|
||||||
|
cp --update --verbose $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_INSTALL_PATH)/lib$(RAYLIB_LIB_NAME).a
|
||||||
|
endif
|
||||||
|
# Copying raylib development files to $(RAYLIB_H_INSTALL_PATH).
|
||||||
|
cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
||||||
|
cp --update raymath.h $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
||||||
|
cp --update rcamera.h $(RAYLIB_H_INSTALL_PATH)/rcamera.h
|
||||||
|
cp --update rlgl.h $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
||||||
|
@echo "raylib development files installed/updated!"
|
||||||
|
else
|
||||||
|
@echo "This function currently works on GNU/Linux systems. Add yours today (^;"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
@echo "ERROR: Root permissions needed for installation. Try sudo make install" && exit 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Remove raylib dev files installed on the system
|
||||||
|
# NOTE: see 'install' target.
|
||||||
|
uninstall :
|
||||||
|
ifeq ($(ROOT),root)
|
||||||
|
# WARNING: You are root, about to delete items from $(RAYLIB_INSTALL_PATH).
|
||||||
|
# and $(RAYLIB_H_INSTALL_PATH). Please confirm each item.
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_API_VERSION)
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION)
|
||||||
|
# Uncomment to clean up the runtime linker cache. See install target.
|
||||||
|
ldconfig
|
||||||
|
else
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.a
|
||||||
|
endif
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rcamera.h
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
||||||
|
@echo "raylib development files removed!"
|
||||||
|
else
|
||||||
|
@echo "This function currently works on GNU/Linux systems. Add yours today (^;"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
@echo "ERROR: Root permissions needed for uninstallation. Try sudo make uninstall" && exit 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: clean_shell_cmd clean_shell_sh
|
||||||
|
|
||||||
|
# Clean everything
|
||||||
|
clean: clean_shell_$(PLATFORM_SHELL)
|
||||||
|
@echo "removed all generated files!"
|
||||||
|
|
||||||
|
clean_shell_sh:
|
||||||
|
rm -fv *.o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).web.a $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so* raygui.c $(RAYLIB_RELEASE_PATH)/*-protocol.h $(RAYLIB_RELEASE_PATH)/*-protocol-code.h $(RAYLIB_RELEASE_PATH)/*-protocol-code.c
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
|
rm -fv $(NATIVE_APP_GLUE)/android_native_app_glue.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Set specific target variable
|
||||||
|
clean_shell_cmd: SHELL=cmd
|
||||||
|
clean_shell_cmd:
|
||||||
|
del *.o /s
|
||||||
|
cd $(RAYLIB_RELEASE_PATH) & \
|
||||||
|
del lib$(RAYLIB_LIB_NAME).a /s & \
|
||||||
|
del lib$(RAYLIB_LIB_NAME).web.a /s & \
|
||||||
|
del lib$(RAYLIB_LIB_NAME)dll.a /s & \
|
||||||
|
del $(RAYLIB_LIB_NAME).dll /s & \
|
||||||
|
del raygui.c /s & \
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib configuration flags
|
||||||
|
*
|
||||||
|
* This file defines the configuration flags for different raylib features per-module
|
||||||
|
*
|
||||||
|
* NOTE: Additional values are configured per-module and can be set on compile time
|
||||||
|
*
|
||||||
|
* LICENSE: zlib/libpng
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2026 Ahmad Fatoum and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
|
* will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||||
|
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||||
|
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||||
|
* in the product documentation would be appreciated but is not required.
|
||||||
|
*
|
||||||
|
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||||
|
* as being the original software.
|
||||||
|
*
|
||||||
|
* 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module selection - Some modules could be avoided
|
||||||
|
// Mandatory modules: rcore, rlgl
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef SUPPORT_MODULE_RSHAPES
|
||||||
|
#define SUPPORT_MODULE_RSHAPES 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RTEXTURES
|
||||||
|
#define SUPPORT_MODULE_RTEXTURES 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RTEXT
|
||||||
|
#define SUPPORT_MODULE_RTEXT 1 // WARNING: It requires SUPPORT_MODULE_RTEXTURES to load sprite font textures
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RMODELS
|
||||||
|
#define SUPPORT_MODULE_RMODELS 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RAUDIO
|
||||||
|
#define SUPPORT_MODULE_RAUDIO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rcore - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef SUPPORT_TRACELOG
|
||||||
|
// Show TRACELOG() output messages
|
||||||
|
#define SUPPORT_TRACELOG 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_CAMERA_SYSTEM
|
||||||
|
// Camera module is included (rcamera.h) and multiple predefined
|
||||||
|
// cameras are available: free, 1st/3rd person, orbital
|
||||||
|
#define SUPPORT_CAMERA_SYSTEM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_GESTURES_SYSTEM
|
||||||
|
// Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag
|
||||||
|
#define SUPPORT_GESTURES_SYSTEM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_RPRAND_GENERATOR
|
||||||
|
// Include pseudo-random numbers generator (rprand.h), based on Xoshiro128** and SplitMix64
|
||||||
|
#define SUPPORT_RPRAND_GENERATOR 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MOUSE_GESTURES
|
||||||
|
// Mouse gestures are directly mapped like touches and processed by gestures system
|
||||||
|
#define SUPPORT_MOUSE_GESTURES 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_SSH_KEYBOARD_RPI
|
||||||
|
// Reconfigure standard input to receive key inputs, works with SSH connection
|
||||||
|
#define SUPPORT_SSH_KEYBOARD_RPI 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_WINMM_HIGHRES_TIMER
|
||||||
|
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions
|
||||||
|
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often
|
||||||
|
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
||||||
|
#endif
|
||||||
|
#if !SUPPORT_BUSY_WAIT_LOOP && !SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||||
|
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is set up and used
|
||||||
|
#define SUPPORT_BUSY_WAIT_LOOP 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#if !SUPPORT_PARTIALBUSY_WAIT_LOOP && !SUPPORT_BUSY_WAIT_LOOP
|
||||||
|
// Use a partial-busy wait loop, in this case frame sleeps for most of the time,
|
||||||
|
// but then runs a busy loop at the end for accuracy
|
||||||
|
#define SUPPORT_PARTIALBUSY_WAIT_LOOP 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_SCREEN_CAPTURE
|
||||||
|
// Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
|
||||||
|
// WARNING: It requires SUPPORT_FILEFORMAT_PNG flag
|
||||||
|
#define SUPPORT_SCREEN_CAPTURE 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_COMPRESSION_API
|
||||||
|
// Support CompressData() and DecompressData() functions
|
||||||
|
#define SUPPORT_COMPRESSION_API 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_AUTOMATION_EVENTS
|
||||||
|
// Support automatic generated events, loading and recording of those events when required
|
||||||
|
#define SUPPORT_AUTOMATION_EVENTS 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_CUSTOM_FRAME_CONTROL
|
||||||
|
// Support custom frame control, only for advanced users
|
||||||
|
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||||
|
// Enabling this flag allows manual control of the frame processes, use at your own risk
|
||||||
|
#define SUPPORT_CUSTOM_FRAME_CONTROL 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_CLIPBOARD_IMAGE
|
||||||
|
// Support for clipboard image loading
|
||||||
|
// NOTE: Only working on SDL3, GLFW (Windows) and RGFW (Windows)
|
||||||
|
// WARNING: It requires support for some additional flags:
|
||||||
|
// - SUPPORT_MODULE_RTEXTURES
|
||||||
|
// - SUPPORT_FILEFORMAT_BMP (Windows clipboard)
|
||||||
|
// - SUPPORT_FILEFORMAT_PNG (Wayland clipboard)
|
||||||
|
// - SUPPORT_FILEFORMAT_JPG
|
||||||
|
#define SUPPORT_CLIPBOARD_IMAGE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// rcore: Configuration values
|
||||||
|
// NOTE: Below values are alread defined inside [rcore.c] so there is no need to be
|
||||||
|
// redefined here, in case it must be done, uncomment the required line and update
|
||||||
|
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
//#define MAX_TRACELOG_MSG_LENGTH 256 // Max length of one trace-log message
|
||||||
|
//#define MAX_FILEPATH_CAPACITY 8192 // Maximum file paths capacity
|
||||||
|
//#define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value)
|
||||||
|
//#define MAX_KEYBOARD_KEYS 512 // Maximum number of keyboard keys supported
|
||||||
|
//#define MAX_MOUSE_BUTTONS 8 // Maximum number of mouse buttons supported
|
||||||
|
//#define MAX_GAMEPADS 4 // Maximum number of gamepads supported
|
||||||
|
//#define MAX_GAMEPAD_AXES 8 // Maximum number of axes supported (per gamepad)
|
||||||
|
//#define MAX_GAMEPAD_BUTTONS 32 // Maximum number of buttons supported (per gamepad)
|
||||||
|
//#define MAX_GAMEPAD_VIBRATION_TIME 2.0f // Maximum vibration time in seconds
|
||||||
|
//#define MAX_TOUCH_POINTS 10 // Maximum number of touch points supported
|
||||||
|
//#define MAX_KEY_PRESSED_QUEUE 16 // Maximum number of keys in the key input queue
|
||||||
|
//#define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue
|
||||||
|
//#define MAX_DECOMPRESSION_SIZE 64 // Max size allocated for decompression in MB
|
||||||
|
//#define MAX_AUTOMATION_EVENTS 16384 // Maximum number of automation events to record
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rlgl - Configuration values
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef RLGL_ENABLE_OPENGL_DEBUG_CONTEXT
|
||||||
|
// Request OpenGL debug context (only available on OpenGL 4.3)
|
||||||
|
#define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT 0
|
||||||
|
#endif
|
||||||
|
#ifndef RLGL_SHOW_GL_DETAILS_INFO
|
||||||
|
// Show OpenGL detailed info on initialization,
|
||||||
|
// supported GL extensions and GL capabilities
|
||||||
|
#define RLGL_SHOW_GL_DETAILS_INFO 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// rlgl: Configuration values
|
||||||
|
// NOTE: Below values are alread defined inside [rlgl.h] so there is no need to be
|
||||||
|
// redefined here, in case it must be done, uncomment the required line and update
|
||||||
|
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
//#define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 4096 // Default internal render batch elements limits
|
||||||
|
//#define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||||
|
//#define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||||
|
//#define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||||
|
//#define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||||
|
//#define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||||
|
//#define RL_CULL_DISTANCE_NEAR 0.05 // Default projection matrix near cull distance
|
||||||
|
//#define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance
|
||||||
|
|
||||||
|
// Default shader vertex attribute locations
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 7
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM 9
|
||||||
|
|
||||||
|
// Default shader vertex attribute/uniform names to set location points
|
||||||
|
// NOTE: When a new shader is loaded, locations are tried to be set for convenience, looking for the names defined here
|
||||||
|
// In case custom shader names are used, it's up to the user to set locations with GetShaderLocation*() functions
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (tint color, multiplied by texture color)
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices
|
||||||
|
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||||
|
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||||
|
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rshapes - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef SUPPORT_QUADS_DRAW_MODE
|
||||||
|
// Use QUADS instead of TRIANGLES for drawing when possible
|
||||||
|
// Some lines-based shapes could still use lines
|
||||||
|
#define SUPPORT_QUADS_DRAW_MODE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rtextures - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Selected desired fileformats to be supported for image data loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PNG
|
||||||
|
#define SUPPORT_FILEFORMAT_PNG 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_BMP
|
||||||
|
// NOTE: BMP support required for clipboard images on Windows
|
||||||
|
#define SUPPORT_FILEFORMAT_BMP 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_TGA
|
||||||
|
#define SUPPORT_FILEFORMAT_TGA 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_JPG
|
||||||
|
#define SUPPORT_FILEFORMAT_JPG 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_GIF
|
||||||
|
#define SUPPORT_FILEFORMAT_GIF 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_QOI
|
||||||
|
#define SUPPORT_FILEFORMAT_QOI 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PSD
|
||||||
|
#define SUPPORT_FILEFORMAT_PSD 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_DDS
|
||||||
|
#define SUPPORT_FILEFORMAT_DDS 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_HDR
|
||||||
|
#define SUPPORT_FILEFORMAT_HDR 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PIC
|
||||||
|
#define SUPPORT_FILEFORMAT_PIC 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_KTX
|
||||||
|
#define SUPPORT_FILEFORMAT_KTX 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_ASTC
|
||||||
|
#define SUPPORT_FILEFORMAT_ASTC 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PKM
|
||||||
|
#define SUPPORT_FILEFORMAT_PKM 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PVR
|
||||||
|
#define SUPPORT_FILEFORMAT_PVR 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SUPPORT_IMAGE_EXPORT
|
||||||
|
// Support image export functionality (.png, .bmp, .tga, .jpg, .qoi)
|
||||||
|
// NOTE: Image export requires stb_image_write.h library
|
||||||
|
#define SUPPORT_IMAGE_EXPORT 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_IMAGE_GENERATION
|
||||||
|
// Support procedural image generation functionality: gradient, spot, perlin-noise, cellular...
|
||||||
|
// NOTE: Perlin noise requires stb_perlin.h library
|
||||||
|
#define SUPPORT_IMAGE_GENERATION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rtext - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Selected desired font fileformats to be supported for loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_TTF
|
||||||
|
#define SUPPORT_FILEFORMAT_TTF 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_FNT
|
||||||
|
#define SUPPORT_FILEFORMAT_FNT 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_BDF
|
||||||
|
#define SUPPORT_FILEFORMAT_BDF 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rmodels - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Selected desired model fileformats to be supported for loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_OBJ
|
||||||
|
#define SUPPORT_FILEFORMAT_OBJ 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_MTL
|
||||||
|
#define SUPPORT_FILEFORMAT_MTL 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_IQM
|
||||||
|
#define SUPPORT_FILEFORMAT_IQM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_GLTF
|
||||||
|
#define SUPPORT_FILEFORMAT_GLTF 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_VOX
|
||||||
|
#define SUPPORT_FILEFORMAT_VOX 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_M3D
|
||||||
|
#define SUPPORT_FILEFORMAT_M3D 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MESH_GENERATION
|
||||||
|
// Support procedural mesh generation functions, uses external par_shapes.h library
|
||||||
|
// NOTE: Some generated meshes DO NOT include generated texture coordinates
|
||||||
|
#define SUPPORT_MESH_GENERATION 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_GPU_SKINNING
|
||||||
|
// GPU skinning disabled by default, some GPUs do not support more than 8 VBOs
|
||||||
|
#define SUPPORT_GPU_SKINNING 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: raudio - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Desired audio fileformats to be supported for loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_WAV
|
||||||
|
#define SUPPORT_FILEFORMAT_WAV 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_OGG
|
||||||
|
#define SUPPORT_FILEFORMAT_OGG 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_MP3
|
||||||
|
#define SUPPORT_FILEFORMAT_MP3 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_QOA
|
||||||
|
#define SUPPORT_FILEFORMAT_QOA 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_FLAC
|
||||||
|
#define SUPPORT_FILEFORMAT_FLAC 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_XM
|
||||||
|
#define SUPPORT_FILEFORMAT_XM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_MOD
|
||||||
|
#define SUPPORT_FILEFORMAT_MOD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// raudio: Configuration values
|
||||||
|
// NOTE: Below values are alread defined inside [rlgl.h] so there is no need to be
|
||||||
|
// redefined here, in case it must be done, uncomment the required line and update
|
||||||
|
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
//#define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit)
|
||||||
|
//#define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo
|
||||||
|
//#define AUDIO_DEVICE_SAMPLE_RATE 0 // Device sample rate (device default)
|
||||||
|
//#define AUDIO_DEVICE_PERIOD_SIZE_IN_FRAMES 0 // Device period size (controls latency, 0 defaults to 10ms)
|
||||||
|
//#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Maximum number of audio pool channels
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#endif // !EXTERNAL_CONFIG_FLAGS
|
||||||
|
|
||||||
|
// NOTE: Following macro depends on config flag that can
|
||||||
|
// be externally defined, so, it needs to be outside EXTERNAL_CONFIG_FLAGS
|
||||||
|
#if SUPPORT_TRACELOG
|
||||||
|
#define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define TRACELOG(level, ...) (void)0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // CONFIG_H
|
||||||
+15891
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+334
@@ -0,0 +1,334 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="pointer_constraints_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for constraining pointer motions">
|
||||||
|
This protocol specifies a set of interfaces used for adding constraints to
|
||||||
|
the motion of a pointer. Possible constraints include confining pointer
|
||||||
|
motions to a given region, or locking it to its current position.
|
||||||
|
|
||||||
|
In order to constrain the pointer, a client must first bind the global
|
||||||
|
interface "wp_pointer_constraints" which, if a compositor supports pointer
|
||||||
|
constraints, is exposed by the registry. Using the bound global object, the
|
||||||
|
client uses the request that corresponds to the type of constraint it wants
|
||||||
|
to make. See wp_pointer_constraints for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_pointer_constraints_v1" version="1">
|
||||||
|
<description summary="constrain the movement of a pointer">
|
||||||
|
The global interface exposing pointer constraining functionality. It
|
||||||
|
exposes two requests: lock_pointer for locking the pointer to its
|
||||||
|
position, and confine_pointer for locking the pointer to a region.
|
||||||
|
|
||||||
|
The lock_pointer and confine_pointer requests create the objects
|
||||||
|
wp_locked_pointer and wp_confined_pointer respectively, and the client can
|
||||||
|
use these objects to interact with the lock.
|
||||||
|
|
||||||
|
For any surface, only one lock or confinement may be active across all
|
||||||
|
wl_pointer objects of the same seat. If a lock or confinement is requested
|
||||||
|
when another lock or confinement is active or requested on the same surface
|
||||||
|
and with any of the wl_pointer objects of the same seat, an
|
||||||
|
'already_constrained' error will be raised.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<description summary="wp_pointer_constraints error values">
|
||||||
|
These errors can be emitted in response to wp_pointer_constraints
|
||||||
|
requests.
|
||||||
|
</description>
|
||||||
|
<entry name="already_constrained" value="1"
|
||||||
|
summary="pointer constraint already requested on that surface"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<enum name="lifetime">
|
||||||
|
<description summary="constraint lifetime">
|
||||||
|
These values represent different lifetime semantics. They are passed
|
||||||
|
as arguments to the factory requests to specify how the constraint
|
||||||
|
lifetimes should be managed.
|
||||||
|
</description>
|
||||||
|
<entry name="oneshot" value="1">
|
||||||
|
<description summary="the pointer constraint is defunct once deactivated">
|
||||||
|
A oneshot pointer constraint will never reactivate once it has been
|
||||||
|
deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="persistent" value="2">
|
||||||
|
<description summary="the pointer constraint may reactivate">
|
||||||
|
A persistent pointer constraint may again reactivate once it has
|
||||||
|
been deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the pointer constraints manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
pointer constraints object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="lock_pointer">
|
||||||
|
<description summary="lock pointer to a position">
|
||||||
|
The lock_pointer request lets the client request to disable movements of
|
||||||
|
the virtual pointer (i.e. the cursor), effectively locking the pointer
|
||||||
|
to a position. This request may not take effect immediately; in the
|
||||||
|
future, when the compositor deems implementation-specific constraints
|
||||||
|
are satisfied, the pointer lock will be activated and the compositor
|
||||||
|
sends a locked event.
|
||||||
|
|
||||||
|
The protocol provides no guarantee that the constraints are ever
|
||||||
|
satisfied, and does not require the compositor to send an error if the
|
||||||
|
constraints cannot ever be satisfied. It is thus possible to request a
|
||||||
|
lock that will never activate.
|
||||||
|
|
||||||
|
There may not be another pointer constraint of any kind requested or
|
||||||
|
active on the surface for any of the wl_pointer objects of the seat of
|
||||||
|
the passed pointer when requesting a lock. If there is, an error will be
|
||||||
|
raised. See general pointer lock documentation for more details.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the lock to activate. It is up to the compositor whether to
|
||||||
|
warp the pointer or require some kind of user interaction for the lock
|
||||||
|
to activate. If the region is null the surface input region is used.
|
||||||
|
|
||||||
|
A surface may receive pointer focus without the lock being activated.
|
||||||
|
|
||||||
|
The request creates a new object wp_locked_pointer which is used to
|
||||||
|
interact with the lock as well as receive updates about its state. See
|
||||||
|
the the description of wp_locked_pointer for further information.
|
||||||
|
|
||||||
|
Note that while a pointer is locked, the wl_pointer objects of the
|
||||||
|
corresponding seat will not emit any wl_pointer.motion events, but
|
||||||
|
relative motion events will still be emitted via wp_relative_pointer
|
||||||
|
objects of the same seat. wl_pointer.axis and wl_pointer.button events
|
||||||
|
are unaffected.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be locked"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="confine_pointer">
|
||||||
|
<description summary="confine pointer to a region">
|
||||||
|
The confine_pointer request lets the client request to confine the
|
||||||
|
pointer cursor to a given region. This request may not take effect
|
||||||
|
immediately; in the future, when the compositor deems implementation-
|
||||||
|
specific constraints are satisfied, the pointer confinement will be
|
||||||
|
activated and the compositor sends a confined event.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the confinement to activate. It is up to the compositor
|
||||||
|
whether to warp the pointer or require some kind of user interaction for
|
||||||
|
the confinement to activate. If the region is null the surface input
|
||||||
|
region is used.
|
||||||
|
|
||||||
|
The request will create a new object wp_confined_pointer which is used
|
||||||
|
to interact with the confinement as well as receive updates about its
|
||||||
|
state. See the the description of wp_confined_pointer for further
|
||||||
|
information.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be confined"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_locked_pointer_v1" version="1">
|
||||||
|
<description summary="receive relative pointer motion events">
|
||||||
|
The wp_locked_pointer interface represents a locked pointer state.
|
||||||
|
|
||||||
|
While the lock of this object is active, the wl_pointer objects of the
|
||||||
|
associated seat will not emit any wl_pointer.motion events.
|
||||||
|
|
||||||
|
This object will send the event 'locked' when the lock is activated.
|
||||||
|
Whenever the lock is activated, it is guaranteed that the locked surface
|
||||||
|
will already have received pointer focus and that the pointer will be
|
||||||
|
within the region passed to the request creating this object.
|
||||||
|
|
||||||
|
To unlock the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_locked_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unlock the pointer the unlocked event is
|
||||||
|
sent. See wp_locked_pointer.unlock for details.
|
||||||
|
|
||||||
|
When unlocking, the compositor may warp the cursor position to the set
|
||||||
|
cursor position hint. If it does, it will not result in any relative
|
||||||
|
motion events emitted via wp_relative_pointer.
|
||||||
|
|
||||||
|
If the surface the lock was requested on is destroyed and the lock is not
|
||||||
|
yet activated, the wp_locked_pointer object is now defunct and must be
|
||||||
|
destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the locked pointer object">
|
||||||
|
Destroy the locked pointer object. If applicable, the compositor will
|
||||||
|
unlock the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_cursor_position_hint">
|
||||||
|
<description summary="set the pointer cursor position hint">
|
||||||
|
Set the cursor position hint relative to the top left corner of the
|
||||||
|
surface.
|
||||||
|
|
||||||
|
If the client is drawing its own cursor, it should update the position
|
||||||
|
hint to the position of its own cursor. A compositor may use this
|
||||||
|
information to warp the pointer upon unlock in order to avoid pointer
|
||||||
|
jumps.
|
||||||
|
|
||||||
|
The cursor position hint is double-buffered state, see
|
||||||
|
wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="surface_x" type="fixed"
|
||||||
|
summary="surface-local x coordinate"/>
|
||||||
|
<arg name="surface_y" type="fixed"
|
||||||
|
summary="surface-local y coordinate"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new lock region">
|
||||||
|
Set a new region used to lock the pointer.
|
||||||
|
|
||||||
|
The new lock region is double-buffered, see wl_surface.commit.
|
||||||
|
|
||||||
|
For details about the lock region, see wp_locked_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="locked">
|
||||||
|
<description summary="lock activation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unlocked">
|
||||||
|
<description summary="lock deactivation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is no longer
|
||||||
|
active. If this is a oneshot pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer lock may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_confined_pointer_v1" version="1">
|
||||||
|
<description summary="confined pointer object">
|
||||||
|
The wp_confined_pointer interface represents a confined pointer state.
|
||||||
|
|
||||||
|
This object will send the event 'confined' when the confinement is
|
||||||
|
activated. Whenever the confinement is activated, it is guaranteed that
|
||||||
|
the surface the pointer is confined to will already have received pointer
|
||||||
|
focus and that the pointer will be within the region passed to the request
|
||||||
|
creating this object. It is up to the compositor to decide whether this
|
||||||
|
requires some user interaction and if the pointer will warp to within the
|
||||||
|
passed region if outside.
|
||||||
|
|
||||||
|
To unconfine the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_confined_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unconfine the pointer the unconfined event is
|
||||||
|
sent. The wp_confined_pointer object is at this point defunct and should
|
||||||
|
be destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the confined pointer object">
|
||||||
|
Destroy the confined pointer object. If applicable, the compositor will
|
||||||
|
unconfine the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new confine region">
|
||||||
|
Set a new region used to confine the pointer.
|
||||||
|
|
||||||
|
The new confine region is double-buffered, see wl_surface.commit.
|
||||||
|
|
||||||
|
If the confinement is active when the new confinement region is applied
|
||||||
|
and the pointer ends up outside of newly applied region, the pointer may
|
||||||
|
warped to a position within the new confinement region. If warped, a
|
||||||
|
wl_pointer.motion event will be emitted, but no
|
||||||
|
wp_relative_pointer.relative_motion event.
|
||||||
|
|
||||||
|
The compositor may also, instead of using the new region, unconfine the
|
||||||
|
pointer.
|
||||||
|
|
||||||
|
For details about the confine region, see wp_confined_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="confined">
|
||||||
|
<description summary="pointer confined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is
|
||||||
|
activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unconfined">
|
||||||
|
<description summary="pointer unconfined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is no
|
||||||
|
longer active. If this is a oneshot pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer confinement may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="pointer_warp_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2024 Neal Gompa
|
||||||
|
Copyright © 2024 Xaver Hugl
|
||||||
|
Copyright © 2024 Matthias Klumpp
|
||||||
|
Copyright © 2024 Vlad Zahorodnii
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="wp_pointer_warp_v1" version="1">
|
||||||
|
<description summary="reposition the pointer to a location on a surface">
|
||||||
|
This global interface allows applications to request the pointer to be
|
||||||
|
moved to a position relative to a wl_surface.
|
||||||
|
|
||||||
|
Note that if the desired behavior is to constrain the pointer to an area
|
||||||
|
or lock it to a position, this protocol does not provide a reliable way
|
||||||
|
to do that. The pointer constraint and pointer lock protocols should be
|
||||||
|
used for those use cases instead.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is currently in the testing
|
||||||
|
phase. Backward compatible changes may be added together with the
|
||||||
|
corresponding interface version bump. Backward incompatible changes can
|
||||||
|
only be done by creating a new major version of the extension.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the warp manager">
|
||||||
|
Destroy the pointer warp manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="warp_pointer">
|
||||||
|
<description summary="reposition the pointer">
|
||||||
|
Request the compositor to move the pointer to a surface-local position.
|
||||||
|
Whether or not the compositor honors the request is implementation defined,
|
||||||
|
but it should
|
||||||
|
- honor it if the surface has pointer focus, including
|
||||||
|
when it has an implicit pointer grab
|
||||||
|
- reject it if the enter serial is incorrect
|
||||||
|
- reject it if the requested position is outside of the surface
|
||||||
|
|
||||||
|
Note that the enter serial is valid for any surface of the client,
|
||||||
|
and does not have to be from the surface the pointer is warped to.
|
||||||
|
|
||||||
|
</description>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to position the pointer on"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be repositioned"/>
|
||||||
|
<arg name="x" type="fixed"/>
|
||||||
|
<arg name="y" type="fixed"/>
|
||||||
|
<arg name="serial" type="uint" summary="serial number of the enter event"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="relative_pointer_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for relative pointer motion events">
|
||||||
|
This protocol specifies a set of interfaces used for making clients able to
|
||||||
|
receive relative pointer events not obstructed by barriers (such as the
|
||||||
|
monitor edge or other pointer barriers).
|
||||||
|
|
||||||
|
To start receiving relative pointer events, a client must first bind the
|
||||||
|
global interface "wp_relative_pointer_manager" which, if a compositor
|
||||||
|
supports relative pointer motion events, is exposed by the registry. After
|
||||||
|
having created the relative pointer manager proxy object, the client uses
|
||||||
|
it to create the actual relative pointer object using the
|
||||||
|
"get_relative_pointer" request given a wl_pointer. The relative pointer
|
||||||
|
motion events will then, when applicable, be transmitted via the proxy of
|
||||||
|
the newly created relative pointer object. See the documentation of the
|
||||||
|
relative pointer interface for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_manager_v1" version="1">
|
||||||
|
<description summary="get relative pointer objects">
|
||||||
|
A global interface used for getting the relative pointer object for a
|
||||||
|
given pointer.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the relative pointer manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
relative pointer manager object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_relative_pointer">
|
||||||
|
<description summary="get a relative pointer object">
|
||||||
|
Create a relative pointer interface given a wl_pointer object. See the
|
||||||
|
wp_relative_pointer interface for more details.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_v1" version="1">
|
||||||
|
<description summary="relative pointer object">
|
||||||
|
A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||||
|
used for emitting relative pointer events. It shares the same focus as
|
||||||
|
wl_pointer objects of the same seat and will only emit events when it has
|
||||||
|
focus.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="release the relative pointer object"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="relative_motion">
|
||||||
|
<description summary="relative pointer motion">
|
||||||
|
Relative x/y pointer motion from the pointer of the seat associated with
|
||||||
|
this object.
|
||||||
|
|
||||||
|
A relative motion is in the same dimension as regular wl_pointer motion
|
||||||
|
events, except they do not represent an absolute position. For example,
|
||||||
|
moving a pointer from (x, y) to (x', y') would have the equivalent
|
||||||
|
relative motion (x' - x, y' - y). If a pointer motion caused the
|
||||||
|
absolute pointer position to be clipped by for example the edge of the
|
||||||
|
monitor, the relative motion is unaffected by the clipping and will
|
||||||
|
represent the unclipped motion.
|
||||||
|
|
||||||
|
This event also contains non-accelerated motion deltas. The
|
||||||
|
non-accelerated delta is, when applicable, the regular pointer motion
|
||||||
|
delta as it was before having applied motion acceleration and other
|
||||||
|
transformations such as normalization.
|
||||||
|
|
||||||
|
Note that the non-accelerated delta does not represent 'raw' events as
|
||||||
|
they were read from some device. Pointer motion acceleration is device-
|
||||||
|
and configuration-specific and non-accelerated deltas and accelerated
|
||||||
|
deltas may have the same value on some devices.
|
||||||
|
|
||||||
|
Relative motions are not coupled to wl_pointer.motion events, and can be
|
||||||
|
sent in combination with such events, but also independently. There may
|
||||||
|
also be scenarios where wl_pointer.motion is sent, but there is no
|
||||||
|
relative motion. The order of an absolute and relative motion event
|
||||||
|
originating from the same physical motion is not guaranteed.
|
||||||
|
|
||||||
|
If the client needs button events or focus state, it can receive them
|
||||||
|
from a wl_pointer object of the same seat that the wp_relative_pointer
|
||||||
|
object is associated with.
|
||||||
|
</description>
|
||||||
|
<arg name="utime_hi" type="uint"
|
||||||
|
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="utime_lo" type="uint"
|
||||||
|
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="dx" type="fixed"
|
||||||
|
summary="the x component of the motion vector"/>
|
||||||
|
<arg name="dy" type="fixed"
|
||||||
|
summary="the y component of the motion vector"/>
|
||||||
|
<arg name="dx_unaccel" type="fixed"
|
||||||
|
summary="the x component of the unaccelerated motion vector"/>
|
||||||
|
<arg name="dy_unaccel" type="fixed"
|
||||||
|
summary="the y component of the unaccelerated motion vector"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
+160
@@ -0,0 +1,160 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_decoration_unstable_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2018 Simon Ser
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="zxdg_decoration_manager_v1" version="1">
|
||||||
|
<description summary="window decoration manager">
|
||||||
|
This interface allows a compositor to announce support for server-side
|
||||||
|
decorations.
|
||||||
|
|
||||||
|
A window decoration is a set of window controls as deemed appropriate by
|
||||||
|
the party managing them, such as user interface components used to move,
|
||||||
|
resize and change a window's state.
|
||||||
|
|
||||||
|
A client can use this protocol to request being decorated by a supporting
|
||||||
|
compositor.
|
||||||
|
|
||||||
|
If compositor and client do not negotiate the use of a server-side
|
||||||
|
decoration using this protocol, clients continue to self-decorate as they
|
||||||
|
see fit.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible changes
|
||||||
|
may be added together with the corresponding interface version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version number in
|
||||||
|
the protocol and interface names and resetting the interface version.
|
||||||
|
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||||
|
version number in the protocol and interface names are removed and the
|
||||||
|
interface version number is reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the decoration manager object">
|
||||||
|
Destroy the decoration manager. This doesn't destroy objects created
|
||||||
|
with the manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_toplevel_decoration">
|
||||||
|
<description summary="create a new toplevel decoration object">
|
||||||
|
Create a new decoration object associated with the given toplevel.
|
||||||
|
|
||||||
|
Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
|
||||||
|
buffer attached or committed is a client error, and any attempts by a
|
||||||
|
client to attach or manipulate a buffer prior to the first
|
||||||
|
xdg_toplevel_decoration.configure event must also be treated as
|
||||||
|
errors.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
|
||||||
|
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zxdg_toplevel_decoration_v1" version="1">
|
||||||
|
<description summary="decoration object for a toplevel surface">
|
||||||
|
The decoration object allows the compositor to toggle server-side window
|
||||||
|
decorations for a toplevel surface. The client can request to switch to
|
||||||
|
another mode.
|
||||||
|
|
||||||
|
The xdg_toplevel_decoration object must be destroyed before its
|
||||||
|
xdg_toplevel.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="unconfigured_buffer" value="0"
|
||||||
|
summary="xdg_toplevel has a buffer attached before configure"/>
|
||||||
|
<entry name="already_constructed" value="1"
|
||||||
|
summary="xdg_toplevel already has a decoration object"/>
|
||||||
|
<entry name="orphaned" value="2"
|
||||||
|
summary="xdg_toplevel destroyed before the decoration object"/>
|
||||||
|
<entry name="invalid_mode" value="3" summary="invalid mode"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the decoration object">
|
||||||
|
Switch back to a mode without any server-side decorations at the next
|
||||||
|
commit.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="mode">
|
||||||
|
<description summary="window decoration modes">
|
||||||
|
These values describe window decoration modes.
|
||||||
|
</description>
|
||||||
|
<entry name="client_side" value="1"
|
||||||
|
summary="no server-side window decoration"/>
|
||||||
|
<entry name="server_side" value="2"
|
||||||
|
summary="server-side window decoration"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="set_mode">
|
||||||
|
<description summary="set the decoration mode">
|
||||||
|
Set the toplevel surface decoration mode. This informs the compositor
|
||||||
|
that the client prefers the provided decoration mode.
|
||||||
|
|
||||||
|
After requesting a decoration mode, the compositor will respond by
|
||||||
|
emitting an xdg_surface.configure event. The client should then update
|
||||||
|
its content, drawing it without decorations if the received mode is
|
||||||
|
server-side decorations. The client must also acknowledge the configure
|
||||||
|
when committing the new content (see xdg_surface.ack_configure).
|
||||||
|
|
||||||
|
The compositor can decide not to use the client's mode and enforce a
|
||||||
|
different mode instead.
|
||||||
|
|
||||||
|
Clients whose decoration mode depend on the xdg_toplevel state may send
|
||||||
|
a set_mode request in response to an xdg_surface.configure event and wait
|
||||||
|
for the next xdg_surface.configure event to prevent unwanted state.
|
||||||
|
Such clients are responsible for preventing configure loops and must
|
||||||
|
make sure not to send multiple successive set_mode requests with the
|
||||||
|
same decoration mode.
|
||||||
|
|
||||||
|
If an invalid mode is supplied by the client, the invalid_mode protocol
|
||||||
|
error is raised by the compositor.
|
||||||
|
</description>
|
||||||
|
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="unset_mode">
|
||||||
|
<description summary="unset the decoration mode">
|
||||||
|
Unset the toplevel surface decoration mode. This informs the compositor
|
||||||
|
that the client doesn't prefer a particular decoration mode.
|
||||||
|
|
||||||
|
This request has the same semantics as set_mode.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="configure">
|
||||||
|
<description summary="notify a decoration mode change">
|
||||||
|
The configure event configures the effective decoration mode. The
|
||||||
|
configured state should not be applied immediately. Clients must send an
|
||||||
|
ack_configure in response to this event. See xdg_surface.configure and
|
||||||
|
xdg_surface.ack_configure for details.
|
||||||
|
|
||||||
|
A configure event can be sent at any time. The specified mode must be
|
||||||
|
obeyed by the client.
|
||||||
|
</description>
|
||||||
|
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
+222
@@ -0,0 +1,222 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_output_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2017 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="Protocol to describe output regions">
|
||||||
|
This protocol aims at describing outputs in a way which is more in line
|
||||||
|
with the concept of an output on desktop oriented systems.
|
||||||
|
|
||||||
|
Some information are more specific to the concept of an output for
|
||||||
|
a desktop oriented system and may not make sense in other applications,
|
||||||
|
such as IVI systems for example.
|
||||||
|
|
||||||
|
Typically, the global compositor space on a desktop system is made of
|
||||||
|
a contiguous or overlapping set of rectangular regions.
|
||||||
|
|
||||||
|
The logical_position and logical_size events defined in this protocol
|
||||||
|
might provide information identical to their counterparts already
|
||||||
|
available from wl_output, in which case the information provided by this
|
||||||
|
protocol should be preferred to their equivalent in wl_output. The goal is
|
||||||
|
to move the desktop specific concepts (such as output location within the
|
||||||
|
global compositor space, etc.) out of the core wl_output protocol.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible
|
||||||
|
changes may be added together with the corresponding interface
|
||||||
|
version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version
|
||||||
|
number in the protocol and interface names and resetting the
|
||||||
|
interface version. Once the protocol is to be declared stable,
|
||||||
|
the 'z' prefix and the version number in the protocol and
|
||||||
|
interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zxdg_output_manager_v1" version="3">
|
||||||
|
<description summary="manage xdg_output objects">
|
||||||
|
A global factory interface for xdg_output objects.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the xdg_output_manager object">
|
||||||
|
Using this request a client can tell the server that it is not
|
||||||
|
going to use the xdg_output_manager object anymore.
|
||||||
|
|
||||||
|
Any objects already created through this instance are not affected.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_xdg_output">
|
||||||
|
<description summary="create an xdg output from a wl_output">
|
||||||
|
This creates a new xdg_output object for the given wl_output.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zxdg_output_v1"/>
|
||||||
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zxdg_output_v1" version="3">
|
||||||
|
<description summary="compositor logical output region">
|
||||||
|
An xdg_output describes part of the compositor geometry.
|
||||||
|
|
||||||
|
This typically corresponds to a monitor that displays part of the
|
||||||
|
compositor space.
|
||||||
|
|
||||||
|
For objects version 3 onwards, after all xdg_output properties have been
|
||||||
|
sent (when the object is created and when properties are updated), a
|
||||||
|
wl_output.done event is sent. This allows changes to the output
|
||||||
|
properties to be seen as atomic, even if they happen via multiple events.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the xdg_output object">
|
||||||
|
Using this request a client can tell the server that it is not
|
||||||
|
going to use the xdg_output object anymore.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="logical_position">
|
||||||
|
<description summary="position of the output within the global compositor space">
|
||||||
|
The position event describes the location of the wl_output within
|
||||||
|
the global compositor space.
|
||||||
|
|
||||||
|
The logical_position event is sent after creating an xdg_output
|
||||||
|
(see xdg_output_manager.get_xdg_output) and whenever the location
|
||||||
|
of the output changes within the global compositor space.
|
||||||
|
</description>
|
||||||
|
<arg name="x" type="int"
|
||||||
|
summary="x position within the global compositor space"/>
|
||||||
|
<arg name="y" type="int"
|
||||||
|
summary="y position within the global compositor space"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="logical_size">
|
||||||
|
<description summary="size of the output in the global compositor space">
|
||||||
|
The logical_size event describes the size of the output in the
|
||||||
|
global compositor space.
|
||||||
|
|
||||||
|
Most regular Wayland clients should not pay attention to the
|
||||||
|
logical size and would rather rely on xdg_shell interfaces.
|
||||||
|
|
||||||
|
Some clients such as Xwayland, however, need this to configure
|
||||||
|
their surfaces in the global compositor space as the compositor
|
||||||
|
may apply a different scale from what is advertised by the output
|
||||||
|
scaling property (to achieve fractional scaling, for example).
|
||||||
|
|
||||||
|
For example, for a wl_output mode 3840×2160 and a scale factor 2:
|
||||||
|
|
||||||
|
- A compositor not scaling the monitor viewport in its compositing space
|
||||||
|
will advertise a logical size of 3840×2160,
|
||||||
|
|
||||||
|
- A compositor scaling the monitor viewport with scale factor 2 will
|
||||||
|
advertise a logical size of 1920×1080,
|
||||||
|
|
||||||
|
- A compositor scaling the monitor viewport using a fractional scale of
|
||||||
|
1.5 will advertise a logical size of 2560×1440.
|
||||||
|
|
||||||
|
For example, for a wl_output mode 1920×1080 and a 90 degree rotation,
|
||||||
|
the compositor will advertise a logical size of 1080x1920.
|
||||||
|
|
||||||
|
The logical_size event is sent after creating an xdg_output
|
||||||
|
(see xdg_output_manager.get_xdg_output) and whenever the logical
|
||||||
|
size of the output changes, either as a result of a change in the
|
||||||
|
applied scale or because of a change in the corresponding output
|
||||||
|
mode(see wl_output.mode) or transform (see wl_output.transform).
|
||||||
|
</description>
|
||||||
|
<arg name="width" type="int"
|
||||||
|
summary="width in global compositor space"/>
|
||||||
|
<arg name="height" type="int"
|
||||||
|
summary="height in global compositor space"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="done" deprecated-since="3">
|
||||||
|
<description summary="all information about the output have been sent">
|
||||||
|
This event is sent after all other properties of an xdg_output
|
||||||
|
have been sent.
|
||||||
|
|
||||||
|
This allows changes to the xdg_output properties to be seen as
|
||||||
|
atomic, even if they happen via multiple events.
|
||||||
|
|
||||||
|
For objects version 3 onwards, this event is deprecated. Compositors
|
||||||
|
are not required to send it anymore and must send wl_output.done
|
||||||
|
instead.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<!-- Version 2 additions -->
|
||||||
|
|
||||||
|
<event name="name" since="2">
|
||||||
|
<description summary="name of this output">
|
||||||
|
Many compositors will assign names to their outputs, show them to the
|
||||||
|
user, allow them to be configured by name, etc. The client may wish to
|
||||||
|
know this name as well to offer the user similar behaviors.
|
||||||
|
|
||||||
|
The naming convention is compositor defined, but limited to
|
||||||
|
alphanumeric characters and dashes (-). Each name is unique among all
|
||||||
|
wl_output globals, but if a wl_output global is destroyed the same name
|
||||||
|
may be reused later. The names will also remain consistent across
|
||||||
|
sessions with the same hardware and software configuration.
|
||||||
|
|
||||||
|
Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do
|
||||||
|
not assume that the name is a reflection of an underlying DRM
|
||||||
|
connector, X11 connection, etc.
|
||||||
|
|
||||||
|
The name event is sent after creating an xdg_output (see
|
||||||
|
xdg_output_manager.get_xdg_output). This event is only sent once per
|
||||||
|
xdg_output, and the name does not change over the lifetime of the
|
||||||
|
wl_output global.
|
||||||
|
|
||||||
|
This event is deprecated, instead clients should use wl_output.name.
|
||||||
|
Compositors must still support this event.
|
||||||
|
</description>
|
||||||
|
<arg name="name" type="string" summary="output name"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="description" since="2">
|
||||||
|
<description summary="human-readable description of this output">
|
||||||
|
Many compositors can produce human-readable descriptions of their
|
||||||
|
outputs. The client may wish to know this description as well, to
|
||||||
|
communicate the user for various purposes.
|
||||||
|
|
||||||
|
The description is a UTF-8 string with no convention defined for its
|
||||||
|
contents. Examples might include 'Foocorp 11" Display' or 'Virtual X11
|
||||||
|
output via :1'.
|
||||||
|
|
||||||
|
The description event is sent after creating an xdg_output (see
|
||||||
|
xdg_output_manager.get_xdg_output) and whenever the description
|
||||||
|
changes. The description is optional, and may not be sent at all.
|
||||||
|
|
||||||
|
For objects of version 2 and lower, this event is only sent once per
|
||||||
|
xdg_output, and the description does not change over the lifetime of
|
||||||
|
the wl_output global.
|
||||||
|
|
||||||
|
This event is deprecated, instead clients should use
|
||||||
|
wl_output.description. Compositors must still support this event.
|
||||||
|
</description>
|
||||||
|
<arg name="description" type="string" summary="output description"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
File diff suppressed because it is too large
Load Diff
+205
@@ -0,0 +1,205 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_toplevel_icon_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2023-2024 Matthias Klumpp
|
||||||
|
Copyright © 2024 David Edmundson
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol to assign icons to toplevels">
|
||||||
|
This protocol allows clients to set icons for their toplevel surfaces
|
||||||
|
either via the XDG icon stock (using an icon name), or from pixel data.
|
||||||
|
|
||||||
|
A toplevel icon represents the individual toplevel (unlike the application
|
||||||
|
or launcher icon, which represents the application as a whole), and may be
|
||||||
|
shown in window switchers, window overviews and taskbars that list
|
||||||
|
individual windows.
|
||||||
|
|
||||||
|
This document adheres to RFC 2119 when using words like "must",
|
||||||
|
"should", "may", etc.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is currently in the testing
|
||||||
|
phase. Backward compatible changes may be added together with the
|
||||||
|
corresponding interface version bump. Backward incompatible changes can
|
||||||
|
only be done by creating a new major version of the extension.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="xdg_toplevel_icon_manager_v1" version="1">
|
||||||
|
<description summary="interface to manage toplevel icons">
|
||||||
|
This interface allows clients to create toplevel window icons and set
|
||||||
|
them on toplevel windows to be displayed to the user.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the toplevel icon manager">
|
||||||
|
Destroy the toplevel icon manager.
|
||||||
|
This does not destroy objects created with the manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="create_icon">
|
||||||
|
<description summary="create a new icon instance">
|
||||||
|
Creates a new icon object. This icon can then be attached to a
|
||||||
|
xdg_toplevel via the 'set_icon' request.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="xdg_toplevel_icon_v1"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_icon">
|
||||||
|
<description summary="set an icon on a toplevel window">
|
||||||
|
This request assigns the icon 'icon' to 'toplevel', or clears the
|
||||||
|
toplevel icon if 'icon' was null.
|
||||||
|
This state is double-buffered and is applied on the next
|
||||||
|
wl_surface.commit of the toplevel.
|
||||||
|
|
||||||
|
After making this call, the xdg_toplevel_icon_v1 provided as 'icon'
|
||||||
|
can be destroyed by the client without 'toplevel' losing its icon.
|
||||||
|
The xdg_toplevel_icon_v1 is immutable from this point, and any
|
||||||
|
future attempts to change it must raise the
|
||||||
|
'xdg_toplevel_icon_v1.immutable' protocol error.
|
||||||
|
|
||||||
|
The compositor must set the toplevel icon from either the pixel data
|
||||||
|
the icon provides, or by loading a stock icon using the icon name.
|
||||||
|
See the description of 'xdg_toplevel_icon_v1' for details.
|
||||||
|
|
||||||
|
If 'icon' is set to null, the icon of the respective toplevel is reset
|
||||||
|
to its default icon (usually the icon of the application, derived from
|
||||||
|
its desktop-entry file, or a placeholder icon).
|
||||||
|
If this request is passed an icon with no pixel buffers or icon name
|
||||||
|
assigned, the icon must be reset just like if 'icon' was null.
|
||||||
|
</description>
|
||||||
|
<arg name="toplevel" type="object" interface="xdg_toplevel" summary="the toplevel to act on"/>
|
||||||
|
<arg name="icon" type="object" interface="xdg_toplevel_icon_v1" allow-null="true"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="icon_size">
|
||||||
|
<description summary="describes a supported & preferred icon size">
|
||||||
|
This event indicates an icon size the compositor prefers to be
|
||||||
|
available if the client has scalable icons and can render to any size.
|
||||||
|
|
||||||
|
When the 'xdg_toplevel_icon_manager_v1' object is created, the
|
||||||
|
compositor may send one or more 'icon_size' events to describe the list
|
||||||
|
of preferred icon sizes. If the compositor has no size preference, it
|
||||||
|
may not send any 'icon_size' event, and it is up to the client to
|
||||||
|
decide a suitable icon size.
|
||||||
|
|
||||||
|
A sequence of 'icon_size' events must be finished with a 'done' event.
|
||||||
|
If the compositor has no size preferences, it must still send the
|
||||||
|
'done' event, without any preceding 'icon_size' events.
|
||||||
|
</description>
|
||||||
|
<arg name="size" type="int"
|
||||||
|
summary="the edge size of the square icon in surface-local coordinates, e.g. 64"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="done">
|
||||||
|
<description summary="all information has been sent">
|
||||||
|
This event is sent after all 'icon_size' events have been sent.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="xdg_toplevel_icon_v1" version="1">
|
||||||
|
<description summary="a toplevel window icon">
|
||||||
|
This interface defines a toplevel icon.
|
||||||
|
An icon can have a name, and multiple buffers.
|
||||||
|
In order to be applied, the icon must have either a name, or at least
|
||||||
|
one buffer assigned. Applying an empty icon (with no buffer or name) to
|
||||||
|
a toplevel should reset its icon to the default icon.
|
||||||
|
|
||||||
|
It is up to compositor policy whether to prefer using a buffer or loading
|
||||||
|
an icon via its name. See 'set_name' and 'add_buffer' for details.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="invalid_buffer"
|
||||||
|
summary="the provided buffer does not satisfy requirements"
|
||||||
|
value="1"/>
|
||||||
|
<entry name="immutable"
|
||||||
|
summary="the icon has already been assigned to a toplevel and must not be changed"
|
||||||
|
value="2"/>
|
||||||
|
<entry name="no_buffer"
|
||||||
|
summary="the provided buffer has been destroyed before the toplevel icon"
|
||||||
|
value="3"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the icon object">
|
||||||
|
Destroys the 'xdg_toplevel_icon_v1' object.
|
||||||
|
The icon must still remain set on every toplevel it was assigned to,
|
||||||
|
until the toplevel icon is reset explicitly.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_name">
|
||||||
|
<description summary="set an icon name">
|
||||||
|
This request assigns an icon name to this icon.
|
||||||
|
Any previously set name is overridden.
|
||||||
|
|
||||||
|
The compositor must resolve 'icon_name' according to the lookup rules
|
||||||
|
described in the XDG icon theme specification[1] using the
|
||||||
|
environment's current icon theme.
|
||||||
|
|
||||||
|
If the compositor does not support icon names or cannot resolve
|
||||||
|
'icon_name' according to the XDG icon theme specification it must
|
||||||
|
fall back to using pixel buffer data instead.
|
||||||
|
|
||||||
|
If this request is made after the icon has been assigned to a toplevel
|
||||||
|
via 'set_icon', a 'immutable' error must be raised.
|
||||||
|
|
||||||
|
[1]: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
|
||||||
|
</description>
|
||||||
|
<arg name="icon_name" type="string"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="add_buffer">
|
||||||
|
<description summary="add icon data from a pixel buffer">
|
||||||
|
This request adds pixel data supplied as wl_buffer to the icon.
|
||||||
|
|
||||||
|
The client should add pixel data for all icon sizes and scales that
|
||||||
|
it can provide, or which are explicitly requested by the compositor
|
||||||
|
via 'icon_size' events on xdg_toplevel_icon_manager_v1.
|
||||||
|
|
||||||
|
The wl_buffer supplying pixel data as 'buffer' must be backed by wl_shm
|
||||||
|
and must be a square (width and height being equal).
|
||||||
|
If any of these buffer requirements are not fulfilled, a 'invalid_buffer'
|
||||||
|
error must be raised.
|
||||||
|
|
||||||
|
If this icon instance already has a buffer of the same size and scale
|
||||||
|
from a previous 'add_buffer' request, data from the last request
|
||||||
|
overrides the preexisting pixel data.
|
||||||
|
|
||||||
|
The wl_buffer must be kept alive for as long as the xdg_toplevel_icon
|
||||||
|
it is associated with is not destroyed, otherwise a 'no_buffer' error
|
||||||
|
is raised. The buffer contents must not be modified after it was
|
||||||
|
assigned to the icon. As a result, the region of the wl_shm_pool's
|
||||||
|
backing storage used for the wl_buffer must not be modified after this
|
||||||
|
request is sent. The wl_buffer.release event is unused.
|
||||||
|
|
||||||
|
If this request is made after the icon has been assigned to a toplevel
|
||||||
|
via 'set_icon', a 'immutable' error must be raised.
|
||||||
|
</description>
|
||||||
|
<arg name="buffer" type="object" interface="wl_buffer"/>
|
||||||
|
<arg name="scale" type="int"
|
||||||
|
summary="the scaling factor of the icon, e.g. 1"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
+7240
File diff suppressed because it is too large
Load Diff
+1565
File diff suppressed because it is too large
Load Diff
+183
@@ -0,0 +1,183 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Declaration of POSIX directory browsing functions and types for Win32.
|
||||||
|
|
||||||
|
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
|
||||||
|
History: Created March 1997. Updated June 2003.
|
||||||
|
Reviewed by Ramon Santamaria for raylib on January 2020.
|
||||||
|
|
||||||
|
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
|
documentation for any purpose is hereby granted without fee, provided
|
||||||
|
that this copyright and permissions notice appear in all copies and
|
||||||
|
derivatives.
|
||||||
|
|
||||||
|
This software is supplied "as is" without express or implied warranty.
|
||||||
|
|
||||||
|
But that said, if there are any problems please get in touch.
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DIRENT_H
|
||||||
|
#define DIRENT_H
|
||||||
|
|
||||||
|
// Allow custom memory allocators
|
||||||
|
#ifndef DIRENT_MALLOC
|
||||||
|
#define DIRENT_MALLOC(sz) malloc(sz)
|
||||||
|
#endif
|
||||||
|
#ifndef DIRENT_FREE
|
||||||
|
#define DIRENT_FREE(p) free(p)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Fordward declaration of DIR, implementation below
|
||||||
|
typedef struct DIR DIR;
|
||||||
|
|
||||||
|
struct dirent {
|
||||||
|
char *d_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Functions Declaration
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
DIR *opendir(const char *name);
|
||||||
|
int closedir(DIR *dir);
|
||||||
|
struct dirent *readdir(DIR *dir);
|
||||||
|
void rewinddir(DIR *dir);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DIRENT_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Implementation of POSIX directory browsing functions and types for Win32.
|
||||||
|
|
||||||
|
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
|
||||||
|
History: Created March 1997. Updated June 2003.
|
||||||
|
Reviewed by Ramon Santamaria for raylib on January 2020.
|
||||||
|
|
||||||
|
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
|
documentation for any purpose is hereby granted without fee, provided
|
||||||
|
that this copyright and permissions notice appear in all copies and
|
||||||
|
derivatives.
|
||||||
|
|
||||||
|
This software is supplied "as is" without express or implied warranty.
|
||||||
|
|
||||||
|
But that said, if there are any problems please get in touch.
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <io.h> // _findfirst and _findnext set errno iff they return -1
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef ptrdiff_t handle_type; // C99's intptr_t not sufficiently portable
|
||||||
|
|
||||||
|
struct DIR {
|
||||||
|
handle_type handle; // -1 for failed rewind
|
||||||
|
struct _finddata_t info;
|
||||||
|
struct dirent result; // d_name null iff first time
|
||||||
|
char *name; // null-terminated char string
|
||||||
|
};
|
||||||
|
|
||||||
|
DIR *opendir(const char *name)
|
||||||
|
{
|
||||||
|
DIR *dir = 0;
|
||||||
|
|
||||||
|
if (name && name[0])
|
||||||
|
{
|
||||||
|
size_t base_length = strlen(name);
|
||||||
|
|
||||||
|
// Search pattern must end with suitable wildcard
|
||||||
|
const char *all = strchr("/\\", name[base_length - 1]) ? "*" : "/*";
|
||||||
|
|
||||||
|
if ((dir = (DIR *)DIRENT_MALLOC(sizeof *dir)) != 0 &&
|
||||||
|
(dir->name = (char *)DIRENT_MALLOC(base_length + strlen(all) + 1)) != 0)
|
||||||
|
{
|
||||||
|
strcat(strcpy(dir->name, name), all);
|
||||||
|
|
||||||
|
if ((dir->handle = (handle_type) _findfirst(dir->name, &dir->info)) != -1)
|
||||||
|
{
|
||||||
|
dir->result.d_name = 0;
|
||||||
|
}
|
||||||
|
else // rollback
|
||||||
|
{
|
||||||
|
DIRENT_FREE(dir->name);
|
||||||
|
DIRENT_FREE(dir);
|
||||||
|
dir = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // rollback
|
||||||
|
{
|
||||||
|
DIRENT_FREE(dir);
|
||||||
|
dir = 0;
|
||||||
|
errno = ENOMEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else errno = EINVAL;
|
||||||
|
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
int closedir(DIR *dir)
|
||||||
|
{
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
if (dir)
|
||||||
|
{
|
||||||
|
if (dir->handle != -1) result = _findclose(dir->handle);
|
||||||
|
|
||||||
|
DIRENT_FREE(dir->name);
|
||||||
|
DIRENT_FREE(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: All errors ampped to EBADF
|
||||||
|
if (result == -1) errno = EBADF;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct dirent *readdir(DIR *dir)
|
||||||
|
{
|
||||||
|
struct dirent *result = 0;
|
||||||
|
|
||||||
|
if (dir && dir->handle != -1)
|
||||||
|
{
|
||||||
|
if (!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
|
||||||
|
{
|
||||||
|
result = &dir->result;
|
||||||
|
result->d_name = dir->info.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else errno = EBADF;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rewinddir(DIR *dir)
|
||||||
|
{
|
||||||
|
if (dir && dir->handle != -1)
|
||||||
|
{
|
||||||
|
_findclose(dir->handle);
|
||||||
|
dir->handle = (handle_type) _findfirst(dir->name, &dir->info);
|
||||||
|
dir->result.d_name = 0;
|
||||||
|
}
|
||||||
|
else errno = EBADF;
|
||||||
|
}
|
||||||
+12660
File diff suppressed because it is too large
Load Diff
+5385
File diff suppressed because it is too large
Load Diff
+9060
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,63 @@
|
|||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* fix_win32_compatibility.h Utility to help include windows.h with raylib projects
|
||||||
|
*
|
||||||
|
* Useage: #include "fix_win32_compatibility.h" any library that uses windows.h
|
||||||
|
* order is critical, this must be done before raylib
|
||||||
|
*
|
||||||
|
* LICENSE: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Jeffery Myers
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// move the windows functions to new names
|
||||||
|
// note that you can't call these functions or structures from your code, but you should not neeed to
|
||||||
|
#define CloseWindow CloseWindowWin32
|
||||||
|
#define Rectangle RectangleWin32
|
||||||
|
#define ShowCursor ShowCursorWin32
|
||||||
|
#define LoadImageA LoadImageAWin32
|
||||||
|
#define LoadImageW LoadImageWin32
|
||||||
|
#define DrawTextA DrawTextAWin32
|
||||||
|
#define DrawTextW DrawTextWin32
|
||||||
|
#define DrawTextExA DrawTextExAWin32
|
||||||
|
#define DrawTextExW DrawTextExWin32
|
||||||
|
#define PlaySoundA PlaySoundAWin32
|
||||||
|
// include windows
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
// remove all our redfintions so that raylib can define them properly
|
||||||
|
#undef CloseWindow
|
||||||
|
#undef Rectangle
|
||||||
|
#undef ShowCursor
|
||||||
|
#undef LoadImage
|
||||||
|
#undef LoadImageA
|
||||||
|
#undef LoadImageW
|
||||||
|
#undef DrawText
|
||||||
|
#undef DrawTextA
|
||||||
|
#undef DrawTextW
|
||||||
|
#undef DrawTextEx
|
||||||
|
#undef DrawTextExA
|
||||||
|
#undef DrawTextExW
|
||||||
|
#undef PlaySoundA
|
||||||
+8682
File diff suppressed because it is too large
Load Diff
+4774
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
Camilla Löwy <elmindreda@glfw.org> <elmindreda@users.sourceforge.net>
|
||||||
|
Camilla Löwy <elmindreda@glfw.org> <elmindreda@elmindreda.org>
|
||||||
|
Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
|
||||||
|
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
||||||
|
|
||||||
|
Marcus Geelnard <m@bitsnbites.eu> <marcus256@users.sourceforge.net>
|
||||||
|
Marcus Geelnard <m@bitsnbites.eu> <marcus@geelnards-pc.(none)>
|
||||||
|
Marcus Geelnard <m@bitsnbites.eu>
|
||||||
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Usage:
|
||||||
|
# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
|
||||||
|
|
||||||
|
set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
|
||||||
|
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
|
||||||
|
set(template_path "${CMAKE_ARGV3}")
|
||||||
|
set(target_path "${CMAKE_ARGV4}")
|
||||||
|
|
||||||
|
if (NOT EXISTS "${template_path}")
|
||||||
|
message(FATAL_ERROR "Failed to find template file ${template_path}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(DOWNLOAD "${source_url}" "${source_path}"
|
||||||
|
STATUS download_status
|
||||||
|
TLS_VERIFY on)
|
||||||
|
|
||||||
|
list(GET download_status 0 status_code)
|
||||||
|
list(GET download_status 1 status_message)
|
||||||
|
|
||||||
|
if (status_code)
|
||||||
|
message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(STRINGS "${source_path}" lines)
|
||||||
|
foreach(line ${lines})
|
||||||
|
if (line MATCHES "^[0-9a-fA-F]")
|
||||||
|
if (line MATCHES "platform:Windows")
|
||||||
|
if (GLFW_WIN32_MAPPINGS)
|
||||||
|
string(APPEND GLFW_WIN32_MAPPINGS "\n")
|
||||||
|
endif()
|
||||||
|
string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
|
||||||
|
elseif (line MATCHES "platform:Mac OS X")
|
||||||
|
if (GLFW_COCOA_MAPPINGS)
|
||||||
|
string(APPEND GLFW_COCOA_MAPPINGS "\n")
|
||||||
|
endif()
|
||||||
|
string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
|
||||||
|
elseif (line MATCHES "platform:Linux")
|
||||||
|
if (GLFW_LINUX_MAPPINGS)
|
||||||
|
string(APPEND GLFW_LINUX_MAPPINGS "\n")
|
||||||
|
endif()
|
||||||
|
string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX)
|
||||||
|
file(REMOVE "${source_path}")
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSRequiresCarbon</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt")
|
||||||
|
message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files)
|
||||||
|
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
|
|
||||||
|
foreach (file ${files})
|
||||||
|
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||||
|
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||||
|
exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||||
|
OUTPUT_VARIABLE rm_out
|
||||||
|
RETURN_VALUE rm_retval)
|
||||||
|
if (NOT "${rm_retval}" STREQUAL 0)
|
||||||
|
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||||
|
endif()
|
||||||
|
elseif (IS_SYMLINK "$ENV{DESTDIR}${file}")
|
||||||
|
EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||||
|
OUTPUT_VARIABLE rm_out
|
||||||
|
RETURN_VALUE rm_retval)
|
||||||
|
if (NOT "${rm_retval}" STREQUAL 0)
|
||||||
|
message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||||
|
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||||
|
|
||||||
|
Name: GLFW
|
||||||
|
Description: A multi-platform library for OpenGL, window and input
|
||||||
|
Version: @GLFW_VERSION@
|
||||||
|
URL: https://www.glfw.org/
|
||||||
|
Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@
|
||||||
|
Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@
|
||||||
|
Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
|
||||||
|
Cflags: -I${includedir}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
find_dependency(Threads)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake")
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Define the environment for cross-compiling with 32-bit MinGW-w64 Clang
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang")
|
||||||
|
SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++")
|
||||||
|
SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Define the environment for cross-compiling with 32-bit MinGW-w64 GCC
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc")
|
||||||
|
SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++")
|
||||||
|
SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Find EpollShim
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# EPOLLSHIM_FOUND - System has EpollShim
|
||||||
|
# EPOLLSHIM_INCLUDE_DIRS - The EpollShim include directories
|
||||||
|
# EPOLLSHIM_LIBRARIES - The libraries needed to use EpollShim
|
||||||
|
|
||||||
|
find_path(EPOLLSHIM_INCLUDE_DIRS NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim)
|
||||||
|
find_library(EPOLLSHIM_LIBRARIES NAMES epoll-shim libepoll-shim HINTS /usr/local/lib)
|
||||||
|
|
||||||
|
if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
|
||||||
|
set(EPOLLSHIM_FOUND TRUE)
|
||||||
|
endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS)
|
||||||
|
mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES)
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Try to find OSMesa on a Unix system
|
||||||
|
#
|
||||||
|
# This will define:
|
||||||
|
#
|
||||||
|
# OSMESA_LIBRARIES - Link these to use OSMesa
|
||||||
|
# OSMESA_INCLUDE_DIR - Include directory for OSMesa
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
|
||||||
|
find_package (PkgConfig)
|
||||||
|
pkg_check_modules (PKG_OSMESA QUIET osmesa)
|
||||||
|
|
||||||
|
set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS})
|
||||||
|
set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES})
|
||||||
|
|
||||||
|
endif ()
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
# Define the environment for cross-compiling with 64-bit MinGW-w64 Clang
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang")
|
||||||
|
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++")
|
||||||
|
SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Define the environment for cross-compiling with 64-bit MinGW-w64 GCC
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc")
|
||||||
|
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++")
|
||||||
|
SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR)
|
||||||
|
|
||||||
|
project(GLFW VERSION 3.4.0 LANGUAGES C)
|
||||||
|
|
||||||
|
if (POLICY CMP0069)
|
||||||
|
cmake_policy(SET CMP0069 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (POLICY CMP0077)
|
||||||
|
cmake_policy(SET CMP0077 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE)
|
||||||
|
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||||
|
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})
|
||||||
|
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE})
|
||||||
|
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||||
|
option(GLFW_INSTALL "Generate installation target" ON)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
|
if (GLFW_USE_OSMESA)
|
||||||
|
message(FATAL_ERROR "GLFW_USE_OSMESA has been removed; set the GLFW_PLATFORM init hint")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"GLFW_USE_WAYLAND has been removed; delete the CMake cache and set GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 instead")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF)
|
||||||
|
cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF)
|
||||||
|
cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF)
|
||||||
|
cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF)
|
||||||
|
|
||||||
|
cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
|
||||||
|
"WIN32" OFF)
|
||||||
|
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
|
||||||
|
"MSVC" OFF)
|
||||||
|
|
||||||
|
set(GLFW_LIBRARY_TYPE "${GLFW_LIBRARY_TYPE}" CACHE STRING
|
||||||
|
"Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)")
|
||||||
|
|
||||||
|
if (GLFW_LIBRARY_TYPE)
|
||||||
|
if (GLFW_LIBRARY_TYPE STREQUAL "SHARED")
|
||||||
|
set(GLFW_BUILD_SHARED_LIBRARY TRUE)
|
||||||
|
else()
|
||||||
|
set(GLFW_BUILD_SHARED_LIBRARY FALSE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
|
||||||
|
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Report backend selection
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (GLFW_BUILD_WIN32)
|
||||||
|
message(STATUS "Including Win32 support")
|
||||||
|
endif()
|
||||||
|
if (GLFW_BUILD_COCOA)
|
||||||
|
message(STATUS "Including Cocoa support")
|
||||||
|
endif()
|
||||||
|
if (GLFW_BUILD_WAYLAND)
|
||||||
|
message(STATUS "Including Wayland support")
|
||||||
|
endif()
|
||||||
|
if (GLFW_BUILD_X11)
|
||||||
|
message(STATUS "Including X11 support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Apply Microsoft C runtime library option
|
||||||
|
# This is here because it also applies to tests and examples
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.15)
|
||||||
|
foreach (flag CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS_MINSIZEREL
|
||||||
|
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
|
||||||
|
if (flag MATCHES "/MD")
|
||||||
|
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
if (flag MATCHES "/MDd")
|
||||||
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Create generated files
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3")
|
||||||
|
|
||||||
|
configure_package_config_file(CMake/glfw3Config.cmake.in
|
||||||
|
src/glfw3Config.cmake
|
||||||
|
INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||||
|
|
||||||
|
write_basic_package_version_file(src/glfw3ConfigVersion.cmake
|
||||||
|
VERSION ${GLFW_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Add subdirectories
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
if (GLFW_BUILD_EXAMPLES)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_DOCS)
|
||||||
|
add_subdirectory(docs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Install files other than the library
|
||||||
|
# The library is installed by src/CMakeLists.txt
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (GLFW_INSTALL)
|
||||||
|
install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
||||||
|
|
||||||
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
|
||||||
|
"${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
|
||||||
|
DESTINATION "${GLFW_CONFIG_PATH}")
|
||||||
|
|
||||||
|
install(EXPORT glfwTargets FILE glfw3Targets.cmake
|
||||||
|
EXPORT_LINK_INTERFACE_LIBRARIES
|
||||||
|
DESTINATION "${GLFW_CONFIG_PATH}")
|
||||||
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
|
|
||||||
|
# Only generate this target if no higher-level project already has
|
||||||
|
if (NOT TARGET uninstall)
|
||||||
|
configure_file(CMake/cmake_uninstall.cmake.in
|
||||||
|
cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||||
|
|
||||||
|
add_custom_target(uninstall
|
||||||
|
"${CMAKE_COMMAND}" -P
|
||||||
|
"${GLFW_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
set_target_properties(uninstall PROPERTIES FOLDER "GLFW3")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
# Acknowledgements
|
||||||
|
|
||||||
|
GLFW exists because people around the world donated their time and lent their
|
||||||
|
skills. This list only includes contributions to the main repository and
|
||||||
|
excludes other invaluable contributions like language bindings and text and
|
||||||
|
video tutorials.
|
||||||
|
|
||||||
|
- Bobyshev Alexander
|
||||||
|
- Laurent Aphecetche
|
||||||
|
- Matt Arsenault
|
||||||
|
- Takuro Ashie
|
||||||
|
- ashishgamedev
|
||||||
|
- David Avedissian
|
||||||
|
- Luca Bacci
|
||||||
|
- Keith Bauer
|
||||||
|
- John Bartholomew
|
||||||
|
- Coşku Baş
|
||||||
|
- Bayemite
|
||||||
|
- Niklas Behrens
|
||||||
|
- Andrew Belt
|
||||||
|
- Nevyn Bengtsson
|
||||||
|
- Niklas Bergström
|
||||||
|
- Denis Bernard
|
||||||
|
- BiBi
|
||||||
|
- Doug Binks
|
||||||
|
- blanco
|
||||||
|
- Waris Boonyasiriwat
|
||||||
|
- Kyle Brenneman
|
||||||
|
- Rok Breulj
|
||||||
|
- TheBrokenRail
|
||||||
|
- Kai Burjack
|
||||||
|
- Martin Capitanio
|
||||||
|
- Nicolas Caramelli
|
||||||
|
- David Carlier
|
||||||
|
- Arturo Castro
|
||||||
|
- Chi-kwan Chan
|
||||||
|
- Victor Chernyakin
|
||||||
|
- TheChocolateOre
|
||||||
|
- Ali Chraghi
|
||||||
|
- Joseph Chua
|
||||||
|
- Ian Clarkson
|
||||||
|
- Michał Cichoń
|
||||||
|
- Lambert Clara
|
||||||
|
- Anna Clarke
|
||||||
|
- Josh Codd
|
||||||
|
- Yaron Cohen-Tal
|
||||||
|
- Omar Cornut
|
||||||
|
- Andrew Corrigan
|
||||||
|
- Bailey Cosier
|
||||||
|
- Noel Cower
|
||||||
|
- CuriouserThing
|
||||||
|
- Bill Currie
|
||||||
|
- Jason Daly
|
||||||
|
- danhambleton
|
||||||
|
- Jarrod Davis
|
||||||
|
- Olivier Delannoy
|
||||||
|
- Paul R. Deppe
|
||||||
|
- Michael Dickens
|
||||||
|
- Роман Донченко
|
||||||
|
- Mario Dorn
|
||||||
|
- Wolfgang Draxinger
|
||||||
|
- Jonathan Dummer
|
||||||
|
- Ralph Eastwood
|
||||||
|
- Fredrik Ehnbom
|
||||||
|
- Robin Eklind
|
||||||
|
- Jan Ekström
|
||||||
|
- Siavash Eliasi
|
||||||
|
- Ahmad Fatoum
|
||||||
|
- Nikita Fediuchin
|
||||||
|
- Felipe Ferreira
|
||||||
|
- Michael Fogleman
|
||||||
|
- forworldm
|
||||||
|
- Jason Francis
|
||||||
|
- Gerald Franz
|
||||||
|
- Mário Freitas
|
||||||
|
- GeO4d
|
||||||
|
- Marcus Geelnard
|
||||||
|
- Gegy
|
||||||
|
- ghuser404
|
||||||
|
- Charles Giessen
|
||||||
|
- Ryan C. Gordon
|
||||||
|
- Stephen Gowen
|
||||||
|
- Kovid Goyal
|
||||||
|
- Kevin Grandemange
|
||||||
|
- Eloi Marín Gratacós
|
||||||
|
- Grzesiek11
|
||||||
|
- Stefan Gustavson
|
||||||
|
- Andrew Gutekanst
|
||||||
|
- Stephen Gutekanst
|
||||||
|
- Jonathan Hale
|
||||||
|
- Daniel Hauser
|
||||||
|
- hdf89shfdfs
|
||||||
|
- Moritz Heinemann
|
||||||
|
- Sylvain Hellegouarch
|
||||||
|
- Björn Hempel
|
||||||
|
- Matthew Henry
|
||||||
|
- heromyth
|
||||||
|
- Lucas Hinderberger
|
||||||
|
- Paul Holden
|
||||||
|
- Hajime Hoshi
|
||||||
|
- Warren Hu
|
||||||
|
- Charles Huber
|
||||||
|
- Brent Huisman
|
||||||
|
- Florian Hülsmann
|
||||||
|
- illustris
|
||||||
|
- InKryption
|
||||||
|
- IntellectualKitty
|
||||||
|
- Aaron Jacobs
|
||||||
|
- JannikGM
|
||||||
|
- Erik S. V. Jansson
|
||||||
|
- jjYBdx4IL
|
||||||
|
- Peter Johnson
|
||||||
|
- Toni Jovanoski
|
||||||
|
- Arseny Kapoulkine
|
||||||
|
- Cem Karan
|
||||||
|
- Osman Keskin
|
||||||
|
- Koray Kilinc
|
||||||
|
- Josh Kilmer
|
||||||
|
- Byunghoon Kim
|
||||||
|
- Cameron King
|
||||||
|
- Peter Knut
|
||||||
|
- Christoph Kubisch
|
||||||
|
- Yuri Kunde Schlesner
|
||||||
|
- Rokas Kupstys
|
||||||
|
- Konstantin Käfer
|
||||||
|
- Eric Larson
|
||||||
|
- Guillaume Lebrun
|
||||||
|
- Francis Lecavalier
|
||||||
|
- Jong Won Lee
|
||||||
|
- Robin Leffmann
|
||||||
|
- Glenn Lewis
|
||||||
|
- Shane Liesegang
|
||||||
|
- Anders Lindqvist
|
||||||
|
- Leon Linhart
|
||||||
|
- Marco Lizza
|
||||||
|
- lo-v-ol
|
||||||
|
- Eyal Lotem
|
||||||
|
- Aaron Loucks
|
||||||
|
- Ned Loynd
|
||||||
|
- Luflosi
|
||||||
|
- lukect
|
||||||
|
- Tristam MacDonald
|
||||||
|
- Jean-Luc Mackail
|
||||||
|
- Hans Mackowiak
|
||||||
|
- Ramiro Magno
|
||||||
|
- Дмитри Малышев
|
||||||
|
- Zbigniew Mandziejewicz
|
||||||
|
- Adam Marcus
|
||||||
|
- Célestin Marot
|
||||||
|
- Kyle McDonald
|
||||||
|
- David V. McKay
|
||||||
|
- David Medlock
|
||||||
|
- Bryce Mehring
|
||||||
|
- Jonathan Mercier
|
||||||
|
- Marcel Metz
|
||||||
|
- Liam Middlebrook
|
||||||
|
- mightgoyardstill
|
||||||
|
- Ave Milia
|
||||||
|
- Icyllis Milica
|
||||||
|
- Jonathan Miller
|
||||||
|
- Kenneth Miller
|
||||||
|
- Bruce Mitchener
|
||||||
|
- Jack Moffitt
|
||||||
|
- Ravi Mohan
|
||||||
|
- Jeff Molofee
|
||||||
|
- Alexander Monakov
|
||||||
|
- Pierre Morel
|
||||||
|
- Jon Morton
|
||||||
|
- Pierre Moulon
|
||||||
|
- Martins Mozeiko
|
||||||
|
- Pascal Muetschard
|
||||||
|
- James Murphy
|
||||||
|
- Julian Møller
|
||||||
|
- Julius Häger
|
||||||
|
- Nat!
|
||||||
|
- NateIsStalling
|
||||||
|
- ndogxj
|
||||||
|
- F. Nedelec
|
||||||
|
- n3rdopolis
|
||||||
|
- Kristian Nielsen
|
||||||
|
- Joel Niemelä
|
||||||
|
- Victor Nova
|
||||||
|
- Kamil Nowakowski
|
||||||
|
- onox
|
||||||
|
- Denis Ovod
|
||||||
|
- Ozzy
|
||||||
|
- Andri Pálsson
|
||||||
|
- luz paz
|
||||||
|
- Peoro
|
||||||
|
- Braden Pellett
|
||||||
|
- Christopher Pelloux
|
||||||
|
- Michael Pennington
|
||||||
|
- Arturo J. Pérez
|
||||||
|
- Vladimir Perminov
|
||||||
|
- Olivier Perret
|
||||||
|
- Anthony Pesch
|
||||||
|
- Orson Peters
|
||||||
|
- Emmanuel Gil Peyrot
|
||||||
|
- Cyril Pichard
|
||||||
|
- Pilzschaf
|
||||||
|
- Keith Pitt
|
||||||
|
- Stanislav Podgorskiy
|
||||||
|
- Konstantin Podsvirov
|
||||||
|
- Nathan Poirier
|
||||||
|
- Pokechu22
|
||||||
|
- Alexandre Pretyman
|
||||||
|
- Pablo Prietz
|
||||||
|
- przemekmirek
|
||||||
|
- pthom
|
||||||
|
- Martin Pulec
|
||||||
|
- Guillaume Racicot
|
||||||
|
- Juan Ramos
|
||||||
|
- Christian Rauch
|
||||||
|
- Philip Rideout
|
||||||
|
- Eddie Ringle
|
||||||
|
- Max Risuhin
|
||||||
|
- Joe Roback
|
||||||
|
- Jorge Rodriguez
|
||||||
|
- Jari Ronkainen
|
||||||
|
- Luca Rood
|
||||||
|
- Ed Ropple
|
||||||
|
- Aleksey Rybalkin
|
||||||
|
- Mikko Rytkönen
|
||||||
|
- Riku Salminen
|
||||||
|
- Yoshinori Sano
|
||||||
|
- Brandon Schaefer
|
||||||
|
- Sebastian Schuberth
|
||||||
|
- Scr3amer
|
||||||
|
- Jan Schuerkamp
|
||||||
|
- Christian Sdunek
|
||||||
|
- Matt Sealey
|
||||||
|
- Steve Sexton
|
||||||
|
- Arkady Shapkin
|
||||||
|
- Mingjie Shen
|
||||||
|
- Ali Sherief
|
||||||
|
- Yoshiki Shibukawa
|
||||||
|
- Dmitri Shuralyov
|
||||||
|
- Joao da Silva
|
||||||
|
- Daniel Sieger
|
||||||
|
- Daljit Singh
|
||||||
|
- Michael Skec
|
||||||
|
- Daniel Skorupski
|
||||||
|
- Slemmie
|
||||||
|
- Anthony Smith
|
||||||
|
- Bradley Smith
|
||||||
|
- Cliff Smolinsky
|
||||||
|
- Patrick Snape
|
||||||
|
- Erlend Sogge Heggen
|
||||||
|
- Olivier Sohn
|
||||||
|
- Julian Squires
|
||||||
|
- Johannes Stein
|
||||||
|
- Pontus Stenetorp
|
||||||
|
- Michael Stocker
|
||||||
|
- Justin Stoecker
|
||||||
|
- Elviss Strazdins
|
||||||
|
- Paul Sultana
|
||||||
|
- Nathan Sweet
|
||||||
|
- TTK-Bandit
|
||||||
|
- Nuno Teixeira
|
||||||
|
- Jared Tiala
|
||||||
|
- Sergey Tikhomirov
|
||||||
|
- Arthur Tombs
|
||||||
|
- TronicLabs
|
||||||
|
- Ioannis Tsakpinis
|
||||||
|
- Samuli Tuomola
|
||||||
|
- Matthew Turner
|
||||||
|
- urraka
|
||||||
|
- Elias Vanderstuyft
|
||||||
|
- Stef Velzel
|
||||||
|
- Jari Vetoniemi
|
||||||
|
- Ricardo Vieira
|
||||||
|
- Nicholas Vitovitch
|
||||||
|
- Vladimír Vondruš
|
||||||
|
- Simon Voordouw
|
||||||
|
- Corentin Wallez
|
||||||
|
- Torsten Walluhn
|
||||||
|
- Patrick Walton
|
||||||
|
- Jim Wang
|
||||||
|
- Xo Wang
|
||||||
|
- Andre Weissflog
|
||||||
|
- Jay Weisskopf
|
||||||
|
- Frank Wille
|
||||||
|
- Andy Williams
|
||||||
|
- Joel Winarske
|
||||||
|
- Richard A. Wilkes
|
||||||
|
- Tatsuya Yatagawa
|
||||||
|
- Ryogo Yoshimura
|
||||||
|
- Lukas Zanner
|
||||||
|
- Andrey Zholos
|
||||||
|
- Aihui Zhu
|
||||||
|
- Santi Zupancic
|
||||||
|
- Jonas Ådahl
|
||||||
|
- Lasse Öörni
|
||||||
|
- Leonard König
|
||||||
|
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
||||||
|
reports, patches, feedback, testing and encouragement
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
|
||||||
|
Copyright (c) 2006-2019 Camilla Löwy
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would
|
||||||
|
be appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
be misrepresented as being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# GLFW (modified for raylib)
|
||||||
|
|
||||||
|
This directory contains a modification of GLFW, whose official website and
|
||||||
|
upstream repository are https://glfw.org and https://github.com/glfw/glfw,
|
||||||
|
respectively.
|
||||||
|
|
||||||
|
In this modification, some static functions sharing the same name in different
|
||||||
|
platforms have been renamed so all of GLFW's source files can be combined into
|
||||||
|
one (as done by ``rglfw.c``). Also, the Null platform, which is not used by
|
||||||
|
raylib, has been disabled. The renamed functions are:
|
||||||
|
|
||||||
|
``
|
||||||
|
createKeyTables()
|
||||||
|
translateKey()
|
||||||
|
acquireMonitor()
|
||||||
|
releaseMonitor()
|
||||||
|
``
|
||||||
|
|
||||||
@@ -0,0 +1,230 @@
|
|||||||
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific
|
||||||
|
* prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "getopt.h"
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
const int no_argument = 0;
|
||||||
|
const int required_argument = 1;
|
||||||
|
const int optional_argument = 2;
|
||||||
|
|
||||||
|
char* optarg;
|
||||||
|
int optopt;
|
||||||
|
/* The variable optind [...] shall be initialized to 1 by the system. */
|
||||||
|
int optind = 1;
|
||||||
|
int opterr;
|
||||||
|
|
||||||
|
static char* optcursor = NULL;
|
||||||
|
|
||||||
|
/* Implemented based on [1] and [2] for optional arguments.
|
||||||
|
optopt is handled FreeBSD-style, per [3].
|
||||||
|
Other GNU and FreeBSD extensions are purely accidental.
|
||||||
|
|
||||||
|
[1] http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html
|
||||||
|
[2] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
|
[3] http://www.freebsd.org/cgi/man.cgi?query=getopt&sektion=3&manpath=FreeBSD+9.0-RELEASE
|
||||||
|
*/
|
||||||
|
int getopt(int argc, char* const argv[], const char* optstring) {
|
||||||
|
int optchar = -1;
|
||||||
|
const char* optdecl = NULL;
|
||||||
|
|
||||||
|
optarg = NULL;
|
||||||
|
opterr = 0;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
|
/* Unspecified, but we need it to avoid overrunning the argv bounds. */
|
||||||
|
if (optind >= argc)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] is a null pointer, getopt()
|
||||||
|
shall return -1 without changing optind. */
|
||||||
|
if (argv[optind] == NULL)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called *argv[optind] is not the character '-',
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (*argv[optind] != '-')
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "-",
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (strcmp(argv[optind], "-") == 0)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "--",
|
||||||
|
getopt() shall return -1 after incrementing optind. */
|
||||||
|
if (strcmp(argv[optind], "--") == 0) {
|
||||||
|
++optind;
|
||||||
|
goto no_more_optchars;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optcursor == NULL || *optcursor == '\0')
|
||||||
|
optcursor = argv[optind] + 1;
|
||||||
|
|
||||||
|
optchar = *optcursor;
|
||||||
|
|
||||||
|
/* FreeBSD: The variable optopt saves the last known option character
|
||||||
|
returned by getopt(). */
|
||||||
|
optopt = optchar;
|
||||||
|
|
||||||
|
/* The getopt() function shall return the next option character (if one is
|
||||||
|
found) from argv that matches a character in optstring, if there is
|
||||||
|
one that matches. */
|
||||||
|
optdecl = strchr(optstring, optchar);
|
||||||
|
if (optdecl) {
|
||||||
|
/* [I]f a character is followed by a colon, the option takes an
|
||||||
|
argument. */
|
||||||
|
if (optdecl[1] == ':') {
|
||||||
|
optarg = ++optcursor;
|
||||||
|
if (*optarg == '\0') {
|
||||||
|
/* GNU extension: Two colons mean an option takes an
|
||||||
|
optional arg; if there is text in the current argv-element
|
||||||
|
(i.e., in the same word as the option name itself, for example,
|
||||||
|
"-oarg"), then it is returned in optarg, otherwise optarg is set
|
||||||
|
to zero. */
|
||||||
|
if (optdecl[2] != ':') {
|
||||||
|
/* If the option was the last character in the string pointed to by
|
||||||
|
an element of argv, then optarg shall contain the next element
|
||||||
|
of argv, and optind shall be incremented by 2. If the resulting
|
||||||
|
value of optind is greater than argc, this indicates a missing
|
||||||
|
option-argument, and getopt() shall return an error indication.
|
||||||
|
|
||||||
|
Otherwise, optarg shall point to the string following the
|
||||||
|
option character in that element of argv, and optind shall be
|
||||||
|
incremented by 1.
|
||||||
|
*/
|
||||||
|
if (++optind < argc) {
|
||||||
|
optarg = argv[optind];
|
||||||
|
} else {
|
||||||
|
/* If it detects a missing option-argument, it shall return the
|
||||||
|
colon character ( ':' ) if the first character of optstring
|
||||||
|
was a colon, or a question-mark character ( '?' ) otherwise.
|
||||||
|
*/
|
||||||
|
optarg = NULL;
|
||||||
|
optchar = (optstring[0] == ':') ? ':' : '?';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
optarg = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
optcursor = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* If getopt() encounters an option character that is not contained in
|
||||||
|
optstring, it shall return the question-mark ( '?' ) character. */
|
||||||
|
optchar = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optcursor == NULL || *++optcursor == '\0')
|
||||||
|
++optind;
|
||||||
|
|
||||||
|
return optchar;
|
||||||
|
|
||||||
|
no_more_optchars:
|
||||||
|
optcursor = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Implementation based on [1].
|
||||||
|
|
||||||
|
[1] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
|
*/
|
||||||
|
int getopt_long(int argc, char* const argv[], const char* optstring,
|
||||||
|
const struct option* longopts, int* longindex) {
|
||||||
|
const struct option* o = longopts;
|
||||||
|
const struct option* match = NULL;
|
||||||
|
int num_matches = 0;
|
||||||
|
size_t argument_name_length = 0;
|
||||||
|
const char* current_argument = NULL;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
optarg = NULL;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
|
if (optind >= argc)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (strlen(argv[optind]) < 3 || strncmp(argv[optind], "--", 2) != 0)
|
||||||
|
return getopt(argc, argv, optstring);
|
||||||
|
|
||||||
|
/* It's an option; starts with -- and is longer than two chars. */
|
||||||
|
current_argument = argv[optind] + 2;
|
||||||
|
argument_name_length = strcspn(current_argument, "=");
|
||||||
|
for (; o->name; ++o) {
|
||||||
|
if (strncmp(o->name, current_argument, argument_name_length) == 0) {
|
||||||
|
match = o;
|
||||||
|
++num_matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_matches == 1) {
|
||||||
|
/* If longindex is not NULL, it points to a variable which is set to the
|
||||||
|
index of the long option relative to longopts. */
|
||||||
|
if (longindex)
|
||||||
|
*longindex = (int) (match - longopts);
|
||||||
|
|
||||||
|
/* If flag is NULL, then getopt_long() shall return val.
|
||||||
|
Otherwise, getopt_long() returns 0, and flag shall point to a variable
|
||||||
|
which shall be set to val if the option is found, but left unchanged if
|
||||||
|
the option is not found. */
|
||||||
|
if (match->flag)
|
||||||
|
*(match->flag) = match->val;
|
||||||
|
|
||||||
|
retval = match->flag ? 0 : match->val;
|
||||||
|
|
||||||
|
if (match->has_arg != no_argument) {
|
||||||
|
optarg = strchr(argv[optind], '=');
|
||||||
|
if (optarg != NULL)
|
||||||
|
++optarg;
|
||||||
|
|
||||||
|
if (match->has_arg == required_argument) {
|
||||||
|
/* Only scan the next argv for required arguments. Behavior is not
|
||||||
|
specified, but has been observed with Ubuntu and Mac OSX. */
|
||||||
|
if (optarg == NULL && ++optind < argc) {
|
||||||
|
optarg = argv[optind];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optarg == NULL)
|
||||||
|
retval = ':';
|
||||||
|
}
|
||||||
|
} else if (strchr(argv[optind], '=')) {
|
||||||
|
/* An argument was provided to a non-argument option.
|
||||||
|
I haven't seen this specified explicitly, but both GNU and BSD-based
|
||||||
|
implementations show this behavior.
|
||||||
|
*/
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Unknown option or ambiguous match. */
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
++optind;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific
|
||||||
|
* prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GETOPT_PORT_H
|
||||||
|
#define INCLUDED_GETOPT_PORT_H
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const int no_argument;
|
||||||
|
extern const int required_argument;
|
||||||
|
extern const int optional_argument;
|
||||||
|
|
||||||
|
extern char* optarg;
|
||||||
|
extern int optind, opterr, optopt;
|
||||||
|
|
||||||
|
struct option {
|
||||||
|
const char* name;
|
||||||
|
int has_arg;
|
||||||
|
int* flag;
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
|
||||||
|
int getopt(int argc, char* const argv[], const char* optstring);
|
||||||
|
|
||||||
|
int getopt_long(int argc, char* const argv[],
|
||||||
|
const char* optstring, const struct option* longopts, int* longindex);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // INCLUDED_GETOPT_PORT_H
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
|
* This file is part of the mingw-w64 runtime package.
|
||||||
|
* No warranty is given; refer to the file DISCLAIMER within this package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
|
||||||
|
#define NONAMELESSUNION 1
|
||||||
|
#endif
|
||||||
|
#if defined(NONAMELESSSTRUCT) && \
|
||||||
|
!defined(NONAMELESSUNION)
|
||||||
|
#define NONAMELESSUNION 1
|
||||||
|
#endif
|
||||||
|
#if defined(NONAMELESSUNION) && \
|
||||||
|
!defined(NONAMELESSSTRUCT)
|
||||||
|
#define NONAMELESSSTRUCT 1
|
||||||
|
#endif
|
||||||
|
#if !defined(__GNU_EXTENSION)
|
||||||
|
#if defined(__GNUC__) || defined(__GNUG__)
|
||||||
|
#define __GNU_EXTENSION __extension__
|
||||||
|
#else
|
||||||
|
#define __GNU_EXTENSION
|
||||||
|
#endif
|
||||||
|
#endif /* __extension__ */
|
||||||
|
|
||||||
|
#ifndef __ANONYMOUS_DEFINED
|
||||||
|
#define __ANONYMOUS_DEFINED
|
||||||
|
#if defined(__GNUC__) || defined(__GNUG__)
|
||||||
|
#define _ANONYMOUS_UNION __extension__
|
||||||
|
#define _ANONYMOUS_STRUCT __extension__
|
||||||
|
#else
|
||||||
|
#define _ANONYMOUS_UNION
|
||||||
|
#define _ANONYMOUS_STRUCT
|
||||||
|
#endif
|
||||||
|
#ifndef NONAMELESSUNION
|
||||||
|
#define _UNION_NAME(x)
|
||||||
|
#define _STRUCT_NAME(x)
|
||||||
|
#else /* NONAMELESSUNION */
|
||||||
|
#define _UNION_NAME(x) x
|
||||||
|
#define _STRUCT_NAME(x) x
|
||||||
|
#endif
|
||||||
|
#endif /* __ANONYMOUS_DEFINED */
|
||||||
|
|
||||||
|
#ifndef DUMMYUNIONNAME
|
||||||
|
# ifdef NONAMELESSUNION
|
||||||
|
# define DUMMYUNIONNAME u
|
||||||
|
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
|
||||||
|
# define DUMMYUNIONNAME2 u2
|
||||||
|
# define DUMMYUNIONNAME3 u3
|
||||||
|
# define DUMMYUNIONNAME4 u4
|
||||||
|
# define DUMMYUNIONNAME5 u5
|
||||||
|
# define DUMMYUNIONNAME6 u6
|
||||||
|
# define DUMMYUNIONNAME7 u7
|
||||||
|
# define DUMMYUNIONNAME8 u8
|
||||||
|
# define DUMMYUNIONNAME9 u9
|
||||||
|
# else /* NONAMELESSUNION */
|
||||||
|
# define DUMMYUNIONNAME
|
||||||
|
# define DUMMYUNIONNAME1 /* Wine uses this variant */
|
||||||
|
# define DUMMYUNIONNAME2
|
||||||
|
# define DUMMYUNIONNAME3
|
||||||
|
# define DUMMYUNIONNAME4
|
||||||
|
# define DUMMYUNIONNAME5
|
||||||
|
# define DUMMYUNIONNAME6
|
||||||
|
# define DUMMYUNIONNAME7
|
||||||
|
# define DUMMYUNIONNAME8
|
||||||
|
# define DUMMYUNIONNAME9
|
||||||
|
# endif
|
||||||
|
#endif /* DUMMYUNIONNAME */
|
||||||
|
|
||||||
|
#if !defined(DUMMYUNIONNAME1) /* MinGW does not define this one */
|
||||||
|
# ifdef NONAMELESSUNION
|
||||||
|
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
|
||||||
|
# else
|
||||||
|
# define DUMMYUNIONNAME1 /* Wine uses this variant */
|
||||||
|
# endif
|
||||||
|
#endif /* DUMMYUNIONNAME1 */
|
||||||
|
|
||||||
|
#ifndef DUMMYSTRUCTNAME
|
||||||
|
# ifdef NONAMELESSUNION
|
||||||
|
# define DUMMYSTRUCTNAME s
|
||||||
|
# define DUMMYSTRUCTNAME1 s1 /* Wine uses this variant */
|
||||||
|
# define DUMMYSTRUCTNAME2 s2
|
||||||
|
# define DUMMYSTRUCTNAME3 s3
|
||||||
|
# define DUMMYSTRUCTNAME4 s4
|
||||||
|
# define DUMMYSTRUCTNAME5 s5
|
||||||
|
# else
|
||||||
|
# define DUMMYSTRUCTNAME
|
||||||
|
# define DUMMYSTRUCTNAME1 /* Wine uses this variant */
|
||||||
|
# define DUMMYSTRUCTNAME2
|
||||||
|
# define DUMMYSTRUCTNAME3
|
||||||
|
# define DUMMYSTRUCTNAME4
|
||||||
|
# define DUMMYSTRUCTNAME5
|
||||||
|
# endif
|
||||||
|
#endif /* DUMMYSTRUCTNAME */
|
||||||
|
|
||||||
|
/* These are for compatibility with the Wine source tree */
|
||||||
|
|
||||||
|
#ifndef WINELIB_NAME_AW
|
||||||
|
# ifdef __MINGW_NAME_AW
|
||||||
|
# define WINELIB_NAME_AW __MINGW_NAME_AW
|
||||||
|
# else
|
||||||
|
# ifdef UNICODE
|
||||||
|
# define WINELIB_NAME_AW(func) func##W
|
||||||
|
# else
|
||||||
|
# define WINELIB_NAME_AW(func) func##A
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif /* WINELIB_NAME_AW */
|
||||||
|
|
||||||
|
#ifndef DECL_WINELIB_TYPE_AW
|
||||||
|
# ifdef __MINGW_TYPEDEF_AW
|
||||||
|
# define DECL_WINELIB_TYPE_AW __MINGW_TYPEDEF_AW
|
||||||
|
# else
|
||||||
|
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
|
||||||
|
# endif
|
||||||
|
#endif /* DECL_WINELIB_TYPE_AW */
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,239 @@
|
|||||||
|
/*
|
||||||
|
* The Wine project - Xinput Joystick Library
|
||||||
|
* Copyright 2008 Andrew Fenn
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __WINE_XINPUT_H
|
||||||
|
#define __WINE_XINPUT_H
|
||||||
|
|
||||||
|
#include <windef.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bitmasks for the joysticks buttons, determines what has
|
||||||
|
* been pressed on the joystick, these need to be mapped
|
||||||
|
* to whatever device you're using instead of an xbox 360
|
||||||
|
* joystick
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||||
|
#define XINPUT_GAMEPAD_START 0x0010
|
||||||
|
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||||
|
#define XINPUT_GAMEPAD_A 0x1000
|
||||||
|
#define XINPUT_GAMEPAD_B 0x2000
|
||||||
|
#define XINPUT_GAMEPAD_X 0x4000
|
||||||
|
#define XINPUT_GAMEPAD_Y 0x8000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the flags used to determine if the user is pushing
|
||||||
|
* down on a button, not holding a button, etc
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
|
||||||
|
#define XINPUT_KEYSTROKE_KEYUP 0x0002
|
||||||
|
#define XINPUT_KEYSTROKE_REPEAT 0x0004
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the codes which are returned by XInputGetKeystroke
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define VK_PAD_A 0x5800
|
||||||
|
#define VK_PAD_B 0x5801
|
||||||
|
#define VK_PAD_X 0x5802
|
||||||
|
#define VK_PAD_Y 0x5803
|
||||||
|
#define VK_PAD_RSHOULDER 0x5804
|
||||||
|
#define VK_PAD_LSHOULDER 0x5805
|
||||||
|
#define VK_PAD_LTRIGGER 0x5806
|
||||||
|
#define VK_PAD_RTRIGGER 0x5807
|
||||||
|
#define VK_PAD_DPAD_UP 0x5810
|
||||||
|
#define VK_PAD_DPAD_DOWN 0x5811
|
||||||
|
#define VK_PAD_DPAD_LEFT 0x5812
|
||||||
|
#define VK_PAD_DPAD_RIGHT 0x5813
|
||||||
|
#define VK_PAD_START 0x5814
|
||||||
|
#define VK_PAD_BACK 0x5815
|
||||||
|
#define VK_PAD_LTHUMB_PRESS 0x5816
|
||||||
|
#define VK_PAD_RTHUMB_PRESS 0x5817
|
||||||
|
#define VK_PAD_LTHUMB_UP 0x5820
|
||||||
|
#define VK_PAD_LTHUMB_DOWN 0x5821
|
||||||
|
#define VK_PAD_LTHUMB_RIGHT 0x5822
|
||||||
|
#define VK_PAD_LTHUMB_LEFT 0x5823
|
||||||
|
#define VK_PAD_LTHUMB_UPLEFT 0x5824
|
||||||
|
#define VK_PAD_LTHUMB_UPRIGHT 0x5825
|
||||||
|
#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
|
||||||
|
#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
|
||||||
|
#define VK_PAD_RTHUMB_UP 0x5830
|
||||||
|
#define VK_PAD_RTHUMB_DOWN 0x5831
|
||||||
|
#define VK_PAD_RTHUMB_RIGHT 0x5832
|
||||||
|
#define VK_PAD_RTHUMB_LEFT 0x5833
|
||||||
|
#define VK_PAD_RTHUMB_UPLEFT 0x5834
|
||||||
|
#define VK_PAD_RTHUMB_UPRIGHT 0x5835
|
||||||
|
#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
|
||||||
|
#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deadzones are for analogue joystick controls on the joypad
|
||||||
|
* which determine when input should be assumed to be in the
|
||||||
|
* middle of the pad. This is a threshold to stop a joypad
|
||||||
|
* controlling the game when the player isn't touching the
|
||||||
|
* controls.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
|
||||||
|
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines what type of abilities the type of joystick has
|
||||||
|
* DEVTYPE_GAMEPAD is available for all joysticks, however
|
||||||
|
* there may be more specific identifiers for other joysticks
|
||||||
|
* which are being used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_DEVTYPE_GAMEPAD 0x01
|
||||||
|
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
|
||||||
|
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
|
||||||
|
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
|
||||||
|
#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
|
||||||
|
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
|
||||||
|
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
|
||||||
|
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These are used with the XInputGetCapabilities function to
|
||||||
|
* determine the abilities to the joystick which has been
|
||||||
|
* plugged in.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
|
||||||
|
#define XINPUT_FLAG_GAMEPAD 0x00000001
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the status of the battery if one is used in the
|
||||||
|
* attached joystick. The first two define if the joystick
|
||||||
|
* supports a battery. Disconnected means that the joystick
|
||||||
|
* isn't connected. Wired shows that the joystick is a wired
|
||||||
|
* joystick.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BATTERY_DEVTYPE_GAMEPAD 0x00
|
||||||
|
#define BATTERY_DEVTYPE_HEADSET 0x01
|
||||||
|
#define BATTERY_TYPE_DISCONNECTED 0x00
|
||||||
|
#define BATTERY_TYPE_WIRED 0x01
|
||||||
|
#define BATTERY_TYPE_ALKALINE 0x02
|
||||||
|
#define BATTERY_TYPE_NIMH 0x03
|
||||||
|
#define BATTERY_TYPE_UNKNOWN 0xFF
|
||||||
|
#define BATTERY_LEVEL_EMPTY 0x00
|
||||||
|
#define BATTERY_LEVEL_LOW 0x01
|
||||||
|
#define BATTERY_LEVEL_MEDIUM 0x02
|
||||||
|
#define BATTERY_LEVEL_FULL 0x03
|
||||||
|
|
||||||
|
/*
|
||||||
|
* How many joysticks can be used with this library. Games that
|
||||||
|
* use the xinput library will not go over this number.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XUSER_MAX_COUNT 4
|
||||||
|
#define XUSER_INDEX_ANY 0x000000FF
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure of an xbox 360 joystick.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _XINPUT_GAMEPAD {
|
||||||
|
WORD wButtons;
|
||||||
|
BYTE bLeftTrigger;
|
||||||
|
BYTE bRightTrigger;
|
||||||
|
SHORT sThumbLX;
|
||||||
|
SHORT sThumbLY;
|
||||||
|
SHORT sThumbRX;
|
||||||
|
SHORT sThumbRY;
|
||||||
|
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_STATE {
|
||||||
|
DWORD dwPacketNumber;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
} XINPUT_STATE, *PXINPUT_STATE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure of how much vibration is set on both the
|
||||||
|
* right and left motors in a joystick. If you're not using a 360
|
||||||
|
* joystick you will have to map these to your device.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _XINPUT_VIBRATION {
|
||||||
|
WORD wLeftMotorSpeed;
|
||||||
|
WORD wRightMotorSpeed;
|
||||||
|
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure for what kind of abilities the joystick has
|
||||||
|
* such abilities are things such as if the joystick has the ability
|
||||||
|
* to send and receive audio, if the joystick is in fact a driving
|
||||||
|
* wheel or perhaps if the joystick is some kind of dance pad or
|
||||||
|
* guitar.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _XINPUT_CAPABILITIES {
|
||||||
|
BYTE Type;
|
||||||
|
BYTE SubType;
|
||||||
|
WORD Flags;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
XINPUT_VIBRATION Vibration;
|
||||||
|
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure for a joystick input event which is
|
||||||
|
* retrieved using the function XInputGetKeystroke
|
||||||
|
*/
|
||||||
|
typedef struct _XINPUT_KEYSTROKE {
|
||||||
|
WORD VirtualKey;
|
||||||
|
WCHAR Unicode;
|
||||||
|
WORD Flags;
|
||||||
|
BYTE UserIndex;
|
||||||
|
BYTE HidCode;
|
||||||
|
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_BATTERY_INFORMATION
|
||||||
|
{
|
||||||
|
BYTE BatteryType;
|
||||||
|
BYTE BatteryLevel;
|
||||||
|
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void WINAPI XInputEnable(WINBOOL);
|
||||||
|
DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*);
|
||||||
|
DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*);
|
||||||
|
DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE);
|
||||||
|
DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*);
|
||||||
|
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*);
|
||||||
|
DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __WINE_XINPUT_H */
|
||||||
+102
@@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="fractional_scale_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2022 Kenny Levinsen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="Protocol for requesting fractional surface scales">
|
||||||
|
This protocol allows a compositor to suggest for surfaces to render at
|
||||||
|
fractional scales.
|
||||||
|
|
||||||
|
A client can submit scaled content by utilizing wp_viewport. This is done by
|
||||||
|
creating a wp_viewport object for the surface and setting the destination
|
||||||
|
rectangle to the surface size before the scale factor is applied.
|
||||||
|
|
||||||
|
The buffer size is calculated by multiplying the surface size by the
|
||||||
|
intended scale.
|
||||||
|
|
||||||
|
The wl_surface buffer scale should remain set to 1.
|
||||||
|
|
||||||
|
If a surface has a surface-local size of 100 px by 50 px and wishes to
|
||||||
|
submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
|
||||||
|
be used and the wp_viewport destination rectangle should be 100 px by 50 px.
|
||||||
|
|
||||||
|
For toplevel surfaces, the size is rounded halfway away from zero. The
|
||||||
|
rounding algorithm for subsurface position and size is not defined.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="wp_fractional_scale_manager_v1" version="1">
|
||||||
|
<description summary="fractional surface scale information">
|
||||||
|
A global interface for requesting surfaces to use fractional scales.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="unbind the fractional surface scale interface">
|
||||||
|
Informs the server that the client will not be using this protocol
|
||||||
|
object anymore. This does not affect any other objects,
|
||||||
|
wp_fractional_scale_v1 objects included.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="fractional_scale_exists" value="0"
|
||||||
|
summary="the surface already has a fractional_scale object associated"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="get_fractional_scale">
|
||||||
|
<description summary="extend surface interface for scale information">
|
||||||
|
Create an add-on object for the the wl_surface to let the compositor
|
||||||
|
request fractional scales. If the given wl_surface already has a
|
||||||
|
wp_fractional_scale_v1 object associated, the fractional_scale_exists
|
||||||
|
protocol error is raised.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="wp_fractional_scale_v1"
|
||||||
|
summary="the new surface scale info interface id"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the surface"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="wp_fractional_scale_v1" version="1">
|
||||||
|
<description summary="fractional scale interface to a wl_surface">
|
||||||
|
An additional interface to a wl_surface object which allows the compositor
|
||||||
|
to inform the client of the preferred scale.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="remove surface scale information for surface">
|
||||||
|
Destroy the fractional scale object. When this object is destroyed,
|
||||||
|
preferred_scale events will no longer be sent.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="preferred_scale">
|
||||||
|
<description summary="notify of new preferred scale">
|
||||||
|
Notification of a new preferred scale for this surface that the
|
||||||
|
compositor suggests that the client should use.
|
||||||
|
|
||||||
|
The sent scale is the numerator of a fraction with a denominator of 120.
|
||||||
|
</description>
|
||||||
|
<arg name="scale" type="uint" summary="the new preferred scale"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="idle_inhibit_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2015 Samsung Electronics Co., Ltd
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="zwp_idle_inhibit_manager_v1" version="1">
|
||||||
|
<description summary="control behavior when display idles">
|
||||||
|
This interface permits inhibiting the idle behavior such as screen
|
||||||
|
blanking, locking, and screensaving. The client binds the idle manager
|
||||||
|
globally, then creates idle-inhibitor objects for each surface.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible changes
|
||||||
|
may be added together with the corresponding interface version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version number in
|
||||||
|
the protocol and interface names and resetting the interface version.
|
||||||
|
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||||
|
version number in the protocol and interface names are removed and the
|
||||||
|
interface version number is reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the idle inhibitor object">
|
||||||
|
Destroy the inhibit manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="create_inhibitor">
|
||||||
|
<description summary="create a new inhibitor object">
|
||||||
|
Create a new inhibitor object associated with the given surface.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_idle_inhibitor_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the surface that inhibits the idle behavior"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_idle_inhibitor_v1" version="1">
|
||||||
|
<description summary="context object for inhibiting idle behavior">
|
||||||
|
An idle inhibitor prevents the output that the associated surface is
|
||||||
|
visible on from being set to a state where it is not visually usable due
|
||||||
|
to lack of user interaction (e.g. blanked, dimmed, locked, set to power
|
||||||
|
save, etc.) Any screensaver processes are also blocked from displaying.
|
||||||
|
|
||||||
|
If the surface is destroyed, unmapped, becomes occluded, loses
|
||||||
|
visibility, or otherwise becomes not visually relevant for the user, the
|
||||||
|
idle inhibitor will not be honored by the compositor; if the surface
|
||||||
|
subsequently regains visibility the inhibitor takes effect once again.
|
||||||
|
Likewise, the inhibitor isn't honored if the system was already idled at
|
||||||
|
the time the inhibitor was established, although if the system later
|
||||||
|
de-idles and re-idles the inhibitor will take effect.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the idle inhibitor object">
|
||||||
|
Remove the inhibitor effect from the associated wl_surface.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
+339
@@ -0,0 +1,339 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="pointer_constraints_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for constraining pointer motions">
|
||||||
|
This protocol specifies a set of interfaces used for adding constraints to
|
||||||
|
the motion of a pointer. Possible constraints include confining pointer
|
||||||
|
motions to a given region, or locking it to its current position.
|
||||||
|
|
||||||
|
In order to constrain the pointer, a client must first bind the global
|
||||||
|
interface "wp_pointer_constraints" which, if a compositor supports pointer
|
||||||
|
constraints, is exposed by the registry. Using the bound global object, the
|
||||||
|
client uses the request that corresponds to the type of constraint it wants
|
||||||
|
to make. See wp_pointer_constraints for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_pointer_constraints_v1" version="1">
|
||||||
|
<description summary="constrain the movement of a pointer">
|
||||||
|
The global interface exposing pointer constraining functionality. It
|
||||||
|
exposes two requests: lock_pointer for locking the pointer to its
|
||||||
|
position, and confine_pointer for locking the pointer to a region.
|
||||||
|
|
||||||
|
The lock_pointer and confine_pointer requests create the objects
|
||||||
|
wp_locked_pointer and wp_confined_pointer respectively, and the client can
|
||||||
|
use these objects to interact with the lock.
|
||||||
|
|
||||||
|
For any surface, only one lock or confinement may be active across all
|
||||||
|
wl_pointer objects of the same seat. If a lock or confinement is requested
|
||||||
|
when another lock or confinement is active or requested on the same surface
|
||||||
|
and with any of the wl_pointer objects of the same seat, an
|
||||||
|
'already_constrained' error will be raised.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<description summary="wp_pointer_constraints error values">
|
||||||
|
These errors can be emitted in response to wp_pointer_constraints
|
||||||
|
requests.
|
||||||
|
</description>
|
||||||
|
<entry name="already_constrained" value="1"
|
||||||
|
summary="pointer constraint already requested on that surface"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<enum name="lifetime">
|
||||||
|
<description summary="constraint lifetime">
|
||||||
|
These values represent different lifetime semantics. They are passed
|
||||||
|
as arguments to the factory requests to specify how the constraint
|
||||||
|
lifetimes should be managed.
|
||||||
|
</description>
|
||||||
|
<entry name="oneshot" value="1">
|
||||||
|
<description summary="the pointer constraint is defunct once deactivated">
|
||||||
|
A oneshot pointer constraint will never reactivate once it has been
|
||||||
|
deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="persistent" value="2">
|
||||||
|
<description summary="the pointer constraint may reactivate">
|
||||||
|
A persistent pointer constraint may again reactivate once it has
|
||||||
|
been deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the pointer constraints manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
pointer constraints object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="lock_pointer">
|
||||||
|
<description summary="lock pointer to a position">
|
||||||
|
The lock_pointer request lets the client request to disable movements of
|
||||||
|
the virtual pointer (i.e. the cursor), effectively locking the pointer
|
||||||
|
to a position. This request may not take effect immediately; in the
|
||||||
|
future, when the compositor deems implementation-specific constraints
|
||||||
|
are satisfied, the pointer lock will be activated and the compositor
|
||||||
|
sends a locked event.
|
||||||
|
|
||||||
|
The protocol provides no guarantee that the constraints are ever
|
||||||
|
satisfied, and does not require the compositor to send an error if the
|
||||||
|
constraints cannot ever be satisfied. It is thus possible to request a
|
||||||
|
lock that will never activate.
|
||||||
|
|
||||||
|
There may not be another pointer constraint of any kind requested or
|
||||||
|
active on the surface for any of the wl_pointer objects of the seat of
|
||||||
|
the passed pointer when requesting a lock. If there is, an error will be
|
||||||
|
raised. See general pointer lock documentation for more details.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the lock to activate. It is up to the compositor whether to
|
||||||
|
warp the pointer or require some kind of user interaction for the lock
|
||||||
|
to activate. If the region is null the surface input region is used.
|
||||||
|
|
||||||
|
A surface may receive pointer focus without the lock being activated.
|
||||||
|
|
||||||
|
The request creates a new object wp_locked_pointer which is used to
|
||||||
|
interact with the lock as well as receive updates about its state. See
|
||||||
|
the the description of wp_locked_pointer for further information.
|
||||||
|
|
||||||
|
Note that while a pointer is locked, the wl_pointer objects of the
|
||||||
|
corresponding seat will not emit any wl_pointer.motion events, but
|
||||||
|
relative motion events will still be emitted via wp_relative_pointer
|
||||||
|
objects of the same seat. wl_pointer.axis and wl_pointer.button events
|
||||||
|
are unaffected.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be locked"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="confine_pointer">
|
||||||
|
<description summary="confine pointer to a region">
|
||||||
|
The confine_pointer request lets the client request to confine the
|
||||||
|
pointer cursor to a given region. This request may not take effect
|
||||||
|
immediately; in the future, when the compositor deems implementation-
|
||||||
|
specific constraints are satisfied, the pointer confinement will be
|
||||||
|
activated and the compositor sends a confined event.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the confinement to activate. It is up to the compositor
|
||||||
|
whether to warp the pointer or require some kind of user interaction for
|
||||||
|
the confinement to activate. If the region is null the surface input
|
||||||
|
region is used.
|
||||||
|
|
||||||
|
The request will create a new object wp_confined_pointer which is used
|
||||||
|
to interact with the confinement as well as receive updates about its
|
||||||
|
state. See the the description of wp_confined_pointer for further
|
||||||
|
information.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be confined"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_locked_pointer_v1" version="1">
|
||||||
|
<description summary="receive relative pointer motion events">
|
||||||
|
The wp_locked_pointer interface represents a locked pointer state.
|
||||||
|
|
||||||
|
While the lock of this object is active, the wl_pointer objects of the
|
||||||
|
associated seat will not emit any wl_pointer.motion events.
|
||||||
|
|
||||||
|
This object will send the event 'locked' when the lock is activated.
|
||||||
|
Whenever the lock is activated, it is guaranteed that the locked surface
|
||||||
|
will already have received pointer focus and that the pointer will be
|
||||||
|
within the region passed to the request creating this object.
|
||||||
|
|
||||||
|
To unlock the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_locked_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unlock the pointer the unlocked event is
|
||||||
|
sent. See wp_locked_pointer.unlock for details.
|
||||||
|
|
||||||
|
When unlocking, the compositor may warp the cursor position to the set
|
||||||
|
cursor position hint. If it does, it will not result in any relative
|
||||||
|
motion events emitted via wp_relative_pointer.
|
||||||
|
|
||||||
|
If the surface the lock was requested on is destroyed and the lock is not
|
||||||
|
yet activated, the wp_locked_pointer object is now defunct and must be
|
||||||
|
destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the locked pointer object">
|
||||||
|
Destroy the locked pointer object. If applicable, the compositor will
|
||||||
|
unlock the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_cursor_position_hint">
|
||||||
|
<description summary="set the pointer cursor position hint">
|
||||||
|
Set the cursor position hint relative to the top left corner of the
|
||||||
|
surface.
|
||||||
|
|
||||||
|
If the client is drawing its own cursor, it should update the position
|
||||||
|
hint to the position of its own cursor. A compositor may use this
|
||||||
|
information to warp the pointer upon unlock in order to avoid pointer
|
||||||
|
jumps.
|
||||||
|
|
||||||
|
The cursor position hint is double buffered. The new hint will only take
|
||||||
|
effect when the associated surface gets it pending state applied. See
|
||||||
|
wl_surface.commit for details.
|
||||||
|
</description>
|
||||||
|
<arg name="surface_x" type="fixed"
|
||||||
|
summary="surface-local x coordinate"/>
|
||||||
|
<arg name="surface_y" type="fixed"
|
||||||
|
summary="surface-local y coordinate"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new lock region">
|
||||||
|
Set a new region used to lock the pointer.
|
||||||
|
|
||||||
|
The new lock region is double-buffered. The new lock region will
|
||||||
|
only take effect when the associated surface gets its pending state
|
||||||
|
applied. See wl_surface.commit for details.
|
||||||
|
|
||||||
|
For details about the lock region, see wp_locked_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="locked">
|
||||||
|
<description summary="lock activation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unlocked">
|
||||||
|
<description summary="lock deactivation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is no longer
|
||||||
|
active. If this is a oneshot pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer lock may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_confined_pointer_v1" version="1">
|
||||||
|
<description summary="confined pointer object">
|
||||||
|
The wp_confined_pointer interface represents a confined pointer state.
|
||||||
|
|
||||||
|
This object will send the event 'confined' when the confinement is
|
||||||
|
activated. Whenever the confinement is activated, it is guaranteed that
|
||||||
|
the surface the pointer is confined to will already have received pointer
|
||||||
|
focus and that the pointer will be within the region passed to the request
|
||||||
|
creating this object. It is up to the compositor to decide whether this
|
||||||
|
requires some user interaction and if the pointer will warp to within the
|
||||||
|
passed region if outside.
|
||||||
|
|
||||||
|
To unconfine the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_confined_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unconfine the pointer the unconfined event is
|
||||||
|
sent. The wp_confined_pointer object is at this point defunct and should
|
||||||
|
be destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the confined pointer object">
|
||||||
|
Destroy the confined pointer object. If applicable, the compositor will
|
||||||
|
unconfine the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new confine region">
|
||||||
|
Set a new region used to confine the pointer.
|
||||||
|
|
||||||
|
The new confine region is double-buffered. The new confine region will
|
||||||
|
only take effect when the associated surface gets its pending state
|
||||||
|
applied. See wl_surface.commit for details.
|
||||||
|
|
||||||
|
If the confinement is active when the new confinement region is applied
|
||||||
|
and the pointer ends up outside of newly applied region, the pointer may
|
||||||
|
warped to a position within the new confinement region. If warped, a
|
||||||
|
wl_pointer.motion event will be emitted, but no
|
||||||
|
wp_relative_pointer.relative_motion event.
|
||||||
|
|
||||||
|
The compositor may also, instead of using the new region, unconfine the
|
||||||
|
pointer.
|
||||||
|
|
||||||
|
For details about the confine region, see wp_confined_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="confined">
|
||||||
|
<description summary="pointer confined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is
|
||||||
|
activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unconfined">
|
||||||
|
<description summary="pointer unconfined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is no
|
||||||
|
longer active. If this is a oneshot pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer confinement may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="relative_pointer_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for relative pointer motion events">
|
||||||
|
This protocol specifies a set of interfaces used for making clients able to
|
||||||
|
receive relative pointer events not obstructed by barriers (such as the
|
||||||
|
monitor edge or other pointer barriers).
|
||||||
|
|
||||||
|
To start receiving relative pointer events, a client must first bind the
|
||||||
|
global interface "wp_relative_pointer_manager" which, if a compositor
|
||||||
|
supports relative pointer motion events, is exposed by the registry. After
|
||||||
|
having created the relative pointer manager proxy object, the client uses
|
||||||
|
it to create the actual relative pointer object using the
|
||||||
|
"get_relative_pointer" request given a wl_pointer. The relative pointer
|
||||||
|
motion events will then, when applicable, be transmitted via the proxy of
|
||||||
|
the newly created relative pointer object. See the documentation of the
|
||||||
|
relative pointer interface for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_manager_v1" version="1">
|
||||||
|
<description summary="get relative pointer objects">
|
||||||
|
A global interface used for getting the relative pointer object for a
|
||||||
|
given pointer.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the relative pointer manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
relative pointer manager object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_relative_pointer">
|
||||||
|
<description summary="get a relative pointer object">
|
||||||
|
Create a relative pointer interface given a wl_pointer object. See the
|
||||||
|
wp_relative_pointer interface for more details.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_v1" version="1">
|
||||||
|
<description summary="relative pointer object">
|
||||||
|
A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||||
|
used for emitting relative pointer events. It shares the same focus as
|
||||||
|
wl_pointer objects of the same seat and will only emit events when it has
|
||||||
|
focus.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="release the relative pointer object"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="relative_motion">
|
||||||
|
<description summary="relative pointer motion">
|
||||||
|
Relative x/y pointer motion from the pointer of the seat associated with
|
||||||
|
this object.
|
||||||
|
|
||||||
|
A relative motion is in the same dimension as regular wl_pointer motion
|
||||||
|
events, except they do not represent an absolute position. For example,
|
||||||
|
moving a pointer from (x, y) to (x', y') would have the equivalent
|
||||||
|
relative motion (x' - x, y' - y). If a pointer motion caused the
|
||||||
|
absolute pointer position to be clipped by for example the edge of the
|
||||||
|
monitor, the relative motion is unaffected by the clipping and will
|
||||||
|
represent the unclipped motion.
|
||||||
|
|
||||||
|
This event also contains non-accelerated motion deltas. The
|
||||||
|
non-accelerated delta is, when applicable, the regular pointer motion
|
||||||
|
delta as it was before having applied motion acceleration and other
|
||||||
|
transformations such as normalization.
|
||||||
|
|
||||||
|
Note that the non-accelerated delta does not represent 'raw' events as
|
||||||
|
they were read from some device. Pointer motion acceleration is device-
|
||||||
|
and configuration-specific and non-accelerated deltas and accelerated
|
||||||
|
deltas may have the same value on some devices.
|
||||||
|
|
||||||
|
Relative motions are not coupled to wl_pointer.motion events, and can be
|
||||||
|
sent in combination with such events, but also independently. There may
|
||||||
|
also be scenarios where wl_pointer.motion is sent, but there is no
|
||||||
|
relative motion. The order of an absolute and relative motion event
|
||||||
|
originating from the same physical motion is not guaranteed.
|
||||||
|
|
||||||
|
If the client needs button events or focus state, it can receive them
|
||||||
|
from a wl_pointer object of the same seat that the wp_relative_pointer
|
||||||
|
object is associated with.
|
||||||
|
</description>
|
||||||
|
<arg name="utime_hi" type="uint"
|
||||||
|
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="utime_lo" type="uint"
|
||||||
|
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="dx" type="fixed"
|
||||||
|
summary="the x component of the motion vector"/>
|
||||||
|
<arg name="dy" type="fixed"
|
||||||
|
summary="the y component of the motion vector"/>
|
||||||
|
<arg name="dx_unaccel" type="fixed"
|
||||||
|
summary="the x component of the unaccelerated motion vector"/>
|
||||||
|
<arg name="dy_unaccel" type="fixed"
|
||||||
|
summary="the y component of the unaccelerated motion vector"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="viewporter">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2013-2016 Collabora, Ltd.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="wp_viewporter" version="1">
|
||||||
|
<description summary="surface cropping and scaling">
|
||||||
|
The global interface exposing surface cropping and scaling
|
||||||
|
capabilities is used to instantiate an interface extension for a
|
||||||
|
wl_surface object. This extended interface will then allow
|
||||||
|
cropping and scaling the surface contents, effectively
|
||||||
|
disconnecting the direct relationship between the buffer and the
|
||||||
|
surface size.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="unbind from the cropping and scaling interface">
|
||||||
|
Informs the server that the client will not be using this
|
||||||
|
protocol object anymore. This does not affect any other objects,
|
||||||
|
wp_viewport objects included.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="viewport_exists" value="0"
|
||||||
|
summary="the surface already has a viewport object associated"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="get_viewport">
|
||||||
|
<description summary="extend surface interface for crop and scale">
|
||||||
|
Instantiate an interface extension for the given wl_surface to
|
||||||
|
crop and scale its content. If the given wl_surface already has
|
||||||
|
a wp_viewport object associated, the viewport_exists
|
||||||
|
protocol error is raised.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="wp_viewport"
|
||||||
|
summary="the new viewport interface id"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the surface"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="wp_viewport" version="1">
|
||||||
|
<description summary="crop and scale interface to a wl_surface">
|
||||||
|
An additional interface to a wl_surface object, which allows the
|
||||||
|
client to specify the cropping and scaling of the surface
|
||||||
|
contents.
|
||||||
|
|
||||||
|
This interface works with two concepts: the source rectangle (src_x,
|
||||||
|
src_y, src_width, src_height), and the destination size (dst_width,
|
||||||
|
dst_height). The contents of the source rectangle are scaled to the
|
||||||
|
destination size, and content outside the source rectangle is ignored.
|
||||||
|
This state is double-buffered, and is applied on the next
|
||||||
|
wl_surface.commit.
|
||||||
|
|
||||||
|
The two parts of crop and scale state are independent: the source
|
||||||
|
rectangle, and the destination size. Initially both are unset, that
|
||||||
|
is, no scaling is applied. The whole of the current wl_buffer is
|
||||||
|
used as the source, and the surface size is as defined in
|
||||||
|
wl_surface.attach.
|
||||||
|
|
||||||
|
If the destination size is set, it causes the surface size to become
|
||||||
|
dst_width, dst_height. The source (rectangle) is scaled to exactly
|
||||||
|
this size. This overrides whatever the attached wl_buffer size is,
|
||||||
|
unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
|
||||||
|
has no content and therefore no size. Otherwise, the size is always
|
||||||
|
at least 1x1 in surface local coordinates.
|
||||||
|
|
||||||
|
If the source rectangle is set, it defines what area of the wl_buffer is
|
||||||
|
taken as the source. If the source rectangle is set and the destination
|
||||||
|
size is not set, then src_width and src_height must be integers, and the
|
||||||
|
surface size becomes the source rectangle size. This results in cropping
|
||||||
|
without scaling. If src_width or src_height are not integers and
|
||||||
|
destination size is not set, the bad_size protocol error is raised when
|
||||||
|
the surface state is applied.
|
||||||
|
|
||||||
|
The coordinate transformations from buffer pixel coordinates up to
|
||||||
|
the surface-local coordinates happen in the following order:
|
||||||
|
1. buffer_transform (wl_surface.set_buffer_transform)
|
||||||
|
2. buffer_scale (wl_surface.set_buffer_scale)
|
||||||
|
3. crop and scale (wp_viewport.set*)
|
||||||
|
This means, that the source rectangle coordinates of crop and scale
|
||||||
|
are given in the coordinates after the buffer transform and scale,
|
||||||
|
i.e. in the coordinates that would be the surface-local coordinates
|
||||||
|
if the crop and scale was not applied.
|
||||||
|
|
||||||
|
If src_x or src_y are negative, the bad_value protocol error is raised.
|
||||||
|
Otherwise, if the source rectangle is partially or completely outside of
|
||||||
|
the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
|
||||||
|
when the surface state is applied. A NULL wl_buffer does not raise the
|
||||||
|
out_of_buffer error.
|
||||||
|
|
||||||
|
If the wl_surface associated with the wp_viewport is destroyed,
|
||||||
|
all wp_viewport requests except 'destroy' raise the protocol error
|
||||||
|
no_surface.
|
||||||
|
|
||||||
|
If the wp_viewport object is destroyed, the crop and scale
|
||||||
|
state is removed from the wl_surface. The change will be applied
|
||||||
|
on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="remove scaling and cropping from the surface">
|
||||||
|
The associated wl_surface's crop and scale state is removed.
|
||||||
|
The change is applied on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="bad_value" value="0"
|
||||||
|
summary="negative or zero values in width or height"/>
|
||||||
|
<entry name="bad_size" value="1"
|
||||||
|
summary="destination size is not integer"/>
|
||||||
|
<entry name="out_of_buffer" value="2"
|
||||||
|
summary="source rectangle extends outside of the content area"/>
|
||||||
|
<entry name="no_surface" value="3"
|
||||||
|
summary="the wl_surface was destroyed"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="set_source">
|
||||||
|
<description summary="set the source rectangle for cropping">
|
||||||
|
Set the source rectangle of the associated wl_surface. See
|
||||||
|
wp_viewport for the description, and relation to the wl_buffer
|
||||||
|
size.
|
||||||
|
|
||||||
|
If all of x, y, width and height are -1.0, the source rectangle is
|
||||||
|
unset instead. Any other set of values where width or height are zero
|
||||||
|
or negative, or x or y are negative, raise the bad_value protocol
|
||||||
|
error.
|
||||||
|
|
||||||
|
The crop and scale state is double-buffered state, and will be
|
||||||
|
applied on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="x" type="fixed" summary="source rectangle x"/>
|
||||||
|
<arg name="y" type="fixed" summary="source rectangle y"/>
|
||||||
|
<arg name="width" type="fixed" summary="source rectangle width"/>
|
||||||
|
<arg name="height" type="fixed" summary="source rectangle height"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_destination">
|
||||||
|
<description summary="set the surface size for scaling">
|
||||||
|
Set the destination size of the associated wl_surface. See
|
||||||
|
wp_viewport for the description, and relation to the wl_buffer
|
||||||
|
size.
|
||||||
|
|
||||||
|
If width is -1 and height is -1, the destination size is unset
|
||||||
|
instead. Any other pair of values for width and height that
|
||||||
|
contains zero or negative values raises the bad_value protocol
|
||||||
|
error.
|
||||||
|
|
||||||
|
The crop and scale state is double-buffered state, and will be
|
||||||
|
applied on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="width" type="int" summary="surface width"/>
|
||||||
|
<arg name="height" type="int" summary="surface height"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user