Skip to content

cf_screen_to_world

Category: draw
GitHub: cute_draw.h


Converts a coordinate from screen space to world space.

CF_V2 cf_screen_to_world(CF_V2 point);

Remarks

Screen space has the origin at the top-left of the screen with the y-axis pointing down. This matches the coordinate space mouse coordinates are given. Example:

CF_V2 p = cf_v2((float)mouse_x(), (float)mouse_y());
p = cf_screen_to_world(p);

cf_world_to_screen
cf_screen_bounds_to_world