Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Console window closes too soon... debugging
- - By kaBOOM Date 2010-12-07 01:13
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.
Parent - - By RunnerPack Date 2010-12-07 03:31
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/
Parent - - By jlnr (dev) Date 2010-12-07 06:43

> but I can't recommend any


As an example, SciTE provides the error output. I am sure there are prettier editors though.
Parent - By RunnerPack Date 2010-12-07 20:45 Edited 2010-12-08 04:59
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...
Parent - By jlnr (dev) Date 2010-12-07 06:44
You're welcome ;) Now I feel like I should push out an update again…
Parent - - By Basic Date 2010-12-07 12:23
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.

Window.new.show
result = gets
Parent - - By jlnr (dev) Date 2010-12-07 12:29
Good idea. It will not be enough in the presence of exceptions, you'd need:


begin
  MyWindow.new.show
rescue Exception => e
  puts e
  gets
end
Parent - - By Spooner Date 2010-12-10 23:39
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*
Parent - By lol_o2 Date 2010-12-11 08:40
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.
Up Topic Gosu / Gosu Exchange / Console window closes too soon... debugging

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill