Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

DragonRuby Game Toolkit

An intuitive 2D game engine. Fast, xplat, tiny, hot loaded. · By DragonRuby

Can I `require` ruby files?

A topic by Yoren created Apr 20, 2019 Views: 585 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?

$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")


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...


That’s is the plan yes 👍