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 / ios_wizard.rb
Created May 31, 2026 10:55
DragonRuby Game Toolkit - iOS Wizard
# coding: utf-8
# Copyright 2019 DragonRuby LLC
# MIT License
# ios_wizard.rb has been released under MIT (*only this file*).
# Contributors outside of DragonRuby who also hold Copyright: Michał Dudziński
class IOSWizard < Wizard
def help
puts <<~S
@amirrajan
amirrajan / 00_result.md
Last active May 30, 2026 22:24
DT (Delta Time) Quiz

End result if done correctly:

D491FC6E-A5EB-4C5F-9AE9-EAADCCA7F984.MP4
class AudioHash < Hash
alias_method :__original_indexor_set__, :[]= if !AudioHash.instance_methods.include?(:__original_indexor_set__)
def volume
@volume ||= if $gtk.platform?(:ios)
0.4
else
1.0
end
# do not mute if tick_count is 0
@amirrajan
amirrajan / assets.md
Last active May 18, 2026 01:40
DragonRuby Game Toolkit - Hot-loaded shaders while retaining game state. (https://youtu.be/pc7Jj6c9pNs)
water-displacement water
@amirrajan
amirrajan / quote.md
Last active May 7, 2026 16:51
Why I don't use Unity

I don't use Unity. Developing games that target multiple platforms is unsustainable using this game engine. Especially so for studios/indies that lack the means to "just throw money at a problem".

Amir Rajan,

@amirrajan
amirrajan / main.rb
Last active May 11, 2026 06:09
DragonRuby Game Toolkit - Element Simulation (https://youtu.be/Ewb-YvqAtOE)
class Element
attr :x_ordinal, :y_ordinal
def initialize x_ordinal, y_ordinal, grain_size, r, g, b
@x_ordinal = x_ordinal
@y_ordinal = y_ordinal
@grain_size = grain_size
@x = x_ordinal * grain_size
@y = y_ordinal * grain_size
@w = grain_size
@amirrajan
amirrajan / main.rb
Created April 24, 2026 18:37
DragonRuby Game Toolkit - Grid aligned movement
class Game
attr_dr
def initialize
@cells = 32.flat_map do |x_ordinal|
18.map do |y_ordinal|
{
**Geometry.rect(x: x_ordinal * 40, y: y_ordinal * 40, w: 40, h: 40),
x_ordinal: x_ordinal,
y_ordinal: y_ordinal,
@amirrajan
amirrajan / main.rb
Created April 23, 2026 16:04
DragonRuby Game Toolkit vs Bevy sample app
class Game
attr_dr
def initialize
@player = { x: 640 - 50,
y: 360 - 50,
w: 100,
h: 100,
path: "sprites/square/blue.png" }
@boundary_left = 300
@amirrajan
amirrajan / main.rb
Created April 19, 2026 18:17
DragonRuby Game Toolkit - Reference implementation WIP
class Camera
attr :origin,
:viewport_w,
:viewport_h,
:viewport_offset_x,
:viewport_offset_y,
:scale,
:x,
:y,
:target_scale,
@amirrajan
amirrajan / index.html
Created March 29, 2026 00:40
DragonRuby Fiddle Tutorial Format
<html>
<head>
<title>DragonRuby - Warp Drive Tutorial</title>
</head>
<body>
<h1>DragonRuby Game Toolkit - Warp Drive Tutorial</h1>
<div itemscope="itemscope" itemtype="tutorial-step" data-step-number="1">
<div itemscope="itemscope" itemtype="tutorial-text">
<h1>Traveling at Light Speed</h1>