Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / undefined method 'draw_rect'
- - By Mermaja Date 2017-11-23 09:12
Hello.

I am trying to change on my code several calls to draw_quad method  to use draw_rect, as I need only flat colored rectangles, but I get an undefined method error when replacing $window.draw_quad(...) by $window.draw_rect(...). $window is a Gosu::Window and the call to draw_quad worked without problems. Am I doing anything wrong?

I am running gosu-0.12.1-x64-mingw32 on ruby-2.4.2-p198 onWindows 10.

Thank you for your help.
Regards,
Germán Fabregat.
Parent - - By RunnerPack Date 2017-11-24 02:55
Using and passing a Window object around to all of the drawing methods was deprecated a few versions back. Now all of the drawing methods are Gosu class methods and don't require a Window object.

The latest documentation can be found here: http://www.rubydoc.info/github/gosu/gosu/
Parent - By jlnr (dev) Date 2017-11-25 04:39
See also this issue:

https://github.com/gosu/gosu/issues/418

This is exactly what happened, and yet I feel it's pretty confusing. Having to prefix methods with Gosu. does also not really feel like progress. Maybe Window subclasses (and others of course) could generally get around this by using include Gosu? I'll need to play around with this for a bit.
Parent - By Mermaja Date 2017-12-04 08:31
Thank you very much for your comment, I am taking it into account in my project.

Regards,
Germán.
Up Topic Gosu / Gosu Exchange / undefined method 'draw_rect'

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill