Skip to content

Commit

Permalink
use new windows library function signatures (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnhatori authored Aug 4, 2024
1 parent ed1e732 commit c8c84bb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions 3d_model_viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,15 @@ wWinMain(HINSTANCE inst, HINSTANCE prev_inst, WCHAR* cmd_args, s32 show_code)
pg_mesh* meshes = 0;
u32 mesh_count = 0;

pg_windows_window_init(&windows, &config, inst, &err);
pg_windows_init_mem(&windows, &config, &err);
pg_windows_window_init(&windows.window,
inst,
config.fixed_aspect_ratio_width,
config.fixed_aspect_ratio_height,
&err);
pg_windows_init_mem(&windows,
config.permanent_mem_size,
config.transient_mem_size,
&err);
pg_assets_read_pga(&windows.permanent_mem,
&pg_windows_read_file,
&assets,
Expand All @@ -451,7 +458,7 @@ wWinMain(HINSTANCE inst, HINSTANCE prev_inst, WCHAR* cmd_args, s32 show_code)
app_state.vsync,
config.gfx_mem_size,
&err);
pg_windows_metrics_init(&windows, &err);
pg_windows_metrics_init(&windows.metrics, &err);

f32 running_time_step = config.fixed_time_step;
while (windows.msg.message != WM_QUIT)
Expand All @@ -466,7 +473,7 @@ wWinMain(HINSTANCE inst, HINSTANCE prev_inst, WCHAR* cmd_args, s32 show_code)
pg_gfx_api gfx_api = app_state.gfx_api;
pg_f32_2x previous_cursor_position = windows.input.mouse.cursor;

pg_windows_update_input(&windows, &config, &err);
pg_windows_update_input(&windows, config.gamepad_count, &err);

update_app(&assets,
&windows.input,
Expand All @@ -489,16 +496,17 @@ wWinMain(HINSTANCE inst, HINSTANCE prev_inst, WCHAR* cmd_args, s32 show_code)
&imgui_ui,
&err);

pg_windows_metrics_update(&windows, &err);
pg_windows_metrics_update(&windows.metrics, &err);
app_state.fps = windows.metrics.fps;
app_state.frame_time = windows.metrics.frame_time;
running_time_step += app_state.frame_time;

if (app_state.gfx_api != gfx_api)
{
pg_windows_reload_graphics(&windows,
&config,
inst,
config.fixed_aspect_ratio_width,
config.fixed_aspect_ratio_height,
app_state.gfx_api,
&assets,
&dynamic_cb_data,
Expand Down

0 comments on commit c8c84bb

Please sign in to comment.