This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local lib = require("neotest.lib") | |
| local async = require("neotest.async") | |
| local nio = require("nio") | |
| -- HACK: hack around a bug in neotest, they use this plenary.filetype module wrapped in a memoization | |
| -- function, and this library sets up filetype detection on the first call, meaning the first call | |
| -- can return no match (which is weird and bad by itself) but that is compounded by neotest just | |
| -- using that value for ever afterwards. | |
| -- This call will cause plenary to load the filetype and makes neotest later memoize the right thing. | |
| require("plenary.filetype").detect_from_extension("test.odin") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Port of [[ Wayland From Scratch; https://gaultier.github.io/blog/wayland_from_scratch.html ]] into Odin. | |
| Differences: | |
| - no ping/pong, didn't need it | |
| - wayland logo does not need to be converted into ppm, I used `core:image/png` to parse the PNG source | |
| */ | |
| package main | |
| import "base:intrinsics" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| city64 :: proc(data: []byte) -> u64 { | |
| // Some primes between 2^63 and 2^64 for various uses. | |
| K0 :: 0xc3a5c85c97cb3127 | |
| K1 :: 0xb492b66fbe98f273 | |
| K2 :: 0x9ae16a3b2f90404f | |
| fetch64 :: proc(p: [^]byte) -> u64 { | |
| res := intrinsics.unaligned_load((^u64)(p)) | |
| when ODIN_ENDIAN == .Big { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "base:intrinsics" | |
| import "base:runtime" | |
| import "core:hash" | |
| import "core:mem" | |
| import "core:strings" | |
| import "core:unicode" | |
| import "core:unicode/utf8" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en" style="height: 100%;"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Yo</title> | |
| </head> | |
| <body id="body" style="height: 100%; padding: 0; margin: 0; overflow: hidden;"> | |
| <canvas id="wgpu-canvas"></canvas> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deep_clone :: proc(value: $T, allocator := context.allocator, temp_allocator := context.temp_allocator) -> (clone: T) { | |
| internal_deep_clone :: proc(value: any, clone: any, ptrs: ^map[rawptr]rawptr) { | |
| // Forgive me father for I have sinned. | |
| using reflect | |
| value_core := any_core(value) | |
| clone_core := any_core(clone) | |
| assert(value_core.id == clone_core.id) | |
| fti := type_info_of(value_core.id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "core:c/libc" | |
| import "core:fmt" | |
| import "core:io" | |
| import "core:os" | |
| import "core:time" | |
| import "core:unicode/utf8" | |
| @(require) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package rlights | |
| import rl "vendor:raylib" | |
| MAX_LIGHTS :: 4 | |
| Light :: struct { | |
| type: LightType, | |
| enabled: b32, | |
| position: [3]f32, |
NewerOlder