gs_bucket_array

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README

commit c6f506813ec1a724ef5f8036c213e05f5f3fade6
Author: Samdal <samdal@protonmail.com>
Date:   Sun, 29 Jan 2023 00:56:30 +0100

initial commit

Diffstat:
A.github/workflows/build_linux.yml | 23+++++++++++++++++++++++
A.gitignore | 1+
A.gitmodules | 3+++
AREADME.md | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproc/html5/emcc.sh | 33+++++++++++++++++++++++++++++++++
Aproc/linux/Makefile | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproc/linux/gcc.sh | 27+++++++++++++++++++++++++++
Aproc/linux/gcc_dbg.sh | 28++++++++++++++++++++++++++++
Aproc/linux/gcc_rdbg.sh | 28++++++++++++++++++++++++++++
Aproc/linux/gcc_rel.sh | 28++++++++++++++++++++++++++++
Aproc/osx/gcc.sh | 39+++++++++++++++++++++++++++++++++++++++
Aproc/osx/gcc_dbg.sh | 40++++++++++++++++++++++++++++++++++++++++
Aproc/osx/gcc_rdbg.sh | 40++++++++++++++++++++++++++++++++++++++++
Aproc/osx/gcc_rel.sh | 40++++++++++++++++++++++++++++++++++++++++
Aproc/scons/SConstruct | 155+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproc/sublime_text/gs_project.sublime-project | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproc/sublime_text/gs_project.sublime-workspace | 1112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproc/win/cl.bat | 35+++++++++++++++++++++++++++++++++++
Aproc/win/mingw.sh | 40++++++++++++++++++++++++++++++++++++++++
Aproc/win/mingw_cross_platform.sh | 39+++++++++++++++++++++++++++++++++++++++
Aproc/win/mingw_dbg.sh | 41+++++++++++++++++++++++++++++++++++++++++
Aproc/win/mingw_rdbg.sh | 41+++++++++++++++++++++++++++++++++++++++++
Aproc/win/mingw_rel.sh | 41+++++++++++++++++++++++++++++++++++++++++
Asource/gs.c | 3+++
Asource/main.c | 347+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athird_party/include/gs | 1+
26 files changed, 2390 insertions(+), 0 deletions(-)

diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml @@ -0,0 +1,23 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # Build for ubuntu latest + build_ubuntu: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@main + - name: build + run: bash ./proc/linux/gcc.sh diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +bin/* diff --git a/.gitmodules b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party/include/gs"] + path = third_party/include/gs + url = https://github.com/mrfrenik/gunslinger diff --git a/README.md b/README.md @@ -0,0 +1,86 @@ +# gs_bucket_array + +For up-to-date stuff look at source file + +I have seperated the gs implementation into gs.c, but the build files are not all updated compile it. +You have to do that if you want to compie the example. + + + + + +NOTE: +> Unlike the other gunslinger containers, the gs_bucket_array needs initialization. +> It is NOT allocated on use. + +Bucket arrays are internally a list of pointers to fixed-size arrays: +This means that there are no re-allocs, and all your pointers will remain valid. + +Due to the nature of this container it's very handy for managing both stuff that are +constant and dynamic in a singular place. + +Because of this the container also has a bit-field that specifies which elements are in-use. +This creates an interface almost identitcal to gs_slot_array. +The major drawback of this is a somewhat slow iterator (and a non-"instant" insertion). + +### The guts of look somewhat like: + + gs_dyn_array(Type[bucket_size]) your_data; + gs_dyn_array(int64_t) bit_field; + +### Standard initializatoin would look like: + + gs_bucket_array(float) arr = gs_bucket_array_new(float, 100); // Bucket array with internal 'float' data, where each bucket is 100 floats + uint32_t hndl = gs_bucket_array_insert(arr, 3.145f); // Inserts your data into the bucket array, returns handle to you + float* val_p = gs_bucket_array_getp(arr, hndl); // Returns copy of data to you using handle as lookup + float val = gs_bucket_array_get(arr, hndl); + + +### The Bucket array provides iterators: + + for ( + gs_bucket_array_iter it = gs_bucket_array_iter_new(ba); + gs_bucket_array_iter_valid(ba, it); + gs_bucket_array_iter_advance(ba, it) + ) { + float v = gs_bucket_array_get(ba, it); // Get value using iterator + float* vp = gs_bucket_array_getp(ba, it); // Get value pointer using iterator + } + +This iterator gather a index into the bucket array, which you later can use to get pointers/values +through the indirection. +However you might not always need this. +If you don't care about elements being "valid" you can use the fast iterator: + + for ( + gs_bucket_array_iter_fast it = gs_bucket_array_iter_fast_new(ba); + gs_bucket_array_iter_fast_valid(ba, it); + gs_bucket_array_iter_fast_advance(ba, it) + ) { + float v = gs_bucket_array_iter_fast_get(ba, it); // Get value using iterator + float* vp = gs_bucket_array_iter_fast_getp(ba, it); // Get value pointer using iterator + uint32_t hndl = gs_bucket_array_iter_fast_get_hndl(ba, it); // Get a normal handle from iterator + } + +Internally the fast iterator is just struct {uint32_t major; uint32_t minor;} +TIP: +> You may store your own "bool enabled;" in your what you store in the bucket array. +> You can then use the fast iterator and check for this yourself. +> However, note that this needs gs_bucket_array_new_ex where null_new_buckets is set to true, +> this is because un-initialized data will otherwise interfere. + + +### Bucket Array Usage: + + gs_bucket_array(float) ba = gs_bucket_array_new(float, 100); // Bucket array with internal 'float' data, where each bucket is 100 floats + uint32_t hndl = gs_bucket_array_insert(ba, 3.145f); // Inserts your data into the bucket array, returns handle to you + float* val_p = gs_bucket_array_getp(ba, hndl); // Returns your data to you using handle as lookup + float val = gs_bucket_array_get(ba, hndl); // Dereferences your data as well + uint32_t bs = gs_bucket_array_bucket_size(ba) // Returns initialized bucket size + uint32_t bc = gs_bucket_array_bucket_count(ba) // Returns the amount of buckets allocated + uint32_t b_cap = gs_bucket_array_capacity(ba) // Returns bucket_size * bucket_count + gs_bucket_array_clear(ba) // Sets the entire bit-field to 0 + gs_bucket_array_free(ba) // Free's the entire array, make sure your own elements are free'd first + + // if you use new_ex, you can set a bool to memset every new bucket to zero + gs_bucket_array(int) ba_null_on_new = gs_bucket_array_new_ex(int, 64, true); diff --git a/proc/html5/emcc.sh b/proc/html5/emcc.sh @@ -0,0 +1,33 @@ +#!bin/sh + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -w -s WASM=1 -s USE_WEBGL2=1 -s ASYNCIFY=1 -O1 +) + +# Include directories +inc=( + -I ../third_party/include/ # Gunslinger includes +) + +# Source files +src=( + ../source/*.c +) + +libs=( +) + +# Build +emcc ${inc[*]} ${src[*]} ${flags[*]} -o $proj_name.html + +cd .. + + + diff --git a/proc/linux/Makefile b/proc/linux/Makefile @@ -0,0 +1,56 @@ +# Makefile for C projects + +# options +CC = clang +LINKER = $(CC) +CFLAGS = -O3 -pthread -g -std=gnu99 -Wall -Wno-missing-braces -Wno-unused-variable -Wno-switch -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-comment -Wno-typedef-redefinition #-Wfatal-errors +LFLAGS = -ldl -lX11 -lXi -lm -lpthread -lavformat -lavcodec -lswscale -lavutil + +TARGET = App + +# directories +SRC_DIR = ../../source +BIN_DIR = ../../bin +INCLUDE = -I../../third_party/include +OBJ_DIR = $(BIN_DIR)/.obj + +# finds source files two directories deep +SOURCES = $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/*/*.c $(SRC_DIR)/modes/*/*.c) +OBJECTS = $(SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o) +DEPENDS = $(SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.d) + +.PHONY: all build run clean + +all: build + +build: $(BIN_DIR) $(DEPENDS) $(BIN_DIR)/$(TARGET) + +$(BIN_DIR): + mkdir -p $@ + +# update dependencies +$(OBJ_DIR)/%.d : $(SRC_DIR)/%.c + @mkdir -p $(@D) + @echo -n "Updating dependencies for $< --- " + gcc -MM $< -o $@ + @sed -i "s/ /\t/" $@; + @echo -n "$(@D)/" | cat - $@ > "/tmp/___make_temp" && mv "/tmp/___make_temp" $@ + +# add dependencies +include $(DEPENDS) + +# compile +$(OBJ_DIR)/%.o : $(SRC_DIR)/%.c + @mkdir -p $(@D) + $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@ + +# link +$(BIN_DIR)/$(TARGET): $(OBJECTS) + $(LINKER) $(OBJECTS) $(LFLAGS) -o $@ + +run: build + ./$(BIN_DIR)/$(TARGET) + +clean: + rm -f $(OBJECTS) $(GS_OBJ) + rm -f $(BIN_DIR)/$(TARGET) diff --git a/proc/linux/gcc.sh b/proc/linux/gcc.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w -ldl -lGL -lX11 -pthread -lXi +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +# Build +gcc -O0 -g ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} + +cd .. diff --git a/proc/linux/gcc_dbg.sh b/proc/linux/gcc_dbg.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w -ldl -lGL -lX11 -pthread -lXi +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +# Build +echo gcc -O0 ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} +gcc -O3 ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} + +cd .. diff --git a/proc/linux/gcc_rdbg.sh b/proc/linux/gcc_rdbg.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w -ldl -lGL -lX11 -pthread -lXi +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +# Build +echo gcc -O1 ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} +gcc -O3 ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} + +cd .. diff --git a/proc/linux/gcc_rel.sh b/proc/linux/gcc_rel.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w -ldl -lGL -lX11 -pthread -lXi +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +# Build +echo gcc -O3 ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} +gcc -O3 ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} + +cd .. diff --git a/proc/osx/gcc.sh b/proc/osx/gcc.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=c99 -x objective-c -O0 -w +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +fworks=( + -framework OpenGL + -framework CoreFoundation + -framework CoreVideo + -framework IOKit + -framework Cocoa + -framework Carbon +) + +# Build +gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} + +cd .. + + + diff --git a/proc/osx/gcc_dbg.sh b/proc/osx/gcc_dbg.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=c99 -x objective-c -O0 -w +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +fworks=( + -framework OpenGL + -framework CoreFoundation + -framework CoreVideo + -framework IOKit + -framework Cocoa + -framework Carbon +) + +# Build +echo gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} +gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} + +cd .. + + + diff --git a/proc/osx/gcc_rdbg.sh b/proc/osx/gcc_rdbg.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=c99 -x objective-c -O1 -w +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +fworks=( + -framework OpenGL + -framework CoreFoundation + -framework CoreVideo + -framework IOKit + -framework Cocoa + -framework Carbon +) + +# Build +echo gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} +gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} + +cd .. + + + diff --git a/proc/osx/gcc_rel.sh b/proc/osx/gcc_rel.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=c99 -x objective-c -O3 -w +) + +# Include directories +inc=( + -I ../third_party/include/ +) + +# Source files +src=( + ../source/main.c +) + +fworks=( + -framework OpenGL + -framework CoreFoundation + -framework CoreVideo + -framework IOKit + -framework Cocoa + -framework Carbon +) + +# Build +echo gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} +gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} + +cd .. + + + diff --git a/proc/scons/SConstruct b/proc/scons/SConstruct @@ -0,0 +1,155 @@ +#!/usr/bin/env python +import os +import sys + +# Try to detect the host platform automatically. +# This is used if no `platform` argument is passed +if sys.platform.startswith("linux"): + host_platform = "linux" +elif sys.platform == "darwin": + host_platform = "osx" +elif sys.platform == "win32" or sys.platform == "msys": + host_platform = "windows" +else: + raise ValueError( + "Could not detect platform automatically, please specify with " + "platform=<platform>" + ) + +env = Environment(ENV=os.environ) + +is64 = sys.maxsize > 2 ** 32 +if (env["TARGET_ARCH"] == "amd64" + or env["TARGET_ARCH"] == "emt64" + or env["TARGET_ARCH"] == "x86_64" + or env["TARGET_ARCH"] == "arm64-v8a"): + is64 = True + +opts = Variables([], ARGUMENTS) + +opts.Add( + EnumVariable( + "platform", + "Target platform", + host_platform, + allowed_values=("linux", "osx", "windows"), + ignorecase=2, + ) +) + +opts.Add( + EnumVariable( + "target", + "Compilation target", + "release", + allowed_values=("debug", "release"), + ignorecase=2, + ) +) +opts.Add( + PathVariable("target_path", "The path where the app will be installed", "../../bin/") +) + +opts.Add( + PathVariable("source_path", "The path where the source files lay", "../../source/") +) + +opts.Add( + PathVariable("include_path", "Where your includes are", "../../third_party/include") +) + +opts.Add( + PathVariable("target_name", "The name of the app", "App", PathVariable.PathAccept) +) + +opts.Add( + EnumVariable("bits", "Target platform bits", "64" if is64 else "32", ("32", "64")) +) + +opts.Add( + EnumVariable( + "OpenGL", + "If using OpenGL as backend", + "false", + allowed_values=("false", "true"), + ignorecase=2, + ) +) + +# Create bin folder if it does not exist, it will throw an error +# if any of the paths above is not an actual path. Since the project +# template does not actually have the bin folder, it won't work if you use +# the default unless you create it manually. +# +# feel free to remove this if you don't want the bin folder +os.system("mkdir -p ../../bin/") + +# update options +opts.Update(env) + + +if host_platform == "windows": + env.Append(ENV=os.environ) + if env["bits"] == "64": + env = Environment(TARGET_ARCH="amd64") + elif env["bits"] == "32": + env = Environment(TARGET_ARCH="x86") + opts.Update(env) + +env.Append(CPPPATH=env['include_path']) + +if env["platform"] == "linux": + if env["target"] == "debug": + env.Append(CCFLAGS=["-fPIC", "-g3", "-Og", "-std=gnu99"]) + else: + env.Append(CCFLAGS=["-fPIC", "-O3", "-std=gnu99"]) + env.Append(LINKFLAGS=["-s"]) + + env.Append(LINKFLAGS=["-ldl", "-lX11", "-lXi", "-lm", "-pthread"]) + if env["OpenGL"] == "true": + env.Append(CCFLAGS=["-lGL"]) + +elif env["platform"] == "osx": + if env["target"] == "debug": + env.Append(CCFLAGS=["-g", "-O2", "-arch", "x86_64", "-std=gnu99", "-objective-c"]) + else: + env.Append(CCFLAGS=["-g", "-O3", "-arch", "x86_64", "-std=gnu99", "-objective-c"]) + + env.Append(LINKFLAGS=["-arch", "x86_64", "-framework", "CoreFoundation", "-framework", + "CoreVide", "-framework", "IOKit", "-framework", "Cocoa", "-framework", "Carbon"]) + if env["OpenGL"] == "true": + env.Append(CCFLAGS=["-framework", "OpenGL"]) + +elif env["platform"] == "windows": + env.Append(CPPDEFINES=["WIN32", "_WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS"]) + if env["target"] == "debug": + env.Append(CPPDEFINES=["_DEBUG"]) + env.Append(CCFLAGS=["-MD", "-std=gnu99"]) + env.Append(LINKFLAGS=["-DEBUG"]) + else: + env.Append(CPPDEFINES=["NDEBUG"]) + env.Append(CCFLAGS=["-O2", "-MD", "-std=gnu99"]) + + if env["bits"] == "32" and host_platform == "windows": + env.Append(LINKFLAGS=["kernel32.lib", "user32.lib", "shell32.lib", "vcruntime.lib", "msvcrt.lib", "gdi32.lib", "Advapi32.lib", "winmm.lib"]) + if env["OpenGL"] == "true": + env.Append(LINKFLAGS=["opengl32.lib"]) + else: + env.Append(LINKFLAGS=["-mwindows", "-lkernel32", "-luser32", "-lshell32", "-lgdi32", "-lAdvapi32", "-lwinmm"]) + if env["OpenGL"] == "true": + env.Append(LINKFLAGS=["-lopengl32"]) + + +# Source Files +sources = Glob(f"{env['source_path']}/*.c") +sources += Glob(f"{env['source_path']}/*/*.c") +sources += Glob(f"{env['source_path']}/*.cpp") +sources += Glob(f"{env['source_path']}/*/*.cpp") + +app = env.Program( + target=f"{env['target_path']}{env['platform']}/{env['target_name']}", source=sources +) +Default(app) + +# Generates help for the -h scons option. +Help(opts.GenerateHelpText(env)) diff --git a/proc/sublime_text/gs_project.sublime-project b/proc/sublime_text/gs_project.sublime-project @@ -0,0 +1,63 @@ +{ + "folders": + [ + { + "path": "./../../../gs_project_template" + } + ], + "build_systems": + [ + { + "name": "GS: Build Debug (GCC/MINGW)", + "osx": { + "cmd": ["echo Building... && cd $folder && bash ./proc/osx/gcc_dbg.sh"], + "shell": true + }, + "linux": { + "cmd": ["echo Building... && cd $folder && bash ./proc/linux/gcc_dbg.sh"], + "shell": true + }, + "windows": { + "cmd": ["echo Building... && cd $folder && bash ./proc/win/mingw_dbg.sh"], + "shell": true + } + }, + { + "name": "GS: Build Release (GCC/MINGW)", + "osx": { + "cmd": ["echo Building... && cd $folder && bash ./proc/osx/gcc_rel.sh"], + "shell": true + }, + "linux": { + "cmd": ["echo Building... && cd $folder && bash ./proc/linux/gcc_rel.sh"], + "shell": true + }, + "windows": { + "cmd": ["echo Building... && cd $folder && bash ./proc/win/mingw_rel.sh"], + "shell": true + } + }, + { + "name": "GS: Build Rel-Debug (GCC/MINGW)", + "osx": { + "cmd": ["echo Building... && cd $folder && bash ./proc/osx/gcc_rdbg.sh"], + "shell": true + }, + "linux": { + "cmd": ["echo Building... && cd $folder && bash ./proc/linux/gcc_rdbg.sh"], + "shell": true + }, + "windows": { + "cmd": ["echo Building... && cd $folder && bash ./proc/win/mingw_rdbg.sh"], + "shell": true + } + }, + { + "name": "GS: Run", + "osx": { + "cmd": ["cd $folder && ./bin/App"], + "shell": true + } + } + ] +} diff --git a/proc/sublime_text/gs_project.sublime-workspace b/proc/sublime_text/gs_project.sublime-workspace @@ -0,0 +1,1112 @@ +{ + "auto_complete": + { + "selected_items": + [ + [ + "gs_physics_stackal", + "gs_physics_stack_allocator_t" + ], + [ + "gs_Gfxtpipe", + "gs_gfxt_pipeline_t" + ], + [ + "gs_gfxtrawpip", + "gs_gfxt_raw_pipeline_func_desc_t" + ], + [ + "MOVEMEN", + "ANALOG_HAND_MOVEMENT_QUARTZ" + ], + [ + "MOVMENT", + "ANALOG_HAND_MOVEMENT_QUARTZ" + ], + [ + "GSGRPAH", + "GS_GRAPHICS_PRIMITIVE_TRIANGLES" + ], + [ + "GS_GRAPHICS_SHAD", + "GS_GRAPHICS_SHADER_STAGE_FRAGMENT" + ], + [ + "GS_SHAD", + "GS_SHADERPROGRAM_GEOMETRY" + ], + [ + "GS_SHADER", + "GS_SHADERPROGRAM_FRAGMENT" + ], + [ + "gsrsou", + "gs_resource_cache_get_ptr" + ], + [ + "gs_resour", + "gs_declare_resource_type" + ], + [ + "gs_face_cul", + "gs_face_culling_disabled" + ], + [ + "gs_window", + "gs_winding_order_ccw" + ], + [ + "openglimediated", + "__get_opengl_immediate_data" + ], + [ + "vertex_", + "vertex_3fv" + ], + [ + "gs_slothand", + "gs_slot_array_invalid_handle" + ], + [ + "glfwframebuffersi", + "glfw_frame_buffer_size" + ], + [ + "ENJONDI", + "ENJON_DIR" + ], + [ + "Roboto-Medium", + "Roboto-MediumItalic_14" + ], + [ + "format", + "texture_format" + ], + [ + "gs_asset_sub", + "gs_asset_subsystem_get_raw" + ], + [ + "render_te", + "gui_render_test" + ], + [ + "gs_component_data_ind", + "gs_component_data_index_pool_gs_rotation_component_system" + ], + [ + "gs_component_data_poollist", + "gs_component_data_pool_list" + ], + [ + "gs_component_datapoli", + "gs_component_data_pool_list" + ], + [ + "gs_componentdatast", + "gs_component_data_storage" + ], + [ + "gscomp", + "gs_component" + ], + [ + "gscomponentd", + "gs_component_data_storage" + ], + [ + "gscomponentdat", + "gs_component_data_storage_ptr" + ], + [ + "gs_componetndat", + "gs_component_data_storage_ptr" + ], + [ + "deseri", + "deserialized_texture" + ], + [ + "transform_c", + "transform_component_system_ctor" + ], + [ + "mat4_tra", + "__mat4_translate_impl" + ], + [ + "lexer_require", + "lexer_require_token_type" + ], + [ + "object_seri", + "object_serialize_pod_type" + ], + [ + "data_ch", + "data_chunk" + ], + [ + "data_c", + "data_chunk" + ], + [ + "if", + "ifmain\tif __name__ == '__main__'" + ], + [ + "GetPRoxy", + "GetProxyData" + ], + [ + "HealthCompoe", + "HealthComponentProxy" + ], + [ + "Healthcompr", + "HealthComponentProxy" + ], + [ + "Healthc", + "HealthComponentProxy" + ], + [ + "mRegenra", + "mRegenRate" + ], + [ + "Haelthcom", + "HealthComponentProxy" + ], + [ + "mregenra", + "mRegenRate_InstanceData" + ], + [ + "mregenrate", + "mRegenRate" + ], + [ + "mRegenr", + "mRegenRate" + ], + [ + "attribute", + "attributes" + ], + [ + "mPosion", + "mPosition_InstanceData" + ], + [ + "mHelath", + "mHealth_InstanceData" + ], + [ + "HealthCompon", + "HealthComponent_InstanceData" + ], + [ + "mEntityInst", + "mEntityID_InstanceData" + ], + [ + "Healthcom", + "HealthComponent" + ], + [ + "Healthcompo", + "HealthComponent_InstanceData" + ], + [ + "uno", + "unordered_map\tstandard header (since c++11)" + ], + [ + "tfi", + "tfidfVectors" + ], + [ + "tf", + "tfidfVectors" + ], + [ + "orin", + "originalDocs" + ], + [ + "WFCLAS", + "WF_CLASS_NAME_WatchFace" + ] + ] + }, + "buffers": + [ + ], + "build_system": "", + "build_system_choices": + [ + [ + [ + [ + "Packages/C++ & C Single File Builder - Minghang Yang/C Builder-Minghang Yang.sublime-build", + "" + ], + [ + "Packages/C++ & C Single File Builder - Minghang Yang/C Builder-Minghang Yang.sublime-build", + "Run" + ], + [ + "Packages/C++ & C Single File Builder - Minghang Yang/C Builder-Minghang Yang.sublime-build", + "Build and Run" + ] + ], + [ + "Packages/C++ & C Single File Builder - Minghang Yang/C Builder-Minghang Yang.sublime-build", + "Build and Run" + ] + ], + [ + [ + [ + "Packages/C++/C++ Single File.sublime-build", + "" + ], + [ + "Packages/C++/C++ Single File.sublime-build", + "Run" + ] + ], + [ + "Packages/C++/C++ Single File.sublime-build", + "" + ] + ], + [ + [ + [ + "Packages/C++11/C++11.sublime-build", + "" + ], + [ + "Packages/C++11/C++11.sublime-build", + "Run" + ] + ], + [ + "Packages/C++11/C++11.sublime-build", + "" + ] + ] + ], + "build_varint": "", + "command_palette": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + [ + "pack", + "Package Control: List Packages" + ], + [ + "package", + "Package Control: Install Package" + ], + [ + "package con", + "Package Control: Install Package" + ] + ], + "width": 0.0 + }, + "console": + { + "height": 136.0, + "history": + [ + ] + }, + "distraction_free": + { + "menu_visible": true, + "show_minimap": false, + "show_open_files": false, + "show_tabs": false, + "side_bar_visible": false, + "status_bar_visible": false + }, + "expanded_folders": + [ + "/Users/127885/Documents/gs_projects/gs_project_template" + ], + "file_history": + [ + "/Users/127885/Documents/gs_projects/physics_api_test/third_party/include/gs/util/gs_idraw.h", + "/Users/127885/Documents/gs_projects/physics_api_test/third_party/include/gs/util/gs_physics.h", + "/Users/127885/Documents/Work/WatchFaces/fossil-engine/UDroid/app/src/main/cpp/core/fs_complication.h", + "/Users/127885/Documents/Work/WatchFaces/fossil-engine/UDroid/app/src/main/cpp/gs_wear_os_platform.h", + "/Users/127885/Documents/Work/WatchFaces/fossil-engine/UDroid/app/src/main/cpp/fs_watchface.c", + "/Users/127885/Documents/Work/WatchFaces/fossil-engine/UDroid/app/src/main/cpp/fs_entity.c", + "/Users/127885/Documents/Work/WatchFaces/fossil-engine/UDroid/app/src/main/cpp/fs_complication.h", + "/Users/127885/Documents/Work/WatchFaces/fossil-engine/UDroid/app/src/main/cpp/fs_complication.c", + "/Users/127885/Documents/Work/WatchFaces/fossil-engine/UDroid/app/src/main/cpp/fs_entity.h", + "/Users/127885/Downloads/gs_project_template-main/third_party/include/tinyobj/tinyobj.h", + "/Users/127885/Downloads/gs_project_template-main/assets/ribbon.gltf", + "/Users/127885/Downloads/gs_project_template-main/assets/ribbon.glb", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/util/gs_gfxt.h", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/util/gs_idraw.h", + "/Users/127885/Documents/gs_projects/gs_examples/24_test/source/main.c", + "/Users/127885/Documents/gs_projects/EP01_SandSim/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/24_udroid/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/24_udroid/external/nanovgXC/src/nanovg.c", + "/Users/127885/Documents/gs_projects/gs_examples/24_udroid/external/nanovgXC/src/nanovg.h", + "/Users/127885/Documents/gs_projects/gs_examples/24_udroid/external/nanovgXC/src/nanovg_sw.h", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/impl/gs_platform_impl.h", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/external/cgltf/cgltf.h", + "/Users/127885/Documents/gs_projects/gs_examples/24_udroid/external/nanovgXC/src/fontstash.h", + "/Users/127885/Documents/gs_projects/gs_examples/24_udroid/proc/osx/gcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/gs.h", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/impl/gs_graphics_impl.h", + "/Users/127885/Documents/gs_projects/test_example/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/14_immediate_draw/source/main.c", + "/Users/127885/Documents/gs_projects/analog_hand_example/proc/osx/gcc.sh", + "/Users/127885/Documents/gs_projects/analog_hand_example/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/analog_hand_example/third_party/include/gs/gs.h", + "/Users/127885/Documents/gs_projects/analog_hand_example/test.bin", + "/Users/127885/Documents/gs_projects/gs_examples/23_marching_cubes/source/tinycthread/source/tinycthread.h", + "/Users/127885/Documents/gs_projects/gs_examples/13_imgui/src/gs_imgui.h", + "/Users/127885/Documents/gs_projects/gs_examples/10_non_interleave_instancing/proc/osx/gcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/01_gs_cpp/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/16_nuklear_gui/source/gs_nuklear.h", + "/Users/127885/Documents/gs_projects/gs_examples/23_marching_cubes/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/23_marching_cubes/source/data.c", + "/Users/127885/Documents/gs_projects/gs_examples/10_non_interleave_instancing/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/21_stencil_test/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/20_uniforms_advanced/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/18_flecs/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/16_nuklear_gui/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/15_meta_class/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/14_immediate_draw/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/10_non_interleave_instancing/proc/html5/emcc.sh", + "/Users/127885/Documents/Development/opengl-canvas-wasm/main.cpp", + "/Users/127885/Documents/gs_projects/gs_examples/22_emscripten/proc/emsc/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/22_emscripten/source/platform_impl_emsc.c", + "/Users/127885/Documents/gs_projects/gs_examples/22_emscripten/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/19_uniform_buffers/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/00_hello_gs/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/02_simple_triangle/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/03_uniforms/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/04_simple_texture/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/05_containers/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/06_non_interleaved_data/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/07_instancing/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/09_frame_buffer/proc/html5/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/22_emscripten/source/platform_emsc_impl.h", + "/Users/127885/Documents/gs_projects/gs_examples/22_emscripten/proc/osx/emcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/21_stencil_test/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/04_simple_texture/source/main.c", + "/Users/127885/Documents/gs_projects/gs_raycast/third_party/include/gs/util/gs_idraw.h", + "/Users/127885/Documents/gs_projects/gs_examples/06_non_interleaved_data/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/03_uniforms/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/02_simple_triangle/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/13_imgui/src/impl.cpp", + "/Users/127885/Documents/gs_projects/gs_examples/12_asset_manager/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/19_uniform_blocks/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/18_flecs/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/18_flecs/proc/osx/gcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/09_frame_buffer/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/18_flecs/external/flecs/flecs.c", + "/Users/127885/Documents/gs_projects/gs_examples/18_flecs/proc/linux/gcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/07_instancing/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/15_meta_class/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/11_compute_shader/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/00_hello_gs/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/simple_texture/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/uniforms/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/asset_manager/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/simple_triangle/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/imgui/src/gs_imgui.h", + "/Users/127885/Documents/gs_projects/gs_examples/imgui/external/imgui/imgui.h", + "/Users/127885/Documents/gs_projects/gs_examples/containers/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/frame_buffer/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/nuklear_gui/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/imgui/src/main.cpp", + "/Users/127885/Documents/gs_projects/gs_examples/hello_gs/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/external/glfw/win32_joystick.c", + "/Users/127885/Documents/gs_projects/gs_examples/hello_gs/proc/osx/gcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/immediate_draw/source/main.c", + "/Users/127885/Documents/gs_projects/gs_examples/gs_cpp/src/main.cpp", + "/Users/127885/Documents/gs_projects/gs_examples/nuklear_gui/source/gs_nuklear.h", + "/Users/127885/Documents/gs_projects/gs_examples/imgui/proc/osx/gpp.sh", + "/Users/127885/Documents/gs_projects/gs_examples/gs_cpp/proc/osx/gpp.sh", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/external/glfw/cocoa_init.m", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/external/glfw/cocoa_joystick.m", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/external/glfw/cocoa_monitor.m", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/external/glfw/cocoa_window.m", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/external/glfw/nsgl_context.m", + "/Users/127885/Documents/gs_projects/gs_examples/gs_cpp/output.txt", + "/Users/127885/Documents/gs_projects/gs_examples/nuklear_gui/external/Nuklear/src/nuklear.h", + "/Users/127885/Documents/gs_projects/gs_examples/nuklear_gui/external/Nuklear/nuklear.h", + "/Users/127885/Documents/gs_projects/gs_examples/nuklear_gui/source/impl.c", + "/Users/127885/Documents/gs_projects/gs_examples/nuklear_gui/external/Nuklear/src/nuklear_edit.c", + "/Users/127885/Documents/gs_projects/gs_examples/nuklear_gui/proc/osx/gcc.sh", + "/Users/127885/Documents/gs_projects/gs_examples/third_party/include/gs/util/gs_meta.h", + "/Users/127885/Documents/gs_projects/rewind/assets/anims/idle/idle_meta.json", + "/Users/127885/Documents/gs_projects/rewind/third_party/gs/gs.h", + "/Users/127885/Documents/gs_projects/rewind/third_party/gs/util/gs_asset.h", + "/Users/127885/Documents/gs_projects/rewind/proc/linux/gcc.sh", + "/Users/127885/Documents/gs_projects/rewind/proc/osx/gcc.sh", + "/Users/127885/Documents/Random/gunslinger/third_party/include/stb/stb_vorbis.c", + "/Users/127885/Documents/Random/gunslinger/source/graphics/gs_graphics.c", + "/Users/127885/Documents/Random/gunslinger/source/graphics/opengl/gs_graphics_opengl.c", + "/Users/127885/Documents/Random/gunslinger/include/gs.h", + "/Users/127885/Documents/Random/gunslinger/include/graphics/gs_graphics.h", + "/Users/127885/Documents/Random/gunslinger/include/platform/gs_platform.h", + "/Users/127885/Documents/Random/gunslinger/examples/hello_gs/proc/osx/compile_osx_gcc.sh", + "/Users/127885/Documents/Random/gunslinger/source/base/gs_engine.c", + "/Users/127885/Documents/Random/gunslinger/source/audio/gs_audio.c", + "/Users/127885/Documents/Random/gunslinger/source/audio/miniaudio/gs_miniaudio.c", + "/Users/127885/Documents/Random/gunslinger/include/common/gs_types.h", + "/Users/127885/Documents/Random/gunslinger/examples/pong/source/main.c", + "/Users/127885/Documents/Random/gunslinger/include/serialize/gs_byte_buffer.h" + ], + "find": + { + "height": 54.0 + }, + "find_in_files": + { + "height": 239.0, + "where_history": + [ + ] + }, + "find_state": + { + "case_sensitive": false, + "find_history": + [ + ], + "highlight": true, + "in_selection": false, + "preserve_case": false, + "regex": false, + "replace_history": + [ + ], + "reverse": false, + "show_context": true, + "use_buffer2": true, + "whole_word": false, + "wrap": true + }, + "groups": + [ + { + "sheets": + [ + ] + } + ], + "incremental_find": + { + "height": 24.0 + }, + "input": + { + "height": 66.0 + }, + "layout": + { + "cells": + [ + [ + 0, + 0, + 1, + 1 + ] + ], + "cols": + [ + 0.0, + 1.0 + ], + "rows": + [ + 0.0, + 1.0 + ] + }, + "menu_visible": true, + "output.exec": + { + "height": 49.0 + }, + "output.find_results": + { + "height": 0.0 + }, + "pinned_build_system": "Packages/User/c_build_mac.sublime-build", + "project": "gs_project.sublime-project", + "replace": + { + "height": 44.0 + }, + "save_all_on_build": true, + "select_file": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + [ + "gs.h", + "third_party/include/gs/gs.h" + ], + [ + "physics.h", + "third_party/include/gs/util/gs_physics.h" + ], + [ + "main.c", + "source/main.c" + ], + [ + "phy", + "third_party/include/gs/util/gs_physics.h" + ], + [ + "smmian.c", + "source/sm_main.c" + ], + [ + "enity.h", + "source/sm_entity.h" + ], + [ + "smcomponenth", + "source/sm_component.h" + ], + [ + "gsidraw.h", + "app/src/main/cpp/third_party/gs/util/gs_idraw.h" + ], + [ + "gsplatformimpl", + "app/src/main/cpp/third_party/gs/impl/gs_platform_impl.h" + ], + [ + "platformipml", + "app/src/main/cpp/third_party/gs/impl/gs_platform_impl.h" + ], + [ + "platformimpl", + "app/src/main/cpp/third_party/gs/impl/gs_platform_impl.h" + ], + [ + "gs_gfxt", + "util/gs_gfxt.h" + ], + [ + "gltf", + "gs_project_template-main/third_party/include/gs/external/cgltf/cgltf.h" + ], + [ + "tinyobj", + "third_party/include/tinyobj/tinyobj.h" + ], + [ + "gf", + "third_party/include/gs/util/gs_gfxt.h" + ], + [ + "cgltf", + "third_party/include/gs/external/cgltf/cgltf.h" + ], + [ + "platformipl", + "third_party/include/gs/impl/gs_platform_impl.h" + ], + [ + "nanovg", + "24_udroid/external/nanovgXC/src/nanovg.c" + ], + [ + "nanovg.c", + "24_udroid/external/nanovgXC/src/nanovg.c" + ], + [ + "gsi", + "third_party/include/gs/util/gs_idraw.h" + ], + [ + "nvg.h", + "24_udroid/external/nanovgXC/src/nanovg.h" + ], + [ + "nanovg.h", + "24_udroid/external/nanovgXC/src/nanovg.h" + ], + [ + "nanovgsw", + "24_udroid/external/nanovgXC/src/nanovg_sw.h" + ], + [ + "nvgsw", + "24_udroid/external/nanovgXC/src/nanovg_sw.h" + ], + [ + "nvg", + "24_udroid/external/nanovgXC/src/nanovg.h" + ], + [ + "idraw.h", + "third_party/include/gs/util/gs_idraw.h" + ], + [ + "graphicsimpl", + "third_party/include/gs/impl/gs_graphics_impl.h" + ], + [ + "platformim", + "third_party/include/gs/impl/gs_platform_impl.h" + ], + [ + "gsidraw", + "third_party/include/gs/util/gs_idraw.h" + ], + [ + "audioimpl", + "third_party/include/gs/impl/gs_audio_impl.h" + ], + [ + "gs", + "third_party/include/gs/util/gs_idraw.h" + ], + [ + "graphicsi", + "third_party/include/gs/impl/gs_graphics_impl.h" + ], + [ + "gsidarw", + "third_party/include/gs/util/gs_idraw.h" + ], + [ + "asset.h", + "third_party/include/gs/util/gs_asset.h" + ], + [ + "gas", + "third_party/include/gs/util/gs_asset.h" + ], + [ + "gsasset.h", + "third_party/include/gs/util/gs_asset.h" + ], + [ + "tiny", + "23_marching_cubes/source/tinycthread/source/tinycthread.h" + ], + [ + "graphicsimp", + "third_party/include/gs/impl/gs_graphics_impl.h" + ], + [ + "simpletexture.c", + "04_simple_texture/source/main.c" + ], + [ + "flecsmain.c", + "18_flecs/source/main.c" + ], + [ + "unif.c", + "03_uniforms/source/main.c" + ], + [ + "gsnuk", + "16_nuklear_gui/source/gs_nuklear.h" + ], + [ + "gsigui.h", + "13_imgui/src/gs_imgui.h" + ], + [ + "graphics.h", + "third_party/include/gs/impl/gs_graphics_impl.h" + ], + [ + "uniform.c", + "03_uniforms/source/main.c" + ], + [ + "idraw", + "third_party/include/gs/util/gs_idraw.h" + ], + [ + "grpahicsimp", + "third_party/include/gs/impl/gs_graphics_impl.h" + ], + [ + "impl", + "13_imgui/src/impl.cpp" + ], + [ + "assetmanager.c", + "12_asset_manager/source/main.c" + ], + [ + "felcsmain.c", + "18_flecs/source/main.c" + ], + [ + "felcs.c", + "18_flecs/external/flecs/flecs.c" + ], + [ + "flecsg", + "18_flecs/proc/osx/gcc.sh" + ], + [ + "flecsgcc", + "18_flecs/proc/linux/gcc.sh" + ], + [ + "09framebufer.c", + "09_frame_buffer/source/main.c" + ], + [ + "uniforms.c", + "03_uniforms/source/main.c" + ], + [ + "compute.c", + "11_compute_shader/source/main.c" + ], + [ + "metamain.c", + "15_meta_class/source/main.c" + ], + [ + "gsgrpahicsimp", + "third_party/include/gs/impl/gs_graphics_impl.h" + ], + [ + "flecs.c", + "18_flecs/external/flecs/flecs.c" + ], + [ + "triangle.c", + "simple_triangle/source/main.c" + ], + [ + "assetmanger.c", + "asset_manager/source/main.c" + ], + [ + "framebuffer.c", + "frame_buffer/source/main.c" + ], + [ + "gs.", + "third_party/include/gs/gs.h" + ], + [ + "conatiners.c", + "containers/source/main.c" + ], + [ + "imgui.h", + "imgui/external/imgui/imgui.h" + ], + [ + "gsimgui.h", + "imgui/src/gs_imgui.h" + ], + [ + "imgui.cp", + "imgui/src/main.cpp" + ], + [ + "win32jo", + "third_party/include/gs/external/glfw/win32_joystick.c" + ], + [ + "immediatedraw.c", + "immediate_draw/source/main.c" + ], + [ + "nsglcon.m", + "third_party/include/gs/external/glfw/nsgl_context.m" + ], + [ + "cocawin", + "third_party/include/gs/external/glfw/cocoa_window.m" + ], + [ + "mo", + "third_party/include/gs/external/glfw/cocoa_monitor.m" + ], + [ + "cocoa_jo.m", + "third_party/include/gs/external/glfw/cocoa_joystick.m" + ], + [ + "out", + "gs_cpp/output.txt" + ], + [ + "cocai", + "third_party/include/gs/external/glfw/cocoa_init.m" + ], + [ + "nuklear.h", + "nuklear_gui/external/Nuklear/nuklear.h" + ], + [ + "src/nuklear.h", + "nuklear_gui/external/Nuklear/src/nuklear.h" + ], + [ + "src/nuke", + "nuklear_gui/external/Nuklear/src/nuklear_edit.c" + ], + [ + "gsnu", + "nuklear_gui/source/gs_nuklear.h" + ], + [ + "nuk", + "nuklear_gui/external/Nuklear/nuklear.h" + ], + [ + "gs_nu", + "nuklear_gui/source/gs_nuklear.h" + ], + [ + "mai.c", + "containers/source/main.c" + ], + [ + "gsmeta.h", + "third_party/include/gs/util/gs_meta.h" + ], + [ + "meta.h", + "third_party/include/gs/util/gs_meta.h" + ], + [ + "meta", + "third_party/include/gs/util/gs_meta.h" + ], + [ + "gsa", + "third_party/gs/util/gs_asset.h" + ], + [ + "gcc", + "proc/osx/gcc.sh" + ], + [ + "gladimpl", + "external/glad/glad_impl.h" + ], + [ + "procosx", + "proc/osx/compile_osx_gcc.sh" + ], + [ + "graphics.c", + "source/graphics/gs_graphics.c" + ], + [ + "grpahics.h", + "include/graphics/gs_graphics.h" + ], + [ + "opengl", + "source/graphics/opengl/gs_graphics_opengl.c" + ], + [ + "opengl.c", + "source/graphics/opengl/gs_graphics_opengl.c" + ], + [ + "immediate.c", + "examples/simple_immediate_rend/source/main.c" + ], + [ + "simpletriangle.c", + "examples/simple_triangle/source/main.c" + ], + [ + "simpletri.c", + "examples/simple_triangle/source/main.c" + ], + [ + "simpletr", + "examples/simple_triangle/source/main.c" + ], + [ + "engine.c", + "source/base/gs_engine.c" + ], + [ + "types.h", + "include/common/gs_types.h" + ], + [ + "ut", + "include/common/gs_util.h" + ], + [ + "audio.c", + "source/audio/gs_audio.c" + ], + [ + "miniaudio.c", + "source/audio/miniaudio/gs_miniaudio.c" + ], + [ + "vorbis.c", + "third_party/include/stb/stb_vorbis.c" + ], + [ + "vor", + "third_party/include/stb/stb_vorbis.c" + ], + [ + "containers.h", + "include/common/gs_containers.h" + ], + [ + "platform.c", + "source/platform/gs_platform.c" + ], + [ + "glfw.c", + "source/platform/glfw/gs_platform_glfw.c" + ], + [ + "hellgs.c", + "examples/hello_gs/source/main.c" + ], + [ + "engine.h", + "include/base/gs_engine.h" + ], + [ + "math.h", + "include/math/gs_math.h" + ], + [ + "bytebuffer.h", + "include/serialize/gs_byte_buffer.h" + ], + [ + "simpelconta.c", + "examples/simple_containers/source/main.c" + ], + [ + "containers", + "include/common/gs_containers.h" + ], + [ + "platform.h", + "include/platform/gs_platform.h" + ], + [ + "bytebuffer.c", + "source/serialize/gs_byte_buffer.c" + ], + [ + "util.h", + "include/common/gs_util.h" + ], + [ + "pong.c", + "examples/pong/source/main.c" + ], + [ + "material.c", + "source/graphics/gs_material.c" + ], + [ + "opeg", + "source/graphics/opengl/gs_graphics_opengl.c" + ], + [ + "simpleim.c", + "examples/simple_immediate_rend/source/main.c" + ], + [ + "miniaudi.c", + "source/audio/miniaudio/gs_miniaudio.c" + ], + [ + "minaudio.c", + "source/audio/miniaudio/gs_miniaudio.c" + ], + [ + "maaudio.c", + "source/audio/miniaudio/gs_miniaudio.c" + ], + [ + "audio.h", + "include/audio/gs_audio.h" + ], + [ + "simpleconat.c", + "examples/simple_containers/source/main.c" + ], + [ + "customquadbatch.c", + "examples/custom_quad_batch/source/main.c" + ], + [ + "quadbatch.c", + "source/graphics/gs_quad_batch.c" + ], + [ + "quadbatch.h", + "include/graphics/gs_quad_batch.h" + ] + ], + "width": 0.0 + }, + "select_project": + { + "height": 0.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 0.0 + }, + "select_symbol": + { + "height": 354.0, + "last_filter": "", + "selected_items": + [ + ], + "width": 635.0 + }, + "selected_group": 0, + "settings": + { + }, + "show_minimap": false, + "show_open_files": false, + "show_tabs": true, + "side_bar_visible": true, + "side_bar_width": 163.0, + "status_bar_visible": true, + "template_settings": + { + } +} diff --git a/proc/win/cl.bat b/proc/win/cl.bat @@ -0,0 +1,35 @@ +@echo off +rmdir /Q /S bin +mkdir bin +pushd bin + +rem Name +set name=App + +rem Include directories +set inc=/I ..\third_party\include\ + +rem Source files +set src_main=..\source\*.c + +rem All source together +set src_all=%src_main% + +rem OS Libraries +set os_libs= opengl32.lib kernel32.lib user32.lib ^ +shell32.lib vcruntime.lib msvcrt.lib gdi32.lib Winmm.lib Advapi32.lib + +rem Link options +set l_options=/EHsc /link /SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt.lib + +rem Compile Release +rem cl /MP /FS /Ox /W0 /Fe%name%.exe %src_all% %inc% ^ +rem /EHsc /link /SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:LIBCMT ^ +rem %os_libs% + +rem Compile Debug +cl /w /MP -Zi /DEBUG:FULL /Fe%name%.exe %src_all% %inc% ^ +/EHsc /link /SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:LIBCMT ^ +%os_libs% + +popd diff --git a/proc/win/mingw.sh b/proc/win/mingw.sh @@ -0,0 +1,40 @@ +#!bin/sh + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w +) + +# Include directories +inc=( + -I ../third_party/include/ # Gunslinger includes +) + +# Source files +src=( + ../source/main.c +) + +libs=( + -lopengl32 + -lkernel32 + -luser32 + -lshell32 + -lgdi32 + -lWinmm + -lAdvapi32 +) + +# Build +gcc -O0 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} + +cd .. + + + diff --git a/proc/win/mingw_cross_platform.sh b/proc/win/mingw_cross_platform.sh @@ -0,0 +1,39 @@ +#!bin/bash + +# Make sure you have mingw-w64 installed for this to work. +# It should be available in most linux package managers and with brew(MacOS). + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w +) + +# Include directories +inc=( + -I ../third_party/include/ # Gunslinger includes +) + +# Source files +src=( + ../source/main.c +) + +libs=( + -lopengl32 + -lkernel32 + -luser32 + -lshell32 + -lgdi32 + -lwinmm +) + +# Build +x86_64-w64-mingw32-gcc -O0 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} + +cd .. diff --git a/proc/win/mingw_dbg.sh b/proc/win/mingw_dbg.sh @@ -0,0 +1,41 @@ +#!bin/sh + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w +) + +# Include directories +inc=( + -I ../third_party/include/ # Gunslinger includes +) + +# Source files +src=( + ../source/main.c +) + +libs=( + -lopengl32 + -lkernel32 + -luser32 + -lshell32 + -lgdi32 + -lWinmm + -lAdvapi32 +) + +# Build +echo gcc -O0 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} +gcc -O0 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} + +cd .. + + + diff --git a/proc/win/mingw_rdbg.sh b/proc/win/mingw_rdbg.sh @@ -0,0 +1,41 @@ +#!bin/sh + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w +) + +# Include directories +inc=( + -I ../third_party/include/ # Gunslinger includes +) + +# Source files +src=( + ../source/main.c +) + +libs=( + -lopengl32 + -lkernel32 + -luser32 + -lshell32 + -lgdi32 + -lWinmm + -lAdvapi32 +) + +# Build +echo gcc -O1 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} +gcc -O1 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} + +cd .. + + + diff --git a/proc/win/mingw_rel.sh b/proc/win/mingw_rel.sh @@ -0,0 +1,41 @@ +#!bin/sh + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w +) + +# Include directories +inc=( + -I ../third_party/include/ # Gunslinger includes +) + +# Source files +src=( + ../source/main.c +) + +libs=( + -lopengl32 + -lkernel32 + -luser32 + -lshell32 + -lgdi32 + -lWinmm + -lAdvapi32 +) + +# Build +echo gcc -O3 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} +gcc -O3 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} + +cd .. + + + diff --git a/source/gs.c b/source/gs.c @@ -0,0 +1,3 @@ +#define GS_IMPL +#define GS_NO_HIJACK_MAIN +#include <gs/gs.h> diff --git a/source/main.c b/source/main.c @@ -0,0 +1,347 @@ +#include <gs/gs.h> + +#define GS_BUCKET_ARRAY_INVALID_HANDLE UINT32_MAX + +#define __gs_bucket_array_raw(__T) \ + struct \ + { \ + uint32_t bucket_size; \ + uint32_t null_buckets; \ + gs_dyn_array(int64_t) bit_field; \ + gs_dyn_array(__T*) data; \ + __T tmp; \ + } +#define gs_bucket_array(__T)\ + __gs_bucket_array_raw(__T)* + +#define gs_bucket_array_new_ex(__T, __AMOUNT, __NULL_NEW_BUCKETS)\ + __gs_bucket_array_new(__AMOUNT, sizeof(__gs_bucket_array_raw(__T)), __NULL_NEW_BUCKETS) + +#define gs_bucket_array_new(__T, __AMOUNT)\ + gs_bucket_array_new_ex(__T, __AMOUNT, 0) + +gs_force_inline void* +__gs_bucket_array_new(uint32_t amount, size_t struct_size, uint32_t null_buckets) +{ + void* ret = malloc(struct_size); + memset(ret, 0, struct_size); + uint32_t* i = ret; + i[0] = amount; + i[1] = null_buckets; + return ret; +} + +#define gs_bucket_array_bucket_size(__BA) ((__BA)->bucket_size) +#define gs_bucket_array_bucket_count(__BA) (gs_dyn_array_size((__BA)->data)) +#define gs_bucket_array_capacity(__BA) ((__BA)->bucket_size * gs_dyn_array_size((__BA)->data)) + +#define gs_bucket_array_exists(__BA, __HNDL)\ + (__HNDL / (__BA)->bucket_size > gs_dyn_array_size((__BA)->data) ? false : \ + __gs_bucket_array_check((__BA)->bit_field, __HNDL) ? \ + true : false) + +#define gs_bucket_array_get(__BA, __HNDL)\ + (__BA)->data[(__HNDL) / (__BA)->bucket_size][(__HNDL) - (__HNDL) / (__BA)->bucket_size * (__BA)->bucket_size] + +#define gs_bucket_array_getp(__BA, __HNDL) &gs_bucket_array_get(__BA, __HNDL) + +#define gs_bucket_array_insert(__BA, __VAL)\ + ((__BA)->tmp = __VAL, \ + __gs_bucket_array_insert_into_any_bucket((void***)&((__BA)->data), &(__BA)->bit_field, (__BA)->bucket_size, \ + &(__BA)->tmp, sizeof((__BA)->tmp), (__BA)->null_buckets)) + +#define gs_bucket_array_erase(__BA, __HNDL)\ + __gs_bucket_array_clear_bucket((__BA)->bit_field, __HNDL) + +gs_force_inline bool32_t +__gs_bucket_array_check(int64_t* bit_field, uint32_t index) +{ + uint32_t bit_field_index = index / 64; + uint32_t bit = index - bit_field_index * 64; + + return bit_field[bit_field_index] & (1L << bit) ? true : false; +} + +gs_force_inline void +__gs_bucket_array_clear_bucket(int64_t* bit_field, uint32_t index) +{ + uint32_t bit_field_index = index / 64; + uint32_t bit = index - bit_field_index * 64; + + bit_field[bit_field_index] &= ~(1L << bit); +} + +gs_force_inline uint32_t +__gs_bucket_array_insert_into_any_bucket(void*** dynarr, int64_t** bit_field_dynarr, + uint32_t bucket_size, void* element, size_t element_size, uint32_t null_buckets) +{ + uint32_t index; + uint32_t bit_sz = gs_dyn_array_size(*bit_field_dynarr); + uint32_t sz = gs_dyn_array_size(*dynarr); + + for (uint32_t i = 0; i < bit_sz; i++) { + int pos = ffsll(~bit_field_dynarr[0][i]); + if (pos) { + index = pos - 1 + i * 64; + if (index >= sz * bucket_size) break; + + void* p = (char*)dynarr[0][index / bucket_size] + (index - index / bucket_size * bucket_size) * element_size; + memcpy(p, element, element_size); + bit_field_dynarr[0][i] |= 1L << (pos - 1); + return index; + } + } + + void* tmp_ptr = malloc(element_size * bucket_size); + memcpy(tmp_ptr, element, element_size); + if (null_buckets) memset((char*)tmp_ptr + element_size, 0, (element_size - 1) * bucket_size); + gs_dyn_array_push_data((void**)dynarr, &tmp_ptr, sizeof(tmp_ptr)); + + index = bucket_size * sz; + uint32_t last_field_end = index + ((index % 64) ? (64 - index % 64) : 0); + + uint32_t index_end = index + bucket_size; + uint32_t new_index_field_end = index_end + ((index_end % 64) ? (64 - index_end % 64) : 0); + + uint32_t new_bit_size = (new_index_field_end - last_field_end) / 64; + int64_t tmp = 0; + for (uint32_t i = 0; i < new_bit_size; i++) + gs_dyn_array_push(*bit_field_dynarr, tmp); + + bit_field_dynarr[0][index / 64] |= 1L << (index - index / 64 * 64); + + return sz * bucket_size; +} + +// normal iter +#define gs_bucket_array_iter uint32_t +#define gs_bucket_array_iter_new(__BA) __gs_bucket_array_iter_new_func((__BA)->bit_field, (__BA)->bucket_size * gs_bucket_array_bucket_count(__BA)) +#define gs_bucket_array_iter_valid(__BA, __IT) (__IT != GS_BUCKET_ARRAY_INVALID_HANDLE) +#define gs_bucket_array_iter_advance(__BA, __IT) __gs_bucket_array_advance_func((__BA)->bit_field, &__IT, (__BA)->bucket_size * gs_bucket_array_bucket_count(__BA)) + +gs_force_inline uint32_t +__gs_bucket_array_iter_new_func(int64_t* bit_field, uint32_t max_index) +{ + uint32_t res = 1; + uint32_t idx = 0; + do { + if (!res) idx++; + if (idx >= max_index) { + idx = GS_BUCKET_ARRAY_INVALID_HANDLE; + break; + } + res = __gs_bucket_array_check(bit_field, idx); + } while (!res); + return idx; +} + +gs_force_inline void +__gs_bucket_array_advance_func(int64_t* bit_field, uint32_t* index, uint32_t max_index) +{ + uint32_t res = 0; + do { + *index += 1; + if (*index >= max_index) { + *index = GS_BUCKET_ARRAY_INVALID_HANDLE; + return; + } + res = __gs_bucket_array_check(bit_field, *index); + } while (!res); +} + +// fast iter +typedef struct gs_bucket_array_iter_fast_s { + uint32_t major; + uint32_t minor; +} gs_bucket_array_iter_fast; + +#define gs_bucket_array_iter_fast_new(__BA) gs_default_val() +#define gs_bucket_array_iter_fast_valid(__BA, __IT) (__IT.major < gs_bucket_array_bucket_count(__BA)) +#define gs_bucket_array_iter_fast_advance(__BA, __IT) __gs_bucket_array_fast_advance_func(&__IT, (__BA)->bucket_size) + +gs_force_inline void +__gs_bucket_array_fast_advance_func(gs_bucket_array_iter_fast* it, uint32_t bucket_size) +{ + it->minor += 1; + if (it->minor >= bucket_size) { + it->minor = 0; + it->major += 1; + } +} +#define gs_bucket_array_iter_fast_get(__BA, __IT)\ + (__BA)->data[__IT.major][__IT.minor] + +#define gs_bucket_array_iter_fast_getp(__BA, __IT)\ + &gs_bucket_array_iter_fast_get(__BA, __IT) + +#define gs_bucket_array_iter_fast_get_hndl(__BA, __IT)\ + (__IT.major * (__BA)->bucket_size + __IT.minor) + + +// clear and free +#define gs_bucket_array_clear(__BA)\ + memset((__BA)->bit_field, 0, gs_dyn_array_size((__BA)->bit_field) * sizeof(int64_t)); + +#define gs_bucket_array_free(__BA)\ + do { \ + if (__BA) { \ + gs_dyn_array_free((__BA)->bit_field); \ + for (uint32_t __BA_IT = 0; __BA_IT < gs_dyn_array_size((__BA)->data); __BA_IT++) \ + gs_free((__BA)->data[__BA_IT]); \ + gs_dyn_array_free((__BA)->data); \ + gs_free(__BA); \ + __BA = NULL; \ + } \ + } while (0) + +/* + + gs_bucket_array: + + NOTE: + > Unlike the other gunslinger containers, the gs_bucket_array needs initialization. + > It is NOT allocated on use. + + Bucket arrays are internally a list of pointers to fixed-size arrays: + This means that there are no re-allocs, and all your pointers will remain valid. + + Due to the nature of this container it's very handy for managing both stuff that are + constant and dynamic in a singular place. + + Because of this the container also has a bit-field that specifies which elements are in-use. + This creates an interface almost identitcal to gs_slot_array. + The major drawback of this is a somewhat slow iterator (and a non-"instant" insertion). + + The guts of look somewhat like: + + gs_dyn_array(Type[bucket_size]) your_data; + gs_dyn_array(int64_t) bit_field; + + Standard initializatoin would look like: + + gs_bucket_array(float) arr = gs_bucket_array_new(float, 100); // Bucket array with internal 'float' data, where each bucket is 100 floats + uint32_t hndl = gs_bucket_array_insert(arr, 3.145f); // Inserts your data into the bucket array, returns handle to you + float* val_p = gs_bucket_array_getp(arr, hndl); // Returns copy of data to you using handle as lookup + float val = gs_bucket_array_get(arr, hndl); + + + The Bucket array provides iterators: + + for ( + gs_bucket_array_iter it = gs_bucket_array_iter_new(ba); + gs_bucket_array_iter_valid(ba, it); + gs_bucket_array_iter_advance(ba, it) + ) { + float v = gs_bucket_array_get(ba, it); // Get value using iterator + float* vp = gs_bucket_array_getp(ba, it); // Get value pointer using iterator + } + + This iterator gather a index into the bucket array, which you later can use to get pointers/values + through the indirection. + However you might not always need this. + If you don't care about elements being "valid" you can use the fast iterator: + + for ( + gs_bucket_array_iter_fast it = gs_bucket_array_iter_fast_new(ba); + gs_bucket_array_iter_fast_valid(ba, it); + gs_bucket_array_iter_fast_advance(ba, it) + ) { + float v = gs_bucket_array_iter_fast_get(ba, it); // Get value using iterator + float* vp = gs_bucket_array_iter_fast_getp(ba, it); // Get value pointer using iterator + uint32_t hndl = gs_bucket_array_iter_fast_get_hndl(ba, it); // Get a normal handle from iterator + } + + Internally the fast iterator is just struct {uint32_t major; uint32_t minor;} + TIP: + > You may store your own "bool enabled;" in your what you store in the bucket array. + > You can then use the fast iterator and check for this yourself. + > However, note that this needs gs_bucket_array_new_ex where null_new_buckets is set to true, + > this is because un-initialized data will otherwise interfere. + + + Bucket Array Usage: + + gs_bucket_array(float) ba = gs_bucket_array_new(float, 100); // Bucket array with internal 'float' data, where each bucket is 100 floats + uint32_t hndl = gs_bucket_array_insert(ba, 3.145f); // Inserts your data into the bucket array, returns handle to you + float* val_p = gs_bucket_array_getp(ba, hndl); // Returns your data to you using handle as lookup + float val = gs_bucket_array_get(ba, hndl); // Dereferences your data as well + uint32_t bs = gs_bucket_array_bucket_size(ba) // Returns initialized bucket size + uint32_t bc = gs_bucket_array_bucket_count(ba) // Returns the amount of buckets allocated + uint32_t b_cap = gs_bucket_array_capacity(ba) // Returns bucket_size * bucket_count + gs_bucket_array_clear(ba) // Sets the entire bit-field to 0 + gs_bucket_array_free(ba) // Free's the entire array, make sure your own elements are free'd first + + // if you use new_ex, you can set a bool to memset every new bucket to zero + gs_bucket_array(int) ba_null_on_new = gs_bucket_array_new_ex(int, 64, true); + +*/ + + +int main() +{ + gs_bucket_array(int) foo = gs_bucket_array_new_ex(int, 99, 1); + gs_println("foo has a bucket size of %d", gs_bucket_array_bucket_size(foo)); + + uint32_t element_inserts = 400; + gs_println("---- inserting %d elements", element_inserts); + for (int i = 0; i < element_inserts; i++) +#if 0 + gs_println("got hndl %3d : bucket count %2d", gs_bucket_array_insert(foo, i), gs_bucket_array_bucket_count(foo)); +#else + gs_bucket_array_insert(foo, i + 1); +#endif + + const int start = element_inserts + 5 - 20; + const int end = start + 20; + + for (int i = start + 5; i < start + 10; i++) + gs_bucket_array_erase(foo, i); + + gs_println("---- checking the elements %d -> %d", start, end); + for (int i = start; i < end; i++) { + if (gs_bucket_array_exists(foo, i)) { + gs_println("element %d: exists and has value %d", i, gs_bucket_array_get(foo, i)); + } else { + gs_println("element %d: does not exist", i); + } + } + + for (int i = 2; i < 100; i++) + gs_bucket_array_erase(foo, i); + + int loops = 0; + for (gs_bucket_array_iter it = gs_bucket_array_iter_new(foo); + gs_bucket_array_iter_valid(foo, it); + gs_bucket_array_iter_advance(foo, it) + ) { + int test = gs_bucket_array_get(foo, it); + int* testp = gs_bucket_array_getp(foo, it); + loops++; + if (test == 250) + gs_println("element with value 250 found after %d loops, iterator is now %d", loops, it); + } + + gs_bucket_array_clear(foo); + + for (gs_bucket_array_iter it = gs_bucket_array_iter_new(foo); + gs_bucket_array_iter_valid(foo, it); + gs_bucket_array_iter_advance(foo, it) + ) { + gs_println("element %d:%d", it, gs_bucket_array_get(foo, it)); + } + + for (gs_bucket_array_iter_fast it = gs_bucket_array_iter_fast_new(foo); + gs_bucket_array_iter_fast_valid(foo, it); + gs_bucket_array_iter_fast_advance(foo, it) + ) { + int i = gs_bucket_array_iter_fast_get(foo, it); + if (!i) break; + uint32_t hndl = gs_bucket_array_iter_fast_get_hndl(foo, it); + gs_println("element %d:%d", hndl, i); + + } + + gs_bucket_array_free(foo); + + return 0; +} diff --git a/third_party/include/gs b/third_party/include/gs @@ -0,0 +1 @@ +Subproject commit 2dbfb8a3b1d2e7fa3766705216ac93298e0791c7