Skip to content

Instantly share code, notes, and snippets.

@doccaico
doccaico / main.odin
Created November 2, 2026 02:22
Win32api + Odin
package main
import "base:runtime"
import "core:fmt"
import "core:os"
import win "core:sys/windows"
center_window :: proc(hwnd: win.HWND, target_w, target_h: i32) {
DWMWA_EXTENDED_FRAME_BOUNDS :: 9
// Get display resolution
@doccaico
doccaico / README.md
Last active October 26, 2026 04:58
GLFW + GLAD + OPENGL (Windows / MSVC)

GLFW + GLAD + OPENGL (Windows / MSVC)

BUILD

# Debug build
$ build.bat
or
$ build.bat debug

# Release build
$ build.bat release
@doccaico
doccaico / main.nim
Created October 25, 2026 10:41
Basic Window - Win32api (winapi) in Nim
# https://github.com/arnetheduck/nim-win32-abi
import win32 / [winnt, winuser, libloaderapi]
const
windowWidth = 500
windowHeight = 400
template toPCSTR(s: string): PCSTR =
cast[PCSTR](cstring(s))
@doccaico
doccaico / main.nim
Created October 25, 2026 09:49
WinApi + 日本語 in Nim
# https://github.com/arnetheduck/nim-win32-abi
import win32 / [winnt, winuser]
# let
# title = newWideCString("タイトル")
# msg = newWideCString("メッセージ❤!")
# discard MessageBoxW(nil, cast[PCWSTR](msg[0].addr), cast[PCWSTR](title[0].addr), MB_YESNO.uint32)
let
title = newWideCString("Title")
@doccaico
doccaico / main.zig
Created October 23, 2026 23:31
Simple Parser Combinator in Zig
// Zig 0.17
const std = @import("std");
const Io = std.Io;
/// パースの結果を表す汎用構造体
pub fn ParserResult(comptime T: type) type {
return struct {
value: T,
rest: []const u8,
@doccaico
doccaico / main.nim
Last active October 24, 2026 12:22
Simple Parser Combinator in Nim
import std / [strutils, sugar]
type
ParseError = enum
PeMismatch
PeUnexpectedEOF
PeIntOverflow
ParseState[I] = object
input: I
@doccaico
doccaico / main.nim
Created October 12, 2026 01:08
Nimony + Raylib
# https://x.com/ociaccod/status/2109450500966162853
import std/syncio
{.pragma: raylib, cdecl, dynlib: "./libraylib.so".}
type
Color* {.bycopy.} = object
r*: uint8
g*: uint8
@doccaico
doccaico / build_web.bat
Created July 17, 2026 12:44
Raylib + Emscripten using HTML's select
@echo off
setlocal
set OUT_DIR=web
if not exist %OUT_DIR% mkdir %OUT_DIR%
set FILES="vendor\raylib\bin\wasm\libraylib.web.a"
set "FLAGS=-DPLATFORM_WEB"
set "FLAGS=%FLAGS% -I ./vendor/raylib/include"
@doccaico
doccaico / star.cs
Created June 18, 2026 02:35
Getting Github Repo Star in C#
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
string[,] urlList =
{
{ "nim-lang", "Nim" },
{ "odin-lang", "Odin" },
@doccaico
doccaico / build.sh
Last active January 11, 2026 04:12
SDL3 + C on Windows 11 (using w64devkit)
#!/bin/sh
EXE=main
SDL3=C:/Libs/SDL3/x86_64-w64-mingw32
if [ ! -e "SDL3.dll" ]; then
cp ${SDL3}/bin/SDL3.dll .
fi
cc -I${SDL3}/include -L${SDL3}/bin -o ${EXE} main.c -lSDL3