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 --- examples/simple_window.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'examples/simple_window.c') diff --git a/examples/simple_window.c b/examples/simple_window.c index fca2f75..5a8b314 100644 --- a/examples/simple_window.c +++ b/examples/simple_window.c @@ -22,12 +22,12 @@ static const char *device_name(enum yasl_pointer_device dev) } } -static void on_draw(void *ud, struct yasl_surface *s, struct yasl_frame_context *frame) +static void on_draw(void *ud, struct yasl_surface *s, struct yasl_frame *frame) { (void)ud; - int w = frame->size.x; - int h = frame->size.y; - uint32_t *pixels = frame->cpu.pixels; + int w = frame->target.size.x; + int h = frame->target.size.y; + uint32_t *pixels = frame->target.pixels; if (!pixels || w <= 0 || h <= 0) return; @@ -80,11 +80,12 @@ static void on_draw(void *ud, struct yasl_surface *s, struct yasl_frame_context } } - if (!yasl_frame_present_cpu(frame, NULL, 0)) { + if (!yasl_frame_present(frame, NULL, 0)) { fprintf(stderr, "Failed to present frame\n"); failed = true; } - if (failed || smoke_test) yasl_surface_destroy(s); + if (failed) yasl_app_exit(yasl_surface_display(s), YASL_APP_ERROR); + else if (smoke_test) yasl_surface_destroy(s); } static enum yasl_app_result on_init(void *ud, struct yasl_display *display) @@ -92,13 +93,13 @@ static enum yasl_app_result on_init(void *ud, struct yasl_display *display) (void)ud; struct yasl_window_spec window_spec = { .title = "YASL Interactive Window (Pen & Touch Enabled)", - .size = { .x = 640, .y = 480 }, + .size_logical = { .x = 640, .y = 480 }, }; struct yasl_surface *s = yasl_surface_create_toplevel(display, &window_spec); if (!s) { fprintf(stderr, "Failed to create surface\n"); failed = true; - return YASL_APP_QUIT; + return YASL_APP_ERROR; } yasl_surface_request_frame(s); -- cgit v1.2.3