This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include <Spaghetti/Vec2.h> | |
| namespace Spaghetti { | |
| template<typename T> | |
| struct Vec2; | |
| template<typename T> | |
| struct Circle { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public readonly struct Subscription : IDisposable | |
| { | |
| private readonly Action? m_Dispose; | |
| public Subscription(Action dispose) | |
| { | |
| m_Dispose = dispose; | |
| } | |
| public void Dispose() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public sealed class ObjectPool<T> : IDisposable where T : Node2D, IPoolable<T> | |
| { | |
| private readonly Node m_Parent; | |
| private readonly PackedScene m_PackedScene; | |
| private readonly string? m_Group; | |
| private readonly HashSet<T> m_Active = new HashSet<T>(); | |
| private readonly Stack<T> m_Inactive = new Stack<T>(); | |
| private readonly Action<T> m_OnReleased; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include <pico_ecs.h> | |
| // -- System API -- | |
| template<ecs_system_fn F> | |
| inline ecs_id_t ecs_system; | |
| template<ecs_system_fn F, typename... Cs> | |
| ecs_id_t ecs_register_system(ecs_t *ecs, void *udata) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define SPRITEBATCH_CHECK_BUFFER_GROW(ctx, count, capacity, data, type) \ | |
| do { \ | |
| if ((ctx->count) >= ctx->capacity) \ | |
| { \ | |
| int new_capacity = (ctx->count) * 2; \ | |
| void* new_data = SPRITEBATCH_MALLOC(sizeof(type) * new_capacity, ctx->mem_ctx); \ | |
| if (!new_data) return 0; \ | |
| SPRITEBATCH_MEMCPY(new_data, ctx->data, sizeof(type) * (ctx->count)); \ | |
| SPRITEBATCH_FREE(ctx->data, ctx->mem_ctx); \ | |
| ctx->data = (type*)new_data; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Shallow copy a table | |
| local function shallow_copy(t) | |
| local copy = {} | |
| for k, v in pairs(t) do | |
| copy[k] = v | |
| end | |
| return copy | |
| end | |
| -- Escape reserved characters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ---@meta | |
| ---@class CF_Touch | |
| ---@field id number | |
| ---@field x number | |
| ---@field y number | |
| ---@field pressure number | |
| ---@class CF_ImeComposition | |
| ---@field composition string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ---@class Profiler | |
| local profiler = { | |
| internal_fns = {}, | |
| call_stack = {}, | |
| call_tree = {}, | |
| clock = function() | |
| return get_ticks() / get_tick_frequency() | |
| end | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| include(FetchContent) | |
| FetchContent_Declare( | |
| luajit | |
| GIT_REPOSITORY https://github.com/LuaJIT/LuaJIT | |
| GIT_TAG v2.1 | |
| ) | |
| FetchContent_MakeAvailable(luajit) | |
| if (luajit_ADDED) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint64_t b2_colorBox2DYellow = 16772748; | |
| uint64_t b2_colorBox2DGreen = 9226532; | |
| uint64_t b2_colorBox2DBlue = 3190463; | |
| uint64_t b2_colorBox2DRed = 14430514; | |
| uint64_t b2_colorYellowGreen = 10145074; | |
| uint64_t b2_colorYellow = 16776960; | |
| uint64_t b2_colorWhiteSmoke = 16119285; | |
| uint64_t b2_colorWhite = 16777215; | |
| uint64_t b2_colorWheat = 16113331; | |
| uint64_t b2_colorVioletRed = 13639824; |
OlderNewer