Anyway, I'm not going to add two functions just to suit your needs Wink
Wouldn't expect you to this is why its not a feature request.
I'm using lua and tolua++
What I'm wanting to achieve is something like:
if mySprite.x < 200 then
Or whatever, with the SetX() method you can do assignment (and map the property to the SetX() method so that works).
mySprite.x = 200
But with no GetX method then I can't read the x position without using:
if mySprite:GetPosition().x < 200 then
The problem is more the symmetry of it I guess. And one of the reasons for adding a scripting layer is to be able to access SFML and my engine specific code with a simplified syntax. Get a vector if I want a vector, get a single axis if I only want a single axis. sf::Drawable already has this to some extent (SetPosition, SetScale takes a vector or two floats, and there are SetX and SetY, SetScaleX and SetScaleY methods). But stops short for some reason (no GetX or GetY, no GetScaleX or GetScaleY methods).
I'm sure there is a good reason for it, everything in SFML is clear, concise and well thought out, however I'd like those accessor functions.
I can of course hand code some helper functions at the binding level to make the position directly readable but was wondering if there is a way to 'hook' into a class at that level and add methods...
Maybe its more a C++ archeture questions than a SFML specific question.
Or maybe its too early on a Saturday for me :roll:
NOTE - After writing all of this I realised could bind it so that we have:
mySprite.position.x
for getting and setting using the existing methods and that would actually suit me fine. I'd still be curious for an approach to add methods to a base class (its probably not possible) but I can work with how things are for now.