struct bind_state { b32 is_held; /* Is this bind held down this frame */ u32 num_presses; /* How many times was this bind's pressed since last frame */ u32 num_repeats; /* How many times was this bind's key repeated since last frame */ u32 num_presses_and_repeats; /* Same as `num_presses` but includes key repeats as well */ u32 num_releases; /* How many times was this bind released since last frame */ }; struct second_stat { u64 last_second_start; u64 last_second_end; u64 last_second; }; struct console_log { String msg; i32 level; i32 color_index; P_DateTime datetime; i64 time_ns; Rect bounds; struct console_log *prev; struct console_log *next; }; Global struct { Atomic32 shutdown; P_Counter shutdown_job_counters; P_Window *window; G_Swapchain *swapchain; struct sim_ctx *local_sim_ctx; Arena *arena; String connect_address_str; ClientStore *user_client_store; Client *user_unblended_client; /* Contains snapshots received from local sim */ Client *user_blended_client; /* Contains single snapshot from result of blending local sim snapshots */ Snapshot *ss_blended; /* Points to blended snapshot contained in blended client */ /* Usage stats */ i64 last_second_reset_ns; struct second_stat net_bytes_read; struct second_stat net_bytes_sent; /* Gpu resources */ G_RenderSig *render_sig; struct bind_state bind_states[USER_BIND_KIND_COUNT]; /* Debug camera */ EntId debug_following; b32 debug_camera; b32 debug_camera_panning; V2 debug_camera_pan_start; b32 debug_draw; /* Debug console */ P_Mutex console_logs_mutex; Arena *console_logs_arena; struct console_log *first_console_log; struct console_log *last_console_log; i32 console_log_color_indices[P_LogLevel_Count]; f32 console_logs_height; b32 debug_console; /* Window -> user */ P_Mutex sys_window_events_mutex; Arena *sys_window_events_arena; /* User -> local sim */ P_Mutex user_sim_cmd_mutex; ControlData user_sim_cmd_control; EntId user_hovered_ent; u64 last_user_sim_cmd_gen; u64 user_sim_cmd_gen; Atomic32 user_paused; Atomic32 user_paused_steps; /* Local sim -> user */ P_Mutex local_to_user_client_mutex; ClientStore *local_to_user_client_store; Client *local_to_user_client; i64 local_to_user_client_publish_dt_ns; i64 local_to_user_client_publish_time_ns; /* Rolling window of local sim -> user publish time deltas */ i64 last_local_to_user_snapshot_published_at_ns; i64 average_local_to_user_snapshot_publish_dt_ns; i64 local_sim_predicted_time_ns; /* Calculated from +