use default aspect ratio when no camera exists

This commit is contained in:
jacob 2025-05-16 09:53:01 -05:00
parent 6ac44c3de9
commit 1fbe42b3b9
2 changed files with 3 additions and 4 deletions

View File

@ -32,7 +32,7 @@
* <Delay> = <USER_INTERP_RATIO> * <Tick interval> * <Delay> = <USER_INTERP_RATIO> * <Tick interval>
* E.g: At 1.5, the user thread will render 75ms back in time if the sim runs at 50tps * E.g: At 1.5, the user thread will render 75ms back in time if the sim runs at 50tps
*/ */
#define USER_INTERP_RATIO 1.5 #define USER_INTERP_RATIO 1.2
#define USER_INTERP_ENABLED 1 #define USER_INTERP_ENABLED 1
/* 64^2 = 4096 bins */ /* 64^2 = 4096 bins */

View File

@ -777,10 +777,9 @@ INTERNAL void user_update(void)
G.ui_size = G.screen_size; G.ui_size = G.screen_size;
G.ui_screen_offset = V2(0, 0); G.ui_screen_offset = V2(0, 0);
} else { } else {
/* Determine ui size by camera & window dimensions */ /* Determine ui size by camera & window dimensions */
f32 aspect_ratio = 1.0; f32 aspect_ratio = DEFAULT_CAMERA_WIDTH / DEFAULT_CAMERA_HEIGHT;
{ if (local_camera->valid) {
struct xform quad_xf = xform_mul(sim_ent_get_xform(local_camera), local_camera->camera_quad_xform); struct xform quad_xf = xform_mul(sim_ent_get_xform(local_camera), local_camera->camera_quad_xform);
struct v2 camera_size = xform_get_scale(quad_xf); struct v2 camera_size = xform_get_scale(quad_xf);
if (!v2_is_zero(camera_size)) { if (!v2_is_zero(camera_size)) {