Skip to content

Instantly share code, notes, and snippets.

View laytan's full-sized avatar

Laytan laytan

  • The Netherlands
  • 23:20 (UTC +02:00)
  • X @laytanl_
View GitHub Profile
@laytan
laytan / renderer.odin
Last active July 4, 2024 17:11
Example Odin font renderer using fontstash and WebGPU
package vendor_wgpu_example_fontstash
import intr "base:intrinsics"
import "core:fmt"
import "core:math/linalg"
import sa "core:container/small_array"
import fs "vendor:fontstash"
import "vendor:wgpu"
@laytan
laytan / Makefile
Created June 30, 2024 21:11
Odin with C entry point
program: entry.c program.odin
odin build . -out:program -no-entry-point -build-mode:object
clang entry.c program.o -o program
rm program.o
@laytan
laytan / rlights.odin
Created June 20, 2024 15:33
rlights port
package rlights
import rl "vendor:raylib"
MAX_LIGHTS :: 4
Light :: struct {
type: LightType,
enabled: b32,
position: [3]f32,
@laytan
laytan / odin.py
Created April 25, 2024 17:40
LLDB script to visualise Odin slices, maps, and strings
import lldb
def is_slice_type(t, internal_dict):
return t.name.startswith("[]") or t.name.startswith("[dynamic]")
class SliceChildProvider:
def __init__(self, val, dict):
self.val = val
def num_children(self):
@laytan
laytan / main.odin
Last active June 24, 2024 08:00
Graphviz Odin dependencies
package main
import "core:fmt"
import "core:io"
import "core:odin/ast"
import "core:odin/parser"
import "core:os"
import "core:path/filepath"
import "core:slice"
import "core:strings"
@laytan
laytan / main.odin
Created April 10, 2024 22:57
Stack traces using Odin instrumentation features
package main
import "core:runtime"
main :: proc() {
context.assertion_failure_proc = print_call_frames
foo()
}
@laytan
laytan / main.odin
Created March 18, 2024 21:44
Odin GLFW 3.4 Hello World
package main
import "core:log"
import "core:mem"
import "core:runtime"
import "vendor:glfw"
import gl "vendor:OpenGL"
main :: proc() {
@laytan
laytan / compile.sh
Last active May 21, 2024 10:13
Odin, GLFW & Vulkan boilerplate for Drawing a Triangle on https://vulkan-tutorial.com
#!/usr/bin/env sh
glslc shader.vert -o vert.spv
glslc shader.frag -o frag.spv
@laytan
laytan / minicoro.asm
Last active February 27, 2024 12:04
Odin minicoro source port (only darwin support for now)
/*
vim: syntax=armasm nospell
Some of the following assembly code is taken from LuaCoco by Mike Pall.
See https://coco.luajit.org/index.html
MIT license
Copyright (C) 2004-2016 Mike Pall. All rights reserved.
@laytan
laytan / lsp.odin
Last active January 18, 2024 03:19
Incomplete LSP example Odin
package lsp
import "core:bufio"
import "core:encoding/json"
import "core:io"
import "core:log"
Null :: distinct struct{}
Initialize_Error :: Response_Error(Initialize_Error_Data)