Skip to content

Instantly share code, notes, and snippets.

@Lucrecious
Lucrecious / array_t.odin
Last active May 8, 2025 23:44
orso dynamic array
array_t :: (!u: type) -> type {
return struct {
items: &u = .{};
count := 0;
capacity := 0;
};
};
push :: (arr: &!u, val: !v) -> void {
new_capacity := arr.capacity;
@Lucrecious
Lucrecious / gol.edl.odin
Last active February 28, 2025 17:38
the same implementation of GoL but with generics in orso now
do:gol {
width := readint();
height := readint();
tile_count := width*height;
if tile_count == 0 {
printint(0);
println();
break:gol 1;
@Lucrecious
Lucrecious / gol.c
Created February 7, 2025 22:00
c99 IR produced by orso compiler for this version of gol: https://gist.github.com/Lucrecious/d9ee0fd07c1981c37cbd5330943d8a6b
#define INTRINSICS_IMPLEMENTATION
#include "intrinsics.h"
#include "core.h"
#include "core.c"
typedef void(*fn_void)();
typedef void* p_void;
typedef p_void(*fn_size_t_p_void)(size_t);
typedef bool_(*fn_p_void_size_t_bool_)(p_void,size_t);
typedef size_t(*fn_size_t)();
typedef u64(*fn_u64)();
@Lucrecious
Lucrecious / gol.edl.odin
Last active February 7, 2025 21:56
the first ever program written in orso that proves it's a turing-complete language; the game of life. the first of many iterations as the language progresses.
// odin file extension used for syntax highlighting
do:gol {
// no strings yet so not printing anything yet
width := readint();
height := readint();
tile_count := width*height;
// exit immediately if board has no dimensions
if tile_count == 0 {
@Lucrecious
Lucrecious / scale2x.gdshader
Created July 19, 2022 23:51
A Fast Rot-Sprite shader based on Scale3x
shader_type canvas_item;
const vec4 background = vec4(1., 1., 1., 0.);
float dist(vec4 c1, vec4 c2) {
return (c1 == c2) ? 0.0 : abs(c1.r - c2.r) + abs(c1.g - c2.g) + abs(c1.b - c2.b);
}
bool similar(vec4 c1, vec4 c2, vec4 input) {
return (c1 == c2 || (dist(c1, c2) <= dist(input, c2) && dist(c1, c2) <= dist(input, c1)));
@Lucrecious
Lucrecious / scale3x.gdshader
Created July 19, 2022 23:45
A Fast Rot-Sprite shader based on Scale3x
shader_type canvas_item;
const vec4 background = vec4(1., 1., 1., 0.);
uniform float pixel_scale: hint_range(0.0, 1.0) = 1.0;
float dist(vec4 c1, vec4 c2) {
return (c1 == c2) ? 0.0 : abs(c1.r - c2.r) + abs(c1.g - c2.g) + abs(c1.b - c2.b);
}