Rect has inconsistent method names (0.7.6.6)
bil-bas opened this issue · 3 comments
Rect has somewhat unexpected method names. I can use GameObject#center_x, but have to use Rect#centerx (I know they mean different things in the two contexts, but what I am pointing out is that they are written differently). I assume the reason for this is that Rect is taken from Rubygame, rather than being created for Chingu specifically. Please add method_aliases so I can use methods such as Rect#center_x (which is what I expect to work). I personally don't think that renaming/deprecating, rather than just aliasing the existing methods, is worth the effort.
You're right, it's because it's taken from Rubygame when I Chingu was very young. I've thought a lot on rewriting Rect from scratch with a lot less methods, but my time always ended up beeing spent on other parts of Chingu since Rect is tested code and works pretty well..
I agree with you that one would expect center_x / center_y and I'll add that asap.
Wasn't high priority. Just posting stuff as it occurs to me :)
I didn't like the way Rect inherited from array, when it wasn't really an array as such. Should really wrap an array and have a to_a method. Just a thought if you do get around to re-implementing it. Still, it is a lot better than the Tile class in gglib, which was just horrid :P
I sort of also meant:
topleft, topright
bottomleft, bottomright
midleft, midtop, midright, midbottom
as well as the writers for these and the center methods need changing. As I said, though, low priority. If you mean by "a lot less methods" removing all the abbreviated methods, that is a good idea (euch to #tl as a method name!).
Oh, you can also remove the monkey-patching of Surface since that is a Rubygame specific thing and just confused me in the Chingu rdoc. I'm easily confused.
As I said before, low priority and please feel free to just leave it until you revisit Rect properly if you like. I just over-comment on stuff I'm using to make up for all the people who never give any feedback on my stuff unless I hold a gun to their heads :P