Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Touch Screen Solution MAYBE

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
Touch Screen Solution MAYBE
djdavid
Member #4,839
July 2004

I found on line this:

Quote:

You probably need to write a Win32 mouse driver.

I think the level of Win32 programming required to do so would be minimal, since Allegro already has an event loop.
The bulk of the work would be to devise an Allegro mouse driver that translates Windows mouse events into Allegro mouse datas, and hooks itself in the event loop (src/win/wwnd.c).
Try to start with a simple mouse driver (src/qnx/qmouse.c comes to mind) and integrate it in the Windows port.
Then identify the Windows messages the driver must listen to (WM_MOUSE*) and add hooks in wwnd.c to redirect them to the driver when it is running.

What u think? I'm not english and i did not understand well what i should do?
Someone can help me?

Marco Radaelli
Member #3,028
December 2002
avatar

I thought you were coming out with a solution :)
Are you familiar with Windows API and how it's messaging system works?

[edit] Anyway I ran a small test with my stylus. It moves by squares. Coordinates are read right, but simply, moving by one point on the tablet translates to a move of about 100 pixels (nearly) on screen.

???

djdavid
Member #4,839
July 2004

No, i don't know how work Windows Api :-[

No, non ne so assulutamente niete delle API di windows, in pratica non capisco bene cosa devo fare quando dice questo "Try to start with a simple mouse driver (src/qnx/qmouse.c comes to mind) and integrate it in the Windows port"
Uff

Marco Radaelli
Member #3,028
December 2002
avatar

I have little knowlegde (I read Petzolds' book sometimes) but I do not know if it will help. I also think it is more a matter of DirectX, at least while someone here corrects me :)

I don't know how to do that integration, sorry :-/

Potresti non scrivere in italiano? Per noi sarà anche comodo, ma per loro aiutarti diventerebbe difficile, soprattutto (fastidioso) quando non sanno cosa c'è scritto... Provo la stessa cosa quando vedo un post in tedesco o altre lingue. Ho anch'io difficoltà ad esprimermi a volte, in quei casi cerco di semplificare il discorso e di aiutarmi con un dizionario ;)

djdavid
Member #4,839
July 2004

A new.
I ran the setup.exe in my ...\Dev-Cpp\allegro\setup for see if i could select a different mouse driver for my touch screen. Well i can select only DirectInput Mouse and it doesn't work with the touchscreen, the same problem "when i touch screen pointer jumps from corner to corner".
How i can force another mouse driver?

Marco Radaelli
Member #3,028
December 2002
avatar

I don't know if there's another driver under Windows, I'll have a look at that setup.exe when I'm at home.

Does your pointer really jump from a corner to another or it apperars in a middle position? What happens if after touching the screen you move the (I suppose) stylus?

djdavid
Member #4,839
July 2004

Yes it jump from corner to corner and sometimes in the middle. I don't move the stylus but the finger, if i move it, nothing, mouse pointer is always in upper left position or down left, but never in the middle of the screen, just sometimes GRRRR

A J
Member #3,025
December 2002
avatar

i have a wacom that has 18000 points of res in the x-axis, so it needs to be scaled down to fit within the allegro screen_w
i suspect touch screens might be the same.

can you tell me which touch screens you have ?
and anyone else can tell me any URLs or brands/manufactureres of touch screens, i'd like to get one.

___________________________
The more you talk, the more AJ is right. - ML

djdavid
Member #4,839
July 2004

Ok AJ we hope...
My touch screen is MicroTouch™ ClearTek™ Capacitive Touch Screens.
here there is the link
http://www.3m.com/3MTouchSystems/Products/Capacitive/ClearTek.jhtml
If u want i let u know the Controller Type too

A J
Member #3,025
December 2002
avatar

im actually interested in a touch screen that can tolerate multiply fingers at once.. does your do that ?
or do you know of which ones do ?

___________________________
The more you talk, the more AJ is right. - ML

djdavid
Member #4,839
July 2004

No, mine doesn't do that.
I thinked u had solution for me ;D
but nothing :-[

Specter Phoenix
Member #1,425
July 2001
avatar

You have to be well versed in C/C++ and Windows API in order to make a Win32 driver for anything. I've dabbled with C++ and WinAPI to make drivers and there is just too much to understand in order to make one. On top of understanding C++ and WinAPI you also have to understand the specs and everything about the thing you are needing to program the driver for (memory address for the driver to point to, the specifications of memory so you don't crash you computer, etc.).

Marco Radaelli
Member #3,028
December 2002
avatar

AJ said:

I have a Wacom that has 18000 points of res in the x-axis

Which tablet is that?

Did you had a look here [url http://www.wacomeng.com/devsupport/index.html] ?

spellcaster
Member #1,493
September 2001
avatar

All I had to do in order to make my Wacom work in fullscreen mode was to remove the special fullscreen scaling.
I just recompiled allegro w/o the scaling: Works like a charm since then.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Marco Radaelli
Member #3,028
December 2002
avatar

Sounds interesting... How can I do the same?
And what will be lost removing it (or what does that scaling do)?

spellcaster
Member #1,493
September 2001
avatar

Nothing. As far as I can tell the mouse moves better than ever. I had some strange problems with the mouse moving not that fluidly... which are gone now.

changes:
wmmouse.c, function mouse_dinput_handle_event: delete (or comment) the handlers for DIMOFS_X and DIMOFS_Y

wmmouse.c, function mouse_dinput_handle: There's a part like that:

      if (gfx_driver && gfx_driver->windowed) {
         /* windowed input mode */

                 ...
         }
      }
      else {
         /* fullscreen input mode */
         ...

make the if read:

if (TRUE) { /* windowed input mode */

so that the code used for the windowed mode is used in fullscreen mode also.
recompile allegro (make then make install). Problem gone.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Marco Radaelli
Member #3,028
December 2002
avatar

Uhm... I only have void mouse_directx_poll(). I have Allegro 4.0.3.

I suppose, anyway, that the interested part is this:

1 case DIMOFS_X:
2 if (!gfx_driver || !gfx_driver->windowed) {
3 if (mouse_accel_mult) {
4 if (ABS(data) >= mouse_accel_thr2)
5 data *= (mouse_accel_mult<<1);
6 else if (ABS(data) >= mouse_accel_thr1)
7 data *= mouse_accel_mult;
8 }
9 
10 dinput_x += data;
11 }
12 break;
13 
14 case DIMOFS_Y:
15 if (!gfx_driver || !gfx_driver->windowed) {
16 if (mouse_accel_mult) {
17 if (ABS(data) >= mouse_accel_thr2)
18 data *= (mouse_accel_mult<<1);
19 else if (ABS(data) >= mouse_accel_thr1)
20 data *= mouse_accel_mult;
21 }
22 
23 dinput_y += data;
24 }
25 break;
26 
27 case DIMOFS_Z:
28 if ((dinput_wheel) && (_mouse_on))
29 _mouse_z += data/120;
30 break;

I just comment those cases out in this way?

1/* case DIMOFS_X:
2 if (!gfx_driver || !gfx_driver->windowed) {
3 if (mouse_accel_mult) {
4 if (ABS(data) >= mouse_accel_thr2)
5 data *= (mouse_accel_mult<<1);
6 else if (ABS(data) >= mouse_accel_thr1)
7 data *= mouse_accel_mult;
8 }
9
10 dinput_x += data;
11 }
12 break;
13
14 case DIMOFS_Y:
15 if (!gfx_driver || !gfx_driver->windowed) {
16 if (mouse_accel_mult) {
17 if (ABS(data) >= mouse_accel_thr2)
18 data *= (mouse_accel_mult<<1);
19 else if (ABS(data) >= mouse_accel_thr1)
20 data *= mouse_accel_mult;
21 }
22
23 dinput_y += data;
24 }
25 break;
26*/
27 case DIMOFS_Z:
28 if ((dinput_wheel) && (_mouse_on))
29 _mouse_z += data/120;
30 break;

And this if (gfx_driver && gfx_driver->windowed) {
into this if (TRUE) {

Right?

spellcaster
Member #1,493
September 2001
avatar

Yep.
But you should consider to upgrade to the latest allegro version.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Marco Radaelli
Member #3,028
December 2002
avatar

Thanks I'll try it.
I always used the stable versions... If you suggest the WIP, so it is not so much WIP but it is pretty stable, isn't it? Why doesn't it became a new stable version? Due to the API compatibility?

spellcaster
Member #1,493
September 2001
avatar

No idea.
But yeah, the WIPs are stable enough AFAIAC.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Marco Radaelli
Member #3,028
December 2002
avatar

I did your suggestion and it worked :) Thank you.
Won't be good if you propose that as a change in the Allegro code?

spellcaster
Member #1,493
September 2001
avatar

Well, Evert is aware of this thread, and I'm sure they'll discuss it in the maling list.
My main problem is that I don't know why the scaling code was in there in the first place. On my computer everything works smeoother without it.
On the other hand: there must be a reason if somebody takes the time to code two different ways to handle mouse input.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Evert
Member #794
November 2000
avatar

Quote:

All I had to do in order to make my Wacom work in fullscreen mode was to remove the special fullscreen scaling.

Very cool :D

There was another patch related to mouse scaling in another thread (I think it was teh one where I asked about Allegro's current issues). I'm going to check if these two ideas don't conflict with eachother.

Quote:

Well, Evert is aware of this thread,

Heh. I have several threads with fixes and updates bookmarked. I hope to get round to commiting stuff on sunday.

spellcaster
Member #1,493
September 2001
avatar

If I remember correctly, the other change was to use a float scaling... I'll try that one with my wacom as well... give me a second :)

Edit:
Um... since the mouse code has changed quite a low, it's not that easy to add the changes to the WIP version.

But, from the description of what the code is supposed to do... well, removing the scaling completly had exactly that effect.

--
There are no stupid questions, but there are a lot of inquisitive idiots.

Evert
Member #794
November 2000
avatar

Ok, I'll post that solution on the mailinglist. I'm not really sure what the scaling is supposed to do in this case, but I don't know the Windows port that well...

Quote:

Why doesn't it became a new stable version?

It will. Once enough things have been fixed and improved, Allegro 4.1 WIP will become Allegro 4.2 stable.

 1   2   3 


Go to: