summaryrefslogtreecommitdiff
path: root/examples/screenshot.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/screenshot.c')
-rw-r--r--examples/screenshot.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/examples/screenshot.c b/examples/screenshot.c
index c3c0ebd..11b2385 100644
--- a/examples/screenshot.c
+++ b/examples/screenshot.c
@@ -1,23 +1,34 @@
#include "../graphics.c"
-i64 width = 0;
-i64 height = 0;
-b8 has_screenshot = 0;
+enum {
+ MAX_NUM_PIXELS = 10 * 1024 * 1024,
+};
+
+b8 has_screenshot = 0;
+i64 width = 0;
+i64 height = 0;
+vec4_f32 pixels[MAX_NUM_PIXELS] = {0};
void update_and_render_frame(void) {
if (!has_screenshot) {
- take_screenshot(MAX_NUM_PIXELS, &width, &height, g_platform.sketch);
+ take_screenshot(MAX_NUM_PIXELS, &width, &height, pixels);
has_screenshot = 1;
}
handle_main_window_events();
- draw_pixels((Brush) { .quick = 1, }, 0, 0, g_platform.real_width, g_platform.real_height, (Pixel_Buffer) {
- .width = width,
- .height = height,
- .stride = width,
- .pixels = g_platform.sketch,
- });
+ draw_pixels_quick(
+ (Box) {
+ .width = g_platform.real_width,
+ .height = g_platform.real_height,
+ },
+ (Pixel_Buffer) {
+ .width = width,
+ .height = height,
+ .stride = width,
+ .pixels = pixels,
+ }
+ );
render_main_window_frame();
}