Bennu Game Development

English Forums => Helpdesk => Topic started by: Jongf7 on December 21, 2009, 02:17:10 PM

Title: Touchscreen input
Post by: Jongf7 on December 21, 2009, 02:17:10 PM
There is a full hd touch screen that I can use, and I would like to make a simple game to make people familiar with using it.
The 'game' so far works perfectly with a normal mouse, but when using the touch screen the mouse pointer doesn't follow my finger.
It seems to 'stick' to the edges of the screen and even there doesn't follow my finger.
In windows the screen works fine.

Any one that has a clue as to how a touch screen differs from a mouse and if there is a workaround for this?
Title: Re: Touchscreen input
Post by: Windgate on December 21, 2009, 08:03:04 PM
I think it is not possible to change the position of the mouse on the way it is done on a touch screen... I can't help you, but maybe Splinter... :(
Title: Re: Touchscreen input
Post by: Drumpi on December 22, 2009, 02:26:51 AM
Thats is because touchscreen is not a mouse. It act like a mouse, but uses different drivers and can do something different.
I have a wacom tablet (a touch tablet with a pencil) an i tried to use it as a mouse, but if I put the pen in, the cursor don't point, it act like a analog joystick: if i put the pen in the center, muse dont move, if i touch a little bit up, the mouse moves slowly up, if i touch far up, cursor moves up faster... until i stop touch.

Maybe it works similar, maybe it works good, or maybe it don't works, so you need to write your own module in this case. Just ask to SDL.
Title: Re: Touchscreen input
Post by: SplinterGU on December 22, 2009, 02:02:11 PM
BennuGD (SDL) only support touchscreen mouse's compatible.

maybe you need create a new bennugd handler (module) for manage it.
Title: Re: Touchscreen input
Post by: Jongf7 on December 23, 2009, 08:18:14 AM
I'm going to try what happens when I control the screen as a joystick, if that doesn't work I will have to put this project on hold as I cannot program DLL files :)
I only know DIV/Fenix/Bennu.

But I'm glad I tried to create something for the screen as it led me to this community, you guys are all very helpful, so I'm really eager to start programming again now :) I even have some ideas for the contest already. Not to win, but just for the fun :)
Title: Re: Touchscreen input
Post by: josebita on December 24, 2009, 01:32:34 AM
If you have ideas for the contest... hurry up! there's not much time left :)
Title: Re: Touchscreen input
Post by: Jongf7 on December 25, 2009, 07:08:07 AM
I already started working :)
I will email SplinterGU to get a place to post a worklog and some screenshots soon.

I try to make a race game with a rare graphical style.
Title: Re: Touchscreen input
Post by: quasist on December 31, 2009, 08:48:31 PM
Is bennu on GP2X WIZ is also is unable to read touchscreen? If it can then please post some code :)
Title: Re: Touchscreen input
Post by: josebita on January 01, 2010, 04:21:19 PM
Bennu in the Wiz can also read the touchscreen, yes.

For what I know, to detect the touchscreen input, you just have to wait for mouse.left and then get the mouse.x & mouse.y vars to read the place where the user clicked.
This would be something like:
[code language="bennu"]
Process touchscreen_test()
Private
   int was_clicked=0;

Begin
   LOOP
        // It's usual to detect clicks when the user releases the mouse button, not when they click it
       if( (was_clicked==1) && (! mouse.left))
           say("Touchscreen event @ x:"+mouse.x+" y:"+mouse.y);
       end;

       was_clicked = mouse.left;
       FRAME
   End;
End;
[/code]