Skip to content

Instantly share code, notes, and snippets.

View amirrajan's full-sized avatar
💭
Working on DragonRuby Game Toolkit and RubyMotion

Amir Rajan amirrajan

💭
Working on DragonRuby Game Toolkit and RubyMotion
View GitHub Profile
@amirrajan
amirrajan / main.rb
Last active September 27, 2026 22:01
DragonRuby Game Toolkit - Multi-orientation, multi-platform, iPhone Duo (https://youtu.be/dXcsey7Pzmo)
# game concept from: https://youtu.be/Tz-AinJGDIM
# Color pallete for game
RED = { r: 222, g: 63, b: 66 }
GRAY = { r: 128, g: 128, b: 128 }
BLACK = { r: 0, g: 0, b: 0 }
LIGHT_GRAY = { r: 237, g: 237, b: 237 }
module Main
def start
@amirrajan
amirrajan / camera.rb
Created September 25, 2026 06:53
DragonRuby Game Toolkit - Live in-game map editor with AABB collision and camera. (https://youtu.be/N71tnzHuNq4)
class Camera
class << self
def viewport_w
Grid.allscreen_w
end
def viewport_h
Grid.allscreen_h
end
@amirrajan
amirrajan / go.sh
Last active September 23, 2026 16:48
java build benchmark thingy
#!/usr/bin/env bash
# git clone https://gist.github.com/amirrajan/0732e675346fca3ab4e7f19c01ad8806 benchmark-java-build && cd ./benchmark-java-build && sh ./go.sh
# Clone Kafka 4.0.2, fetch the benchmark script, and run it.
set -eu
git clone --depth 1 --branch 4.0.2 https://github.com/apache/kafka.git
cd kafka
@amirrajan
amirrajan / main.rb
Created September 22, 2026 04:37
DragonRuby Game Toolkit - Animation States Advanced
module Main
def start
@game = Game.new
end
def tick
@game.inputs = inputs
@game.tick
outputs.background_color = [30, 30, 30]
outputs.primitives << @game.primitives
@amirrajan
amirrajan / main.rb
Created September 13, 2026 21:01
DragonRuby Game Toolkit 7.0 - Many to Many Collisions (https://youtu.be/V7OXlAl1U3E)
# main entry point for the game
module Main
def start
# initialize the game and create 100 random squares
@squares = create_random_squares
end
def create_random_squares
# function creates 100 random squares
# that are within the bounds of the screen
@amirrajan
amirrajan / main.rb
Last active September 12, 2026 07:46
DragonRuby Game Toolkit - Water Ripples (https://youtu.be/NlAjjOEWPiM)
# https://www.youtube.com/watch?v=8rCRsOLiO7k
require "shaders/ripples.fragment.hlsl"
module Main
def start
@ripple_queue = []
end
def tick
@amirrajan
amirrajan / game.rb
Last active September 8, 2026 03:41
DragonRuby Game Toolkit - The Keeper + Shaders (https://youtu.be/Y7Oc2V5fDUc)
class Game
attr_gtk
attr :queues
def initialize
@keeper = {
max_speed: 3,
acceleration: 0.1,
x: 659,
@amirrajan
amirrajan / leaves.fragment.hlsl
Last active September 5, 2026 06:04
DragonRuby Game Toolkit - Rustling leaves via shaders (https://youtu.be/zxmUJXgA57A?si=nbFPZG9a-L5mQr7M)
// this is the main scene (args.outputs)
Texture2D tex_scene : register(t0, space2);
// this is the render target that represents the wind displacement map (args.outputs[:wind])
Texture2D tex_wind : register(t1, space2);
// sampler for the main scene texture
SamplerState sam_scene : register(s0, space2);
// sampler for the wind displacement texture
Texture2D scene : register(t0, space2);
Texture2D displacement_map : register(t1, space2);
SamplerState sampler0 : register(s0, space2);
SamplerState sampler1 : register(s1, space2);
struct Input {
float4 tex_color : COLOR0;
float2 tex_coord : TEXCOORD0;
};
@amirrajan
amirrajan / kitten.md
Created August 27, 2026 16:46
Kitten from Kitten Fetch Quest on a Keyboard