Skip to content

Instantly share code, notes, and snippets.

@Lightnet
Lightnet / sample_input.zig
Last active June 26, 2026 18:33
Fake Terminal Input Zig 0.16.0 SDL 3
const std = @import("std");
const zsdl3 = @import("zsdl3"); // https://github.com/felixuxx/zsdl3
pub const TerminalInput = struct {
buffer: std.ArrayList(u8) = .empty,
history: std.ArrayList([]const u8) = .empty,
cursor_pos: usize = 0, // tracks byte index offset from the START
pub fn init() TerminalInput {
return .{};
@Lightnet
Lightnet / database_struct.zig
Created June 25, 2026 05:39
sample database struct AI base model test.
// zig 0.16.0
const std = @import("std");
pub const User = struct {
id: u32,
name: []const u8,
date: []const u8,
};
@Lightnet
Lightnet / sample_thread01.zig
Created June 25, 2026 03:00
sample raylib thread
//
// do not use gpu in thread
// zig 0.16.0
// https://github.com/raylib-zig/raylib-zig.git
const std = @import("std");
const rl = @import("raylib");
const SharedData = struct {
mutex: std.Io.Mutex = .init,
@Lightnet
Lightnet / sample_plane_text02.zig
Created June 23, 2026 00:31
Text 3d render using rlgl raylib. zig.
// working
const rl = @import("raylib");
// https://github.com/raylib-zig/raylib-zig
const rlgl = rl.gl; // raylib rlgl
pub fn main() anyerror!void {
// Initialization
const screen_width = 800;
const screen_height = 450;
@Lightnet
Lightnet / sample_transparent_window.zig
Last active June 22, 2026 05:40
sample transparent window image test
// zig 0.16.0
const rl = @import("raylib"); // https://github.com/raylib-zig/raylib-zig
const std = @import("std");
pub fn main() !void {
// Set configuration flags BEFORE initializing the window
rl.setConfigFlags(.{
.window_undecorated = true,
.window_transparent = true,
@Lightnet
Lightnet / README.md
Last active June 19, 2026 06:52
Zig SDL 3 TTF fake window test sample.

Information:

Prebuild files for sdl3.dll. Use SDL3-devel-3.4.10-mingw.tar.gz

Project Folder:

- src
 - main.zig
- build.zig
@Lightnet
Lightnet / README.md
Last active April 19, 2026 06:57
spacetimedb batch into single build typescript.
// reducer: scheduleReminder
// table: person
// view: my_player

// lifecycle: init
export const init = spacetimedb.init(_ctx => {
  console.log("====::: INIT SPACETIMEDB :::====");
});
@Lightnet
Lightnet / transform.js
Created April 6, 2026 02:21
sample transform 3d hierarchy matrix4.
// transform 3d hierarchy matrix4
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
// import { TransformControls } from 'three/addons/controls/TransformControls.js';
import { ViewportGizmo } from "three-viewport-gizmo";
import van from "vanjs-core";
import { Pane } from 'https://cdn.jsdelivr.net/npm/tweakpane@4.0.5/dist/tweakpane.min.js';
import { label } from 'three/tsl';
@Lightnet
Lightnet / three_transform.js
Created April 5, 2026 21:39
sample editor test transform matrix.
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
// import { TransformControls } from 'three/addons/controls/TransformControls.js';
import { ViewportGizmo } from "three-viewport-gizmo";
import van from "vanjs-core";
import { Pane } from 'https://cdn.jsdelivr.net/npm/tweakpane@4.0.5/dist/tweakpane.min.js';
import { label } from 'three/tsl';
function degreeToRadians(degrees) {
@Lightnet
Lightnet / threesql.js
Created March 25, 2026 19:35
simple collision box and sphere 3d with sql javascript test
// sqlite wasm
// <script type="importmap">
// {
// "imports":{
// "three":"https://cdn.jsdelivr.net/npm/three@0.183.2/+esm"
// }
// }
// </script>
import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.183.2/+esm';