Preparing skeleton for proper imgui support.

I originally wanted to reference Ryan's UI series along with the RAD Debugger codebase, but that ended up being too convoluted of a route. Instead, I moved on to just doing a deep dive on imgui content I could find to learn from and associated libraries available. I collected my notes so far in this repo [IMGUI_Notes](https://github.com/Ed94/IMGUI_Notes).

For now I have the base scaffolding datatype wise for the prototype ui.
This commit is contained in:
2024-02-22 21:19:29 -05:00
parent 9cc0855c03
commit 7332644515
15 changed files with 862 additions and 288 deletions

View File

@ -3,8 +3,11 @@ package sectr
// At least its less than C/C++ ...
import "base:builtin"
import "base:runtime"
import c "core:c/libc"
import "core:mem"
import "core:mem/virtual"
import "core:os"
import "core:path/filepath"
Byte :: 1
@ -49,3 +52,101 @@ get_bounds :: proc {
box_get_bounds,
view_get_bounds,
}
// TODO(Ed) : This is extremely jank, Raylib requires a 'heap' allocator with the way it works.
// We do not have persistent segmented in such a way for this. Eventually we might just want to segment vmem and just shove a heap allocator on a segment of it.
when false {
RL_MALLOC :: proc "c" ( size : c.size_t ) -> rawptr
{
allocator : Allocator
when Use_TrackingAllocator {
allocator = Allocator {
data = & memory.persistent.tracker,
procedure = mem.tracking_allocator_proc,
}
}
else {
allocator = Allocator {
data = & memory.persistent,
procedure = mem.arena_allocator_proc,
}
}
result, error_code := allocator.procedure( allocator.data, mem.Allocator_Mode.Alloc_Non_Zeroed, cast(int) size, mem.DEFAULT_ALIGNMENT, nil, 0, auto_cast {} )
if error_code != AllocatorError.None {
runtime.debug_trap()
os.exit( -1 )
}
return raw_data(result)
}
RL_CALLOC :: proc "c" ( count : c.size_t, size : c.size_t ) -> rawptr
{
allocator : Allocator
when Use_TrackingAllocator {
allocator = Allocator {
data = & memory.persistent.tracker,
procedure = mem.tracking_allocator_proc,
}
}
else {
allocator = Allocator {
data = & memory.persistent,
procedure = mem.arena_allocator_proc,
}
}
result, error_code := allocator.procedure( allocator.data, mem.Allocator_Mode.Alloc, cast(int) size, mem.DEFAULT_ALIGNMENT, nil, 0, auto_cast {} )
if error_code != AllocatorError.None {
runtime.debug_trap()
os.exit( -1 )
}
return raw_data(result)
}
RL_REALLOC :: proc "c" ( block : rawptr, size : c.size_t ) -> rawptr
{
allocator : Allocator
when Use_TrackingAllocator {
allocator = Allocator {
data = & memory.persistent.tracker,
procedure = mem.tracking_allocator_proc,
}
}
else {
allocator = Allocator {
data = & memory.persistent,
procedure = mem.arena_allocator_proc,
}
}
result, error_code := allocator.procedure( allocator.data, mem.Allocator_Mode.Resize_Non_Zeroed, cast(int) size, mem.DEFAULT_ALIGNMENT, block, 0, auto_cast {} )
if error_code != AllocatorError.None {
runtime.debug_trap()
os.exit( -1 )
}
return raw_data(result)
}
RL_FREE :: proc "c" ( block : rawptr )
{
allocator : Allocator
when Use_TrackingAllocator {
allocator = Allocator {
data = & memory.persistent.tracker,
procedure = mem.tracking_allocator_proc,
}
}
else {
allocator = Allocator {
data = & memory.persistent,
procedure = mem.arena_allocator_proc,
}
}
result, error_code := allocator.procedure( allocator.data, mem.Allocator_Mode.Free, 0, 0, block, 0, auto_cast {} )
if error_code != AllocatorError.None {
runtime.debug_trap()
os.exit( -1 )
}
}
}