Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / hotswapping code with pry
- - By ajtmccann Date 2016-04-01 05:21
Hello, I was wondering, what is the correct way to achieve hotswapping of code using the current versions of gosu and pry?  It's something I can't seem to achieve, exactly, going by the original description of the process. 

What happens is, my game window hangs when I enter 'load filename.rb' after making and saving some changes (in an external text editor).  If I use the 'edit filename.rb' command from within pry, upon saving my changes a brand new game window is initialized. in which the changes are reflected, but in which the key press that triggers binding.pry no longer functions.  Closing that window reopens pry, and when I then enter 'continue', the original game window reopens in the state it was left, with the changes correctly reflected, and binding.pry again triggerable.   

Any help would be appreciated.
Parent - By jlnr (dev) Date 2016-04-01 22:53
It sounds as if you should avoid calling SomeWindow.new.show in your .rb file, and instead you should find a way to patch the currently running window. I don't have much experience with pry, though.

I've recently used flgr's "again" gem for live code reloading and it worked quite well:

https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1219

This is the git repo - it says it's a RubyMotion game, but it also works in plain Ruby:

https://github.com/jlnr/monstris

(Now if I could only find the time to finish the actual game...)
Up Topic Gosu / Gosu Exchange / hotswapping code with pry

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill