Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / why are there no Point/Size classes?
- By bluefly Date 2009-07-27 20:11
I've started using Gosu a few days ago and really like it so far but was wondering why these 2 primitives are missing. The huge function declarations are sometimes tedious to work with.
Was this decision deliberate? If so, why?
- By jlnr (dev) Date 2009-07-27 21:03
It would mean creating a lot more objects on the Ruby side. The not-so-technical overhead of it is that I would have to decide whether the points carry the color and z values with them, as they are always used in conjunction (one OpenGL vertex, so to speak), and whether there should be separate Size and Position classes or just a single Vector2D class, etc. I don't think adding them would be worth the complications. I still try to find time to get rid of the insane argument lists in other ways :)

If you are using the Ruby version of Gosu and Ruby 1.9, you can use argument splats in place of both arguments though, as in draw(*pos, z), where pos is an array of two numbers or any object that returns one in its to_a method. Or you can of course just monkey patch Gosu :)
- By bluefly Date 2009-07-27 21:23
hi, thanks for the quick reply :)

actually I'm using C++ so I wasn't aware of the Ruby complications.
I understand your point of view whether the class should include the color and/or z value when looking at the big picture, but for the future maybe an approach should be decided and just see how it works.
for now l guess I'll continue using my simple Point struct in my classes :)
- By Basic Date 2009-07-28 07:02
I've just made a few functions that I include into the main class now. draw_a_square, draw_a_circle... etc easy enough todo
Up Topic Gosu / Gosu Exchange / why are there no Point/Size classes?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill