Skip to content

Instantly share code, notes, and snippets.

@doccaico
doccaico / app.c
Created November 10, 2026 11:02
Chez Scheme: Create an executable on Windows (ファイル分割: libraryを使うバージョン)
#include "scheme.h"
#include "petite_boot.h"
#include "scheme_boot.h"
#include "math_utils.h"
#include "app_boot.h"
int main(int argc, char *argv[]) {
Sscheme_init(NULL);
@doccaico
doccaico / app.c
Last active November 10, 2026 10:58
Chez Scheme: Create an executable on Windows (単独のファイルを扱うバージョン)
#include "scheme.h"
#include "petite_boot.h"
#include "scheme_boot.h"
#include "app_boot.h"
int main(int argc, char *argv[]) {
Sscheme_init(NULL);
Sregister_boot_file_bytes("petite.boot", (char *)petite_boot, petite_boot_len);
@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.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.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
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