diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -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 |
