pipe through left-over OS events to subsequent frames; do not drop them

This commit is contained in:
Ryan Fleury
2024-01-23 16:44:57 -08:00
parent 04def874eb
commit fd0feefcf2
7 changed files with 52 additions and 4 deletions
+32
View File
@@ -189,3 +189,35 @@ os_text(OS_EventList *events, OS_Handle window, U32 character)
}
return result;
}
internal OS_EventList
os_event_list_copy(Arena *arena, OS_EventList *src)
{
OS_EventList dst = {0};
for(OS_Event *s = src->first; s != 0; s = s->next)
{
OS_Event *d = push_array(arena, OS_Event, 1);
MemoryCopyStruct(d, s);
d->strings = str8_list_copy(arena, &s->strings);
DLLPushBack(dst.first, dst.last, d);
dst.count += 1;
}
return dst;
}
internal void
os_event_list_concat_in_place(OS_EventList *dst, OS_EventList *to_push)
{
if(dst->last && to_push->first)
{
dst->last->next = to_push->first;
to_push->first->prev = dst->last;
dst->last = to_push->last;
dst->count += to_push->count;
}
else if(!dst->last && to_push->first)
{
MemoryCopyStruct(dst, to_push);
}
MemoryZeroStruct(to_push);
}
+2
View File
@@ -92,6 +92,8 @@ internal void os_eat_event(OS_EventList *events, OS_Event *event);
internal B32 os_key_press(OS_EventList *events, OS_Handle window, OS_EventFlags flags, OS_Key key);
internal B32 os_key_release(OS_EventList *events, OS_Handle window, OS_EventFlags flags, OS_Key key);
internal B32 os_text(OS_EventList *events, OS_Handle window, U32 character);
internal OS_EventList os_event_list_copy(Arena *arena, OS_EventList *src);
internal void os_event_list_concat_in_place(OS_EventList *dst, OS_EventList *to_push);
////////////////////////////////
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
+1
View File
@@ -114,6 +114,7 @@ w32_push_event(OS_EventKind kind, W32_Window *window)
result->kind = kind;
result->window = os_window_from_w32_window(window);
result->flags = os_get_event_flags();
w32_event_list.count += 1;
return(result);
}