Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / windows touch screen?
- By treetrouble Date 2010-01-04 05:19 Edited 2010-01-04 05:33
Hi,

I'm trying to use one of my Ruby/Gosu apps with a touchscreen running windows 7 and I'm having some problems with mouse click events

button_down?(MsLeft) will only evaluate as true when I'm doing a drag-click and but not when the "mouse pointer" is still

Since Gosu uses DirectInput, I'm guessing this is just something minor in InputWin.cpp.  Any ideas what's going on before I get in to that?

Thank you!
- By jlnr (dev) Date 2010-01-04 05:38
I am not sure... As far as I can tell, I just get events for button 1, 2 and 3 of the mouse. If the touch screen does not send a click without dragging as a left click, then I don't know how to detect it. Maybe the touchscreen's drivers are not suitable for DirectInput?

I guess it DOES work without DirectInput, and using the "usual" WM_CLICK messages. You could check in windowProc (or something like that) in WindowWin.cpp if you still get those, even though I subscribe to DirectInput data. If so, you could cheat for a start and just call input().onButtonDown(msLeft) in that case. ;)
- By treetrouble Date 2010-01-04 05:51
Yeah, I think I incorrectly assumed that microsoft designed their touch screen api to use DirectInput...I'll look in to it.  Thank you!
- By jlnr (dev) Date 2010-01-04 05:56
They apparently do...a bit...because dragging works? :)
- By treetrouble Date 2010-01-04 06:18
Yeah, that's true... the mouse button 0 (case DIMOFS_BUTTON0:) block in InputWin.cpp... that's actually being called on a regular left click and works fine with the touch screen.  The problem is somewhere after that.  I'll keep debugging tomorrow.  Thanks again for your help
- By treetrouble Date 2010-01-05 02:52
Everything in c++ gosu is working fine with the touch screen.  I've moved on to the Ruby extension.  In the generated file RubyGosu_wrap.cxx, I added debug statements to this method

SWIGINTERN VALUE_wrap_Window_button_down(int argc, VALUE *argv, VALUE self)

and it's working fine as well

So it's going awry somewhere between there and the calls to button_down? in Ruby...

any guesses? unfortunately, i have almost no knowledge of SWIG.  anyway, i'll keep looking but if you happen to see this post ( and are really bored :) ), where would you look next?

Thank you again
- By jlnr (dev) Date 2010-01-05 04:08
Just to make sure, you are not confusing button_down and button_down?, are you? :) How are you detecting the clicks?

If you use button_down? to check for them, then it might be that the touch screen indeed sends a click, but immediately afterwards releases it. That would make button_down? always return false, but it would still trigger a button_down callback.
- By treetrouble Date 2010-01-05 04:54
yep, that's it. 

the touch screen seems to do a button_up automatically like you said except when drag clicked, even if the finger/pen is held down in place.

thanks again for bearing with me.
- By jlnr (dev) Date 2010-01-05 09:02
Bearing with you? ;) I have never seen Gosu in action with a touchscreen, even though I heard at least a couple of people are doing it. Please document whatever gadget you're building :)
- By treetrouble Date 2010-01-05 16:36
Yeah, for sure. (It's pretty cool). :)  Also, it's in my plans to add Windows 7 multitouch support to Gosu although there are more essential features that I need to work on first.
- By jlnr (dev) Date 2010-01-06 14:47
Gosu already supports multi-touch on the iPhone via the very Apple-esque touchesBegan, touchesMoved, touchesEnded events- if that interface matches your needs, that would be very convenient. :)
- By treetrouble Date 2010-01-16 20:43
yeah, I'll aim to use that as a template
Up Topic Gosu / Gosu Exchange / windows touch screen?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill