Skip to content

Instantly share code, notes, and snippets.

@gingerBill
gingerBill / odin.ebnf
Last active November 17, 2022 15:19
Odin EBNF (Work In Progress)
View odin.ebnf
/* characters */
newline = /* the Unicode code point U+000A */ .
unicode_char = /* an arbitrary Unicode codepoint except newline */ .
unicode_letter = /* a Unicode code point categorized as "Letter" */ .
unicode_digit = /* a Unicode code point categorized as "Number, decimal digit" */ .
letter = unicode_letter | "_" .
decimal_digit = "0" ... "9" .
binary_digit = "0" | "1" .
@gingerBill
gingerBill / d3d11_in_odin.odin
Last active November 2, 2022 11:37
D3D11 in Odin
View d3d11_in_odin.odin
package d3d11_main
import D3D11 "vendor:directx/d3d11"
import DXGI "vendor:directx/dxgi"
import D3D "vendor:directx/d3d_compiler"
import SDL "vendor:sdl2"
import glm "core:math/linalg/glsl"
// Based off https://gist.github.com/d7samurai/261c69490cce0620d0bfc93003cd1052
@gingerBill
gingerBill / metal_in_odin.odin
Last active April 16, 2022 03:32
Metal in Odin Natively
View metal_in_odin.odin
package objc_test
import NS "vendor:darwin/Foundation"
import MTL "vendor:darwin/Metal"
import CA "vendor:darwin/QuartzCore"
import SDL "vendor:sdl2"
import "core:fmt"
import "core:os"
@gingerBill
gingerBill / wasm4_wasm32.odin
Created November 9, 2021 15:34
WASM-4 Odin Bindings
View wasm4_wasm32.odin
// WASM-4: https://wasm4.org/docs
package wasm4
foreign import wasm4 "env"
#assert(size_of(int) == size_of(u32))
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ Platform Constants │
@gingerBill
gingerBill / wasm4_wasm32.odin
Last active September 30, 2022 23:32
WASM-4 Odin bindings
View wasm4_wasm32.odin
// WASM-4: https://wasm4.org/docs
package wasm4
foreign import wasm4 "env"
#assert(size_of(int) == size_of(u32))
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ Platform Constants │
@gingerBill
gingerBill / sdl2_opengl_demo.odin
Last active June 28, 2022 08:49
Simple SDL2 + OpenGL demo written in Odin
View sdl2_opengl_demo.odin
package main
import "core:fmt"
import glm "core:math/linalg/glsl"
import "core:time"
import SDL "vendor:sdl2"
import gl "vendor:OpenGL"
main :: proc() {
@gingerBill
gingerBill / microui_raylib_demo.odin
Created October 2, 2021 23:17
microui + raylib Demo in Odin
View microui_raylib_demo.odin
package microui_raylib
import "core:fmt"
import "core:unicode/utf8"
import rl "vendor:raylib"
import mu "vendor:microui"
state := struct {
mu_ctx: mu.Context,
log_buf: [1<<16]byte,
@gingerBill
gingerBill / raylib_tetroid.odin
Last active October 4, 2021 10:33
Tetroid in raylib with Odin
View raylib_tetroid.odin
package main
/*******************************************************************************************
*
* raylib - classic game: tetroid
*
* Sample game developed by Marc Palau and Ramon Santamaria
*
* This game has been created using raylib v1.3 (www.raylib.com)
@gingerBill
gingerBill / microui_sdl_demo.odin
Last active September 10, 2022 04:22
microui + SDL Demo in Odin
View microui_sdl_demo.odin
package microui_sdl
import "core:fmt"
import "core:c/libc"
import SDL "vendor:sdl2"
import mu "vendor:microui"
state := struct {
mu_ctx: mu.Context,
log_buf: [1<<16]byte,
@gingerBill
gingerBill / Style_Table.md
Last active March 16, 2021 23:03
Procedure Signature Styles and Ambiguities
View Style_Table.md
Prefix/Odin Require Return Type Return Named Inputs
Empty Procedure proc() () -> void ()
1 input, unnamed proc(int) (int) -> void
1 input, named proc(x: int) (x: int) -> void (x: int)
1 input, 1 output proc(int) -> int (x: int) -> int (x: int) -> int
2 inputs, 2 unnamed outputs proc(int, int) -> (int, int) (int, int) -> (int, int) (x: int, y: int) -> (int, int)
0 inputs, 2 named outputs proc() -> (a: int, b: int) () -> (a: int, b: int)
2 in