Skip to content

Instantly share code, notes, and snippets.

@pJotoro
pJotoro / flash_red.gml
Last active August 10, 2020 19:10
Gamemaker shader confusion
if red > 0
{
shader_set(sh_red);
shade_alpha = shader_get_uniform(sh_red, "alpha");
shader_set_uniform_f(shade_alpha, 0);
draw_self();
shader_reset();
}
@pJotoro
pJotoro / wasm4_snake_demo.odin
Last active January 13, 2022 10:38
snake demo example for wasm4
// Thanks to Jeroen for giving me his random algorithm code!
package main
import "w4"
Input :: struct #packed {
gamepads: [4]w4.Buttons,
mouse: struct #packed {
pos: [2]i16,
// Add this in vendor\vulkan\core.odin
VK_KHR_MAINTENANCE_1_SPEC_VERSION :: 2
VK_KHR_MAINTENANCE_1_EXTENSION_NAME :: "VK_KHR_maintenance1"
VK_KHR_MAINTENANCE_2_SPEC_VERSION :: 1
VK_KHR_MAINTENANCE_2_EXTENSION_NAME :: "VK_KHR_maintenance2"
VK_KHR_MAINTENANCE_3_SPEC_VERSION :: 1
VK_KHR_MAINTENANCE_3_EXTENSION_NAME :: "VK_KHR_maintenance3"
VK_NV_VIEWPORT_ARRAY_2_SPEC_VERSION :: 1
VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME :: "VK_NV_viewport_array2"
package tokenizer
import "core:text/scanner"
import "core:unicode"
import "core:strings"
import "core:slice"
Tokenizer :: struct {
src: string,
}
package kit
//////////////////////////////////////////////////////////////////////////////
// Embedded font
//////////////////////////////////////////////////////////////////////////////
@(private)
font_png := [?]byte{
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x01, 0x00,
@pJotoro
pJotoro / app.odin
Created May 27, 2023 15:47
Pong in Odin, no libraries
package app
import win32 "core:sys/windows"
import "core:intrinsics"
import "core:runtime"
L :: intrinsics.constant_utf16_cstring
@(private)
Context :: struct {
should_close: bool,
@pJotoro
pJotoro / main.odin
Created May 29, 2023 02:27
CPU raytracer in Odin
package main
import "app"
import "core:slice"
import "core:math"
import "core:math/linalg"
import "core:fmt"
Vector2f32 :: linalg.Vector2f32
Vector3f32 :: linalg.Vector3f32
package main
import "jo:app"
import "core:mem"
import "core:os"
import "core:strings"
import "core:text/edit"
import stbtt "vendor:stb/truetype"
Glyph :: struct {
package main
import "jo:app"
import win32 "core:sys/windows"
import "vendor:directx/d3d11"
import "vendor:directx/d3d_compiler"
import "vendor:directx/dxgi"
D3D11_Context :: struct {
@pJotoro
pJotoro / main.odin
Last active August 31, 2024 15:53
Minimal D3D11 with jo
package main
// Original: https://gist.github.com/d7samurai/261c69490cce0620d0bfc93003cd1052
import "jo:app"
import "vendor:directx/d3d11"
import "vendor:directx/dxgi"
import "vendor:directx/d3d_compiler"