diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 21:23:03 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 21:23:03 +0300 |
| commit | dd1775a9927922c14f8679ccbc4d3ca8d5917e20 (patch) | |
| tree | 3acc442bb4a3470364b74aa82ff67cb84d555c45 /examples/hello.c | |
| parent | ecb81aeea4c0c880b3a60a0dc8418c4bf2a7cf85 (diff) | |
public api refactor
Diffstat (limited to 'examples/hello.c')
| -rw-r--r-- | examples/hello.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/hello.c b/examples/hello.c index 4c171ec..31ab18b 100644 --- a/examples/hello.c +++ b/examples/hello.c @@ -3,12 +3,12 @@ #include <stdio.h> static bool failed; -static void draw(void *ud, struct yasl_surface *surface, struct yasl_frame_context *frame) +static void draw(void *ud, struct yasl_surface *surface, struct yasl_frame *frame) { (void)ud; - int w = frame->size.x, h = frame->size.y; + int w = frame->target.size.x, h = frame->target.size.y; for (int y = 0; y < h; y++) { - uint32_t *row = frame->cpu.pixels + (size_t)y * (frame->cpu.stride_bytes / 4); + uint32_t *row = frame->target.pixels + (size_t)y * (frame->target.stride_bytes / 4); for (int x = 0; x < w; x++) { /* Red grows rightward, green downward, blue fades; opaque premultiplied ARGB. */ uint32_t r = (uint32_t)(x * 255 / (w > 1 ? w - 1 : 1)); @@ -17,16 +17,16 @@ static void draw(void *ud, struct yasl_surface *surface, struct yasl_frame_conte } } - if (!yasl_frame_present_cpu(frame, NULL, 0)) { + if (!yasl_frame_present(frame, NULL, 0)) { fprintf(stderr, "Could not present the draw target\n"); failed = true; } - if (failed) yasl_surface_destroy(surface); + if (failed) yasl_app_exit(yasl_surface_display(surface), YASL_APP_ERROR); } int main(void) { - struct yasl_window_spec window = {.title = "Hello YASL", .size = {640, 480}}; + struct yasl_window_spec window = {.title = "Hello YASL", .size_logical = {640, 480}}; struct yasl_app_desc desc = { .app_id = "org.example.hello", .window = &window, |
