First, I would like to express how grateful I am to the creators of GOSU. This thing is SO good; so flexible, and in RUBY!! I manage to translate 10 of RMXP's classes, like in 2 in gosu. Just awesome. But still I got some issues... The biggest one being the that the console window closes too soon before I can read what went wrong with the code. Is there a way to stop this? Is there an alternative for debugging?
Also, is there a way to use the 'get_pixel' 'set_pixel' functions in the ruby version?
Thanks in advance.
For debugging, you can either keep a console window open from which to run your game and catch the messages, or use a programmer's editor/IDE that can run a program and capture the console output. There are probably other debugging tools out there, but I can't recommend any, since I just use Ruby's built-in error catching, for the most part.
For manipulating pixels, you need to get banister's excellent "TexPlay" add-on: gem install texplay
Documentation here: http://banisterfiend.wordpress.com/2008/08/23/texplay-an-image-manipulation-tool-for-ruby-and-gosu/
> but I can't recommend any
As an example, SciTE provides the error output. I am sure there are prettier editors though.
I was referring to Ruby-specific debugging solutions, such as gems or other libraries that log debug info, allow "break-points," etc.
I know about lots of text editors and IDEs with stdout/stderr capturing: Notepad++, Programmer's Notepad, Eclipse, etc. My personal favorite is UltraEdit, but I didn't suggest it because it's commercial.
EDIT: I just stumbled on this: http://eightbitraptor.com/posts/debugging-ruby
I still haven't used it, just passing it on...
You're welcome ;) Now I feel like I should push out an update again…
I assume this is on Windows? What I do in C++ when I want the console window to stay open is to have it expect a value to be entered.
You could try under Window.new.show adding a gets statement.
result = gets
Good idea. It will not be enough in the presence of exceptions, you'd need:
rescue Exception => e
Or just run the game from a DOS command window... ("ruby mygame.rb")
Unfortunately, we are a little screwed for debuggers at the moment, since the ruby-debug(-ide)19 gems don't work at the moment. *cross fingers that he can use ruby-debug-ide19 again before too long in RubyMine IDE*
I have a very small "debugger" for Windows: http://www.mediafire.com/?kfdn3iawmrugeu1
Run it in the same directory as the tested file and type it's name (without ".rb"). Then run the output .bat file. After error, console stops, showing you what's wrong.
The same as "ruby mygame.rb", but with no typing directory, so faster.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill