Skip to content

Instantly share code, notes, and snippets.

Vec3: class{
x, y, z: Float
allocWith: static func(allocator: Func(SizeT)->Pointer) -> This{
object := allocator(Vec3 as Class instanceSize) as This
if(object) object class = This
return object
}
init: func(=x,=y,=z) -> This { this }
@od0x0
od0x0 / PIEC.c
Created September 15, 2010 21:03
/*
Platform Independent Endian Converter
Copyright (c) 2010 Oliver Daids
3-clause BSD
Note: This was not designed for speed, nor cleanliness, it was just a quick experiment to see if I could get a platform independent endian converter.
*/
#include <stdint.h>
AEArray(int) ints;
AEArrayInit(&ints);
AEArrayAdd(&ints, 1);
AEArrayAdd(&ints, 2);
AEArrayAdd(&ints, 3);
for(size_t i=0; i<AEArrayLength(&ints); i++)
printf("At Index %lu, we have %i\n", (unsigned long)i, AEArrayAsCArray(&ints)[i]);
AEArrayDeinit(&ints);
@interface UI : NSObject {
AEVec2 windowSize;
UIFont* font;
AEVec2 mouse;
struct{
char left, middle, right, upwheel, downwheel;
}mouseButtons;
AETable* cache;
struct{
AETextBuffer* textBuffer;
//Triangulated Mesh Editing Utility
#pragma once
#include "AE.h"
typedef struct AEMesh AEMesh;
typedef struct AEMeshVertex AEMeshVertex;
typedef struct AEMeshTriangle AEMeshTriangle;
typedef enum{
AEMeshTypeTriangles,
init: func ~withAllArgs(=ano, =mes, =dia){}
init: func (ano := 2011, mes := 1, dia := 1) {
init~withAllArgs(ano, mes, dia)
}
#include "AE.h"
typedef struct{
AEStringHashTable(AETexture) textures;
}ResourceManager;
void ResourceManagerInit(ResourceManager* self);
void ResourceManagerDeinit(ResourceManager* self);
AETexture ResourceManagerLookup(ResourceManager* self, const char* filename);
void ResourceManagerRemove(ResourceManager* self, const char* filename);
#include "AE.h"
#include "AESDL.h"
static void FrameUpdate(AEWindow* window, double seconds){
//Do something here
}
static void FixedUpdate(AEWindow* window, double seconds){
//Do something here
}
@od0x0
od0x0 / gist:965399
Created May 10, 2011 21:17
How I Load a .ogg into OpenAL Using stb_vorbis
typedef struct{
ALuint ID;
stb_vorbis* stream;
stb_vorbis_info info;
ALuint buffers[2];
ALuint source;
ALenum format;
#pragma once
#include "AECore.h"
#include "AEMath.h"
#include "AEArray.h"
typedef struct AERenderer AERenderer;
AERenderer* AERendererNew(void);
void AERendererDelete(AERenderer* self);