Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Changing the way Font class works in Ruby
- - By kyonides Date 2017-06-27 04:52
Could it be possible to include stuff like setters and getters for stuff like Font color and scale_x and scale_y by default? I think it is easier for the game developer to just change those attributes by calling a getter to update them accordingly, then the draw method could take care of the vital stuff like x and y coordinates as usual by not needing to add the values mentioned above or those three could become optional parameters or arguments there... Or a new draw method overload could be added there... Hope you find the idea interesting and useful as I do.
Parent - By jlnr (dev) Date 2017-07-21 21:29
I don't want to add setters. I'm glad most objects in Gosu are immutable, it avoids a whole class of problems when people forget to reset a property after setting it to a temporary value, etc.

I do agree that the .draw methods (not just for Font) are extremely cumbersome. I still haven't looked into the new named arguments in Ruby 2.2+, maybe they can actually solve this nicely?

However, in the case you've mentioned (Font#draw), the three parameters are actually optional: http://www.rubydoc.info/github/gosu/gosu/Gosu/Font#draw-instance_method
Up Topic Gosu / Gosu Exchange / Changing the way Font class works in Ruby

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill