summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 15:05:06 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 15:05:06 +0300
commit98f0d51157fa2a2b8ccaae54ed4850a88d223d01 (patch)
tree90b03d0930986620d95eb0f45c07b96e1331783c /README.md
parent339e1ad7adb8340732ee856d0f6f0d2c7f1455d1 (diff)
Simplify surface state, examples, and library installation
Diffstat (limited to 'README.md')
-rw-r--r--README.md25
1 files changed, 12 insertions, 13 deletions
diff --git a/README.md b/README.md
index 5f0d4a6..358ee7c 100644
--- a/README.md
+++ b/README.md
@@ -47,28 +47,27 @@ one with `-Dwayland=enabled` or `-Dx11=enabled`; omit one with `disabled`. Runti
selection chooses the native session and allows fallback, or you can request an
explicit backend with `yasl_display_spec.backend`.
-Include `<yasl/yasl.h>` for the core. The complete [hello.c](examples/hello.c)
-handles creation failures, drawing, dispatch, input draining, and cleanup.
-Its drawing callback fills every pixel before presenting:
+Include `<yasl/app.h>` and pass application callbacks to `yasl_run()`.
+The complete [hello.c](examples/hello.c) creates its window in `init`, handles
+close requests in `event`, and fills every pixel in its frame callback:
```c
-static void draw(struct yasl_surface *surface, struct yasl_frame *frame, void *ud)
+static void draw(void *ud, struct yasl_surface *surface, struct yasl_frame_context *frame)
{
(void)ud;
- size_t count = (size_t)frame->target.size.x * frame->target.size.y;
+ size_t count = (size_t)frame->size.x * frame->size.y;
for (size_t i = 0; i < count; i++)
- frame->target.pixels[i] = 0xff306090;
- struct yasl_damage_list damage = {.n = -1};
- if (!yasl_surface_present(surface, &frame->target, &damage)) {
- /* Arrange application error handling after returning. */
- }
+ frame->cpu.pixels[i] = 0xff306090;
+ if (!yasl_frame_present_cpu(frame, NULL, 0))
+ yasl_surface_destroy(surface);
}
```
Toplevel creation sizes are logical pixels; drawing and input use device pixels.
-Targets are borrowed for one draw callback. Keep durable content in application
-memory, dispatch events, drain input queues, then flush scheduled drawing. These
-rules are explained with examples in the application guide.
+Targets are borrowed for one frame callback. Keep durable content in application
+memory; the runner handles dispatch, input polling, pacing, and cleanup.
+Applications managing their own loop can use `<yasl/yasl.h>` directly. Both
+workflows are explained in the application guide.
## License