14 July 2009, 14:30 | #1 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
(ASM, C ) input.device
I'm looking for docs, examples for input.device.
I read RKM Devices and saw example ) but I still don't understand what should I do when I added input handler. any ideas, examples docs are welcome |
14 July 2009, 17:00 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
The question is what you want to do. An input handler is called whenever input events arrive. It gets the input event chain as parameter and it can do whatever it wants with it: it can remove events from the chain, it can add events, it can change existing events or it can just browse the chaing doing something else.
For example it can swap the left and right mouse buttons by changing the mouse button events. That's what the RKRM example does IIRC. Here is a similar example which swaps the left and right Amiga keys: http://thomas-rapp.homepage.t-online.../SwapAmiga.lha Here is an example which signals the main program whenever a left mouse button event arrives: http://thomas-rapp.homepage.t-online...WaitForClick.c Edit: just found a bug in the WaitForClick source: it does not close the device if the user pressed Ctrl-C. The (rc == 0) at the end should be (rc <= RETURN_WARN). |
14 July 2009, 17:45 | #3 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
Thank you. Your example (WaitForClick.c ) is perfect for me. Now I understand.
|
14 July 2009, 18:49 | #4 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
Found another bug:
handler and req need to be initialized to NULL in the beginning because if CreateMsgPort() fails they don't get assigned a value. |
16 July 2009, 10:10 | #5 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
You're right.
Personally I always set pointers to NULL . I think also that would be better if declaration of sigs will be moved into begin of else block, coz you uses sigs only in that block . Of course, it's only proposal . |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ASM: Resources | BippyM | Coders. Tutorials | 64 | 10 April 2024 01:23 |
Need an ASM manual | VoltureX | Coders. General | 2 | 17 November 2011 15:24 |
K13 asm example of gameport.device and keyboard.device | redblade | Coders. General | 29 | 20 January 2011 18:32 |
uaehf.device and HDToolbox: Error 224 reading device description | Ebster | support.WinUAE | 3 | 16 September 2008 09:24 |
|
|