As part of my simple Ruby 2D game development framework, my game objects have position (x and y values) and size (width and height).
class MyGameObject attr_accessor :x attr_accessor :y attr_accessor :width attr_accessor :height ...
Another approach I've seen was treating the position as a
Point structure, and the size as a
Point = Struct.new(:x, :y) Size = Struct.new(:width,:height) class MyGameObject attr_accessor :position # Point instance attr_accessor :size # Size instance ...
Some frameworks use the former (I think GDX, Gosu...). Others use the latter (cocos2d-iphone). The problem is, it isn't entirely clear to me the advantages and disadvantages of both behaviors (in game development) - I don't know why some frameworks chose one and not the other.
Are there significant differences I should consider?