w32 wait for events
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
.sleeps properly when nothing is happening
|
||||
.replayable (that is you can serialize all the events, replay them back and get the same results)
|
||||
..rendering and update decoupled
|
||||
..animations probably then should be in the rendering part
|
||||
..animations probably should be in the rendering part
|
||||
|
||||
void app_update(app_event_t *events, i32 event_count) {
|
||||
update_result_t *state = NULL; // contains event
|
||||
@@ -23,17 +23,6 @@ void app_update(app_event_t *events, i32 event_count) {
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
app_event_t *events = NULL;
|
||||
if (animating) {
|
||||
events = poll_events(); // non-blocking
|
||||
} else {
|
||||
events = wait_for_events(); // blocking
|
||||
}
|
||||
app_update(events, event_count);
|
||||
|
||||
SwapBuffers(); // vsync block
|
||||
}
|
||||
|
||||
*/
|
||||
gb_wasm_export char wasm_temp_buff1[128] = {[127] = 0x13};
|
||||
@@ -176,7 +165,7 @@ fn_wasm_export void wasm_key_up(char *key, b32 ctrl, b32 shift, b32 alt, b32 met
|
||||
}
|
||||
}
|
||||
|
||||
fn_wasm_export void wasm_update(f64 time, f64 width, f64 height, f64 dpr) {
|
||||
fn_wasm_export b32 wasm_update(f64 time, f64 width, f64 height, f64 dpr) {
|
||||
wasm_time = time;
|
||||
wasm_delta_time = wasm_time - wasm_last_time;
|
||||
|
||||
@@ -199,11 +188,13 @@ fn_wasm_export void wasm_update(f64 time, f64 width, f64 height, f64 dpr) {
|
||||
ev->window_size = window_size;
|
||||
}
|
||||
|
||||
app_update(wasm_event_list);
|
||||
b32 animating = app_update(wasm_event_list);
|
||||
|
||||
ma_set0(tcx.temp);
|
||||
zero_struct(&wasm_event_list);
|
||||
wasm_last_time = wasm_time;
|
||||
|
||||
return animating;
|
||||
}
|
||||
|
||||
fn_wasm_export void wasm_init(void) {
|
||||
|
||||
Reference in New Issue
Block a user