On 11/18/05, Nathanael D. Noblet <[EMAIL PROTECTED]> wrote:
On Thu, 2005-11-17 at 19:44 -0800, Nathanael D. Noblet wrote:
> Hello,
>    I have a program that is using a mouse right now, but will use a
> touch screen as soon as it arrives. Setting up the event buffer goes as
> so.
>
> dfb->CreateInputEventBuffer(dfb,DICAPS_ALL,DFB_FALSE,&buffer);
>
> The event loop is:
> while(!quit)
> {
>     buffer->WaitForEvent(buffer);
>     while ( buffer->GetEvent(buffer, DFB_EVENT(&event)) == DFB_OK)
>     {
>       if(event.type == DIET_BUTTONPRESS)
>               printf("button pressed");
>       ...
>     }
> }
>
> Originally I had an input device for keyboard and mouse. When the event
> was triggered I would call mouse->GetXY(mouse,&x,&y);
>
> Well now I don't have a mouse object to call that on. How do I go about
> getting that from the event?

So this is what I did... However my x/y coordinates are very odd.

IDirectFBInputDevice *device = NULL;
int x=0;
int y=0;
...

//in the while loop
if(event.type == DIET_BUTTONPRESS)
{
    if(device==NULL)
        DFBCHECK(dfb->GetInputDevice(dfb,event.device_id ,&device));

    DFBCHECK(device->GetXY(device,&x,&y));
    printf("Pressed at X:%d Y:%d\n");
}

if(event.type == DIET_AXISMOTION)
{
    if(device==NULL)
        DFBCHECK(dfb->GetInputDevice(dfb, event.device_id,&device));

    DFBCHECK(device->GetXY(device,&x,&y));
    printf("Moved to X:%d Y:%d\n");
}

The output always always outputs x:-1077470988 y:-1077470992

Any ideas?

What does event.input.axisabs/axisrel return? That might help.
You need to check for the axis(event.input.axis) to know which axis it is.

--
Nathanael D. Noblet
Gnat Solutions
http://www.gnat.ca/
T 250.385.4613
C 250.893.4613


_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

-- Sourath
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to