diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2025-01-20 00:50:40 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2025-01-20 00:50:40 +0100 |
commit | b863aec19fa95f39ec69e0e0f66d4851c9e3a358 (patch) | |
tree | b39754f211a023c3323d19c2b2c8428503a97fa8 /examples/screenshot.c | |
parent | b077de13ec171ab1ebc3b157dd6a2dc94a104f25 (diff) | |
download | reduced_system_layer-b863aec19fa95f39ec69e0e0f66d4851c9e3a358.zip |
Wayland screenshot
Diffstat (limited to 'examples/screenshot.c')
-rw-r--r-- | examples/screenshot.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/screenshot.c b/examples/screenshot.c new file mode 100644 index 0000000..55bec95 --- /dev/null +++ b/examples/screenshot.c @@ -0,0 +1,36 @@ +#include "../graphics.c" + +i64 width = 0; +i64 height = 0; +b8 has_screenshot = 0; + +void update_and_render_frame(void) { + if (!has_screenshot) { + p_screenshot(MAX_NUM_PIXELS, &width, &height, g_platform.sketch); + has_screenshot = 1; + } + + p_wait_events(); + + draw_pixels((Brush) {0}, 0, 0, width, height, (Pixel_Buffer) { + .width = width, + .height = height, + .line_size = width, + .pixels = g_platform.sketch, + }); + + p_render_frame(); +} + +i32 main(i32 argc, c8 **argv) { + (void) argc; + (void) argv; + + g_platform = (Platform) { + .title = "Screenshot", + }; + + p_event_loop(); + + return 0; +} |