Package and send events with C code

Questions and information about Crank Software's Storyboard Engine

Moderator: jamiev

Package and send events with C code

Postby cguthrie » Wed Oct 05, 2011 10:45 am

Hi All,

I'm trying to simulate a press event from C code and I was curious, how do I package the x,y coordinates so that the UI receives it as a press event.

Thanks,
cguthrie
cguthrie
 
Posts: 24
Joined: Thu Jun 30, 2011 7:27 pm

Re: Package and send events with C code

Postby brian » Thu Oct 06, 2011 1:41 pm

Hi,

You can do something like this to build and send an event:

gr_event_t event;
gr_ptr_event_t ptr_event;

memset(&event, 0, sizeof(event));
memset(&ptr_event, 0, sizeof(ptr_event));

ptr_event.x = x;
ptr_event.y = y;
ptr_event.z = 0;
ptr_event.button = GR_EVENT_BTN_LEFT;

event.format = (char *)GR_EVENT_PTR_FMT;
if (down) {
event.name = (char *)GR_EVENT_PRESS;
} else if (up) {
event.name = (char *)GR_EVENT_RELEASE;
} else {
event.name = (char *)GR_EVENT_MOTION;
}

gre_io_serialize(buffer, NULL,
event.name, event.format,
&ptr_event, sizeof(ptr_event);
gre_io_send(handle, buffer);
User avatar
brian
 
Posts: 53
Joined: Mon Nov 02, 2009 10:29 pm
Location: Ottawa

Re: Package and send events with C code

Postby salehirp » Sat Oct 08, 2011 3:03 pm

I can not seem to find the .h file that contains the definition for gr_event_t in the QNX target environment! Can you please tell me where gr_event_t is defined?

Thanks.
salehirp
 
Posts: 1
Joined: Sat Oct 08, 2011 2:42 pm

Re: Package and send events with C code

Postby jason » Sat Oct 08, 2011 4:03 pm

All the headers are located with the Storyboard Engine files under the install root. So with 1.3 it will be in this location

[install directory]/Crank_Software/Storyboard_Engine/1.3.0.201109262142/qnx-6.4-x86-sdl-obj/include/gre
User avatar
jason
 
Posts: 148
Joined: Mon Nov 02, 2009 4:53 pm


Return to Storyboard Engine

Who is online

Users browsing this forum: No registered users and 1 guest