Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

DragonRuby Game Toolkit

An intuitive 2D game engine. Fast, cross-platform, tiny, hot loaded. 路 By DragonRuby

Can I `require` ruby files?

A topic by Yoren created Apr 20, 2019 Views: 1,545 Replies: 4
Viewing posts 1 to 3

None of the samples seem to use `require` to split up code over multiple files. Trying myself I get an error

# ERROR: The following hash reached a nil thrashing limit.

# # Here are the details:
# # {:__thrash_count__=>{:join=>6}, :files_reloaded=>["app/main.rb"], :reloaded_files=>["app/main.rb"], :paused=>false, :framerate=>0, :framerate_at=>0, :toast_message=>false, :toast_debounce=>0, :repl_text_color=>[100, 100, 100], :repl_text_font=>nil, :show_gridlines=>false, :gridline_color=>[200, 200, 200], :gridline_label_color=>[0, 0, 0], :gridline_spacing_x=>20, :gridline_spacing_y=>20, :gridline_label_spacing_x=>20, :gridline_label_spacing_y=>20, :time_per_tick=>16}
# # member: [join]
# attribute: [time_per_tick].

Is there a way to `require` ruby files yet?
Developer(+4)

$dragon.require('app/whatever.rb') works, but we'll probably figure out a better thing later (even if we just end up going with a standard "require")

(+3)

Like in RubyMotion I would prefer if all .rb files in the app/ folder and its subfolders were included automatically.

If this type of auto-require is added, I hope it's opt-in. For some apps, require order matters and it's a real pain to debug...

Developer

That鈥檚 is the plan yes 馃憤