Skip to content

Instantly share code, notes, and snippets.

View waldnercharles's full-sized avatar

Charles Waldner waldnercharles

  • 08:26 (UTC -06:00)
View GitHub Profile
/*
fat_ecs.h - C23 ECS, single-header, SoA layout
USAGE:
#define ECS_COMPONENTS(X) X(Type, field) ...
#include "fat_ecs.h"
Zero-initialised ecs_world is ready to use immediately.
Slot 0 is a sentinel -- never allocated, always invalid.
<?xml version="1.0" encoding="utf-8"?>
<Profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Sony PlayStation 3</Name>
<Identification>
<FriendlyName>PLAYSTATION 3</FriendlyName>
<ModelNumber />
<SerialNumber />
<ModelName />
<ModelDescription />
<ModelUrl />
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_DEPRECATE
#include <ctype.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <direct.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
char *read_entire_file_to_memory_and_nul_terminate(const char *filename, size_t *file_size)
{
FILE* file = fopen(filename, "rb");
if (file == NULL) {
local ffi = require 'ffi'
ffi.cdef [[
typedef void* b2AllocFcn( unsigned int size, int alignment );
typedef void b2FreeFcn( void* mem );
typedef int b2AssertFcn( const char* condition, const char* fileName, int lineNumber );
void b2SetAllocator( b2AllocFcn* allocFcn, b2FreeFcn* freeFcn );
int b2GetByteCount( void );
void b2SetAssertFcn( b2AssertFcn* assertFcn );
typedef struct b2Version { int major; int minor; int revision; } b2Version;
b2Version b2GetVersion( void );
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;
@waldnercharles
waldnercharles / luajit.cmake
Created October 4, 2024 17:11
luajit cmake integration
include(FetchContent)
FetchContent_Declare(
luajit
GIT_REPOSITORY https://github.com/LuaJIT/LuaJIT
GIT_TAG v2.1
)
FetchContent_MakeAvailable(luajit)
if (luajit_ADDED)
---@class Profiler
local profiler = {
internal_fns = {},
call_stack = {},
call_tree = {},
clock = function()
return get_ticks() / get_tick_frequency()
end
}
---@meta
---@class CF_Touch
---@field id number
---@field x number
---@field y number
---@field pressure number
---@class CF_ImeComposition
---@field composition string
-- 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