This project aims to provide great development experience in RubyMine for DragonRuby Game Toolkit.
- RBS type definitions for DragonRuby
- Ruby shims, with documentation
- Helpers to avoid some of the shortcoming of RBS support in RubyMine around hashes
If this works in other editors/IDE, this is purely coincidental, but very nice!
Important: consider this project experimental (and containing bugs) until it will be battle tested in real life.
![]() |
![]() |
![]() |
![]() |
Add types as a Git submodule somewhere to your project files:
git submodule add https://github.com/FylmTM/dr-types.git dr-typesRubyMine should automatically pick up types.
Important #1: Do not add submodule to mygame/ directory, otherwise this will lead to types being included in final build.
Important #2: Make sure to mark docs and samples from DragonRuby as excluded sources in RubyMine.
Otherwise, source that is shipped with DragonRuby itself will conflict with Ruby shims in this project.
Update:
git submodule update --remote dr-typesAdd @param args [GTK::Args] YARD annotation to your top-level lifecycle functions.
# @param args [GTK::Args]
def tick(args) end
# @param args [GTK::Args]
def boot(args) end
# @param args [GTK::Args]
def reset(args) end
# @param args [GTK::Args]
def shutdown(args) endWant to get types for your object in state?
Create mygame/app/state.rb
module GTK
module State
# @return [Player]
attr_accessor :player
end
end
class Player
# @return [Integer]
attr_accessor :x
# @return [Integer]
attr_accessor :y
end
Want IDE assist when creating objects for args.outputs.*? You can use helpers.
Copy dr-types/helpers directory into your game folder, e.g. mygame/lib/helpers.
require "lib/helpers/helpers.rb"
args.outputs.solids << GTK.solid(x: 100, y: 100, w: 100, h: 100, r: 255, g: 0, b: 0)
args.outputs.labels << GTK.label(x: 50, y: 50, text: "Hello, world!")
args.outputs.borders << GTK.border(x: 150, y: 150, w: 20, h: 20, r: 0, g: 255, b: 0)
args.outputs.lines << GTK.line(x: 150, y: 150, x2: 300, y2: 300, r: 0, g: 0, b: 255)
args.outputs.sprites << GTK.sprite(x: 250, y: 250, w: 100, h: 100, path: "dragonruby.png")
args.outputs.sprites << GTK.sprite_triangle(x: 20, y: 20, x2: 60, y2: 20, x3: 40, y3: 60, path: "dragonruby.png")
args.outputs.debug << GTK.solid_primitive(x: 400, y: 400, w: 100, h: 100, r: 255, g: 0, b: 0)
args.outputs.debug << GTK.border_primitive(x: 600, y: 600, w: 100, h: 100, r: 255, g: 0, b: 0)
args.audio[:note] = GTK.sound(input: "sounds/A3.wav", x: 1, y: 1, z: 1)Creation process looked roughly like this:
- Initial stubs were generated with
rbs prototypefromdocs/oss - Then they were heavily processed by LLM (Claude 3.7), to do a first pass (cross-referencing docs & code)
- Then they were heavily manually tweaked by me, to make types sensible
- Then I went through documentation fully, making sure that nothing is missing
- Then LLM was used to generate Ruby shims from RBS types
- Then LLM was used to add YARD documentation to generated Ruby shims
- And one final review of generated Ruby code & documentation.
- Write helpers to help with workflow
Types here might have functionality that is not documented explicitly, but was rather deduced based on OSS code & samples.
Thanks to owenbutler/dragonruby-yard-doc for giving me hope.
- Improve: Outputs::[] (render targets)
- Improve: Outputs::screenshots
- Improve: Outputs::shaders
- Support: Layout::rect_group
- Support: Layout::point
- Support: macro - attr_sprite
- Support: macro - attr_gtk



