English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 14 July 2009, 15:30   #1
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 628
(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
Asman is offline  
AdSense AdSense  
Old 14 July 2009, 18:00   #2
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,552
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).
thomas is offline  
Old 14 July 2009, 18:45   #3
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 628
Thank you. Your example (WaitForClick.c ) is perfect for me. Now I understand.
Asman is offline  
Old 14 July 2009, 19:49   #4
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,552
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.
thomas is offline  
Old 16 July 2009, 11:10   #5
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 628
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 .
Asman is offline  
AdSense AdSense  
 


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 53 26 November 2017 23:44
Need an ASM manual VoltureX Coders. General 2 17 November 2011 16:24
K13 asm example of gameport.device and keyboard.device redblade Coders. General 29 20 January 2011 19:32
uaehf.device and HDToolbox: Error 224 reading device description Ebster support.WinUAE 3 16 September 2008 10:24

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:37.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.17534 seconds with 12 queries