[AD] Windows Addition for Message Parsing |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
WARNING: I don't speak english. I'll try to be as clear as possible, try to bear with me. I'm working on a project where multiple mice input was needed and I found this http://jstookey.com/arcade/rawmouse/ the raw mouse code allows you to detect multiple mice BUT it parses WM_INPUT messages for its implementation. I am using allegro for graphics and sound so I wanted to integrate it with my project. My first approach was creating a window by hand, with a procedure of my own for parsing its messages, then attaching the window to allegro with win_set_window() and controlling the peek-translate-dispatch process in my code. It did work but I had to integrate the game loop somewhere with a sleep for parsing messages. far from ideal. So I modified the allegro library code and introduced a function that allows the user to define a sort of callback. If such a function is defined, allegro calls it as it enters the WindowProc (directx_wnd_proc), then the user defined function gets the chance to parse the messages... if the user-defined function returns 0, then the message it's not parsed by allegro, otherwise it gets further parsed within directx_wnd_proc if needed. That lets me leave the window and message handling to allegro but still being able to parse the WM_INPUT messages when received. I've attached a patch for Allegro 4.22 sources and the information needed for doing the mod "by hand" if patch doesn't work. ++ I would like to know if you find the modification useful and worth to be included in future releases of Allegro. ++ Thanks to trentg, Tomasu, svenVI who supported me on IRC to post this here and also gave me guidelines on how to post it. Feedback is appreciated. S.P.A.M is not. -- Elias Zacarias
Attachment:
win_set_msg_pre_proc.zip
Description: Zip archive
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |