#pragma once #include typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; typedef int8_t i8; typedef int16_t i16; typedef int32_t i32; typedef int64_t i64; typedef float f32; typedef double f64; // Source - https://stackoverflow.com/a/8862167 #define SWAP(x, y) \ do { \ __typeof__(x) _x = x; \ __typeof__(y) _y = y; \ x = _y; \ y = _x; \ } while (0) #define I_PART(x) ((int)(x)) #define F_PART(x) ((x) - (float)I_PART(x)) #define RF_PART(x) (1.0f - F_PART(x)) #define COLOR(r, g, b, a) ((Color){{b, g, r, a}}) #define RGB(r, g, b) COLOR(b, g, r, 255) #define ANSI_RED(str) "\x1b[31m" str "\x1b[0m" #define ANSI_GREEN(str) "\x1b[32m" str "\x1b[0m" #define ANSI_YELLOW(str) "\x1b[33m" str "\x1b[0m" #define ANSI_BLUE(str) "\x1b[34m" str "\x1b[0m" #define ANSI_CYAN(str) "\x1b[36m" str "\x1b[0m" typedef struct { u32 *pixels; u32 width; u32 height; u32 pitch; } Framebuffer; typedef union { struct { u8 b, g, r, a; }; uint32_t packed; } Color; typedef struct { f32 x; f32 y; } V2;