summaryrefslogtreecommitdiff
path: root/examples/simple_window.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 21:23:03 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 21:23:03 +0300
commitdd1775a9927922c14f8679ccbc4d3ca8d5917e20 (patch)
tree3acc442bb4a3470364b74aa82ff67cb84d555c45 /examples/simple_window.c
parentecb81aeea4c0c880b3a60a0dc8418c4bf2a7cf85 (diff)
public api refactor
Diffstat (limited to 'examples/simple_window.c')
-rw-r--r--examples/simple_window.c17
1 files changed, 9 insertions, 8 deletions
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);