Fixed input event buffer issues

Queue doesn't properly act as a ring buffer had to roll my own.
I want to make a allocated ring buffer as well...
This commit is contained in:
2024-06-23 03:04:38 -04:00
parent ce1d31f0d4
commit 55b80da8e5
17 changed files with 390 additions and 139 deletions

View File

@ -1,7 +1,9 @@
package grime
import "base:runtime"
import "core:container/queue"
// Note(Ed): Fixed size queue DOES NOT act as a RING BUFFER
make_queue :: proc( $QueueType : typeid/Queue($Type), capacity := queue.DEFAULT_CAPACITY, allocator := context.allocator, fixed_cap : bool = false ) -> (result : Queue(Type), error : AllocatorError)
{
allocator := allocator
@ -19,7 +21,9 @@ make_queue :: proc( $QueueType : typeid/Queue($Type), capacity := queue.DEFAULT_
push_back_slice_queue :: proc( self : ^$QueueType / Queue($Type), slice : []Type ) -> ( error : AllocatorError )
{
if len(slice) == 0 do return
queue.push_back_elems( self, ..slice )
return
}