Hi Iarwain / lydesik ,
I'm converting my mouse inputs to touch events all is working well with the touch begin, end and move events.
But I am trying to get the touch position from the orxSYSTEM_EVENT_PAYLOAD payload.
It appears on svn that the properties of fX and fY are not known. Codelite's code completion recognises them ok.
My code is:
if (_pstEvent->eType == orxEVENT_TYPE_SYSTEM){
orxSYSTEM_EVENT_PAYLOAD *payload;
payload = (orxSYSTEM_EVENT_PAYLOAD *) _pstEvent->pstPayload;
orxLOG("Location %f x %f", payload.fX, payload.fY);
I realise acksys has a similar problem here:
https://forum.orx-project.org/discussion/4432#Comment_4473 but my code is also sitting under the right conditional.
Codelite says:
error: request for member 'fX' in 'payload', which is of non-class type 'orxSYSTEM_EVENT_PAYLOAD*'
error: request for member 'fY' in 'payload', which is of non-class type 'orxSYSTEM_EVENT_PAYLOAD*'
I am probably doing something very simple to cause the issue but it's late and I'm getting fuzzy
Can I just stick to using getting mouse positions for now? Do these map under Android and iOS?
Comments
According to the docs orxSYSTEM_EVENT_PAYLOAD contains an union: So shouldn't it work as in the thread by acksys:
payload.stTouch.fX instead of payload.fX
and shouldn't you check that this is indeed touch event not accelerometer event which is missing from your example.
I haven't really tried myself so I could be wrong .
Cheers,
Graag
The codelite compile error has to do with me not going through the stTouch property first.
Thanks graag for the bit on the union. So these are not properties unless the payload is of a type system, and is to do with touch.
My working example is now:
Now the interesting thing is that Codelite is code completing the fX property directly under the payload, eg:
payload->fX
... but it will not code complete fX under stTouch.
The compiler will get upset, of course, about payload->fX and not about payload->stTouch.fX.
So I get the impression there is something wrong in the includes that Codelite uses to generate it's tags for this struct.
I noticed you reported a similar thing a couple of times in 2008. Perhaps it's a bug that crept back in.
Haven't been using CodeLite much lately, there's a few things I don't like and I've been focusing on visual studio instead (often using Sublime Text 2 as the main editor and compiling under VS).
I've gone the other way, I'm moving more to CodeLite rather than VS due to it being easier for me to configure etc, and not so heavy. Also can move from OS to OS.
Nice to have the choice.
I'm using Sublime Text 2 on all 3 OSes and will probably use Acksys' work with premake when it's ready to generate makefiles for all platforms and build directly from within it.