Skip to content

cf_app_set_canvas_size

Category: app
GitHub: cute_app.h


Resizes the app's internal canvas to a new w/h, in pixels.

void cf_app_set_canvas_size(int w, int h);
Parameters Description
w The width in pixels to resize the canvas to.
h The height in pixels to resize the canvas to.

Remarks

Be careful about calling this function, as it will invalidate any old references from cf_app_get_canvas.

This is a one-shot override. The app's canvas is automatically recreated at window size (in points) times cf_app_get_pixel_scale on every canvas recreation event -- a window resize, moving to a display with a different pixel density, cf_app_set_size, or cf_app_set_msaa -- so a custom size lasts only until the next such event. For a persistent fixed-resolution render target (e.g. a retro/pixel-art look) make your own canvas with cf_make_canvas and draw it scaled-up with cf_draw_canvas; see the canvas_modes sample.

cf_app_get_canvas
cf_app_get_canvas_width
cf_app_get_canvas_height
cf_app_get_pixel_scale
cf_app_set_canvas_blit_filter
cf_make_canvas
cf_draw_canvas