From dd1775a9927922c14f8679ccbc4d3ca8d5917e20 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 21:23:03 +0300 Subject: public api refactor --- docs/getting-started.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'docs/getting-started.md') diff --git a/docs/getting-started.md b/docs/getting-started.md index 5e569fe..d1f284d 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -50,20 +50,20 @@ pressure, erasers, resizing, and scale changes. ## Link an application -Install the shared and static libraries into your chosen prefix. Headers, -examples, documentation, and pkg-config metadata remain in the source tree: +Install the libraries, public headers, and pkg-config metadata into your prefix: ```sh meson setup build --prefix=/usr/local --libdir=lib meson compile -C build meson install -C build -cc -std=c23 -Iinclude examples/hello.c -o hello -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lyasl +cc -std=c23 examples/hello.c -o hello $(pkg-config --cflags --libs yasl) ./hello ``` -The prefix must be writable. Use matching headers from `include/`, and adjust -the library search path and runtime path for your chosen prefix and `libdir`. -Static consumers must also link the enabled backends' dependencies. +The prefix must be writable. For a custom prefix, add its pkg-config directory +to `PKG_CONFIG_PATH` and its library directory to the runtime loader path. +Use `pkg-config --static --libs yasl` for static consumers so backend dependencies +are included. Installed native accessor headers match the built backends. A Meson application can instead vendor the source under `subprojects/yasl`: @@ -75,7 +75,7 @@ executable('my-app', 'main.c', dependencies: yasl) The subproject dependency includes headers and backend link dependencies. Public headers can be included from C++11 or newer; the library itself builds -as C23. Only the library artifacts are installed by `meson install`. +as C23. The libraries, public headers, and pkg-config metadata are installed together. ## The application cycle @@ -84,9 +84,10 @@ as C23. Only the library artifacts are installed by `meson install`. 2. In `init`, create a toplevel with a positive **logical-pixel** size and call `yasl_surface_request_frame(surface)` for the first redraw. 3. In `event`, handle the union member selected by `event->type`. Return - `YASL_APP_QUIT` for a close request; otherwise return `YASL_APP_CONTINUE`. -4. In `frame`, fill every pixel in `frame->cpu.pixels` with premultiplied - `0xAARRGGBB` and present once with `yasl_frame_present_cpu(frame, NULL, 0)`. + `YASL_APP_QUIT` for a close request, `YASL_APP_ERROR` for failure, or + `YASL_APP_CONTINUE` to keep running. +4. In `frame`, fill every pixel in `frame->target.pixels` with premultiplied + `0xAARRGGBB` and present once with `yasl_frame_present(frame, NULL, 0)`. 5. Let the runner close remaining surfaces and the display. Release your own resources in the optional `quit` callback or after `yasl_run()` returns. -- cgit v1.2.3