English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 24 September 2011, 22:29   #1
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Reading the mouse...

I have an interesting problem which has been bugging me for a while. I start my demo and as soon as it ends it returns to workbench and *sometimes* restarts.
Originally what I thought was happening was that the mouse click used to exit the demo was being detected by workbench and restarts the demo. Sometimes if the point isn't over anything then nothing happens. Sometimes Devpac does something (like load in raw binary in replacement of my sourcecode!).
However, I have since added an extra screen where the key "1" is currently used to exit the demo and the same things are happening.

Now what I think is happening is that workbench is detecting the mouse left button, used to activate the demo, after the demo exits.
I use the following code to detect for a left button mouse press:

Code:
credits:
    **credits code**
exit4:
    btst    #6,$bfe001
    bne.s    credits            ;LMB pressed?
unpressed4:
    btst    #6,$BFE001
    bls.s    unpressed4        ;LMB unpressed?

Is this the correct way to detect for a mouse press? If I am right about workbench how do I fix the problem?


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 24 September 2011, 23:38   #2
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Personally, when I've done a test for press and release of a mousebutton myself in the past, I've used bne / beq rather than bne / bls but yes - the code you posted waits for a press *and* release of the left mousebutton.
pmc is offline  
Old 24 September 2011, 23:51   #3
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Quote:
Originally Posted by pmc View Post
Personally, when I've done a test for press and release of a mousebutton myself in the past, I've used bne / beq rather than bne / bls but yes - the code you posted waits for a press *and* release of the left mousebutton.
I normally use beq and bne too, but I guess on this occasion I went for something a little out of the box


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 01 October 2011, 20:56   #4
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Hey Lonewolf10

When I read what Leffmann wrote here:

http://eab.abime.net/showpost.php?p=779221&postcount=15

It reminded me of what you described:

Quote:
Originally Posted by Lonewolf10
I have an interesting problem which has been bugging me for a while. I start my demo and as soon as it ends it returns to workbench and *sometimes* restarts.
Originally what I thought was happening was that the mouse click used to exit the demo was being detected by workbench and restarts the demo. Sometimes if the point isn't over anything then nothing happens.
Maybe the solution is to implement the high priority input handler as described by Leffmann to capture stray mouse clicks or keypresses before they reach the Workbench which sounds like what might be happening and causing these random restart issues for you?

Just a thought anyway...

Last edited by pmc; 01 October 2011 at 22:23. Reason: added an n :)
pmc is offline  
Old 01 October 2011, 22:27   #5
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Thanks, I'll look into it.

FYI, it's not just my demo that does that. I'm sure I have encountered a few other demo's that suffer the same problem when started from workbench. Of course, demo's are best started from boot-up anyway


Regards,
Lonewolf10
Lonewolf10 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse mat to lower optical mouse sensitivity? Bamiga2002 support.Hardware 7 22 March 2013 07:35
Magic mouse/virtual mouse driver issues mark_k support.WinUAE 2 04 December 2012 20:43
AMIGA MOUSE == Any 9 PIN Serial Mouse ????? megajetman support.Hardware 15 26 April 2012 13:51
A4000, mouse clicks, no mouse move, no keyboard OverDose support.Hardware 4 16 March 2011 13:25
Amiga mouse moonlighting as Myarc Mouse thinlega Nostalgia & memories 1 11 April 2008 13:53

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 23:59.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06967 seconds with 13 queries