Cmm2: Game: ChemiChaos - Fix the Mix, Save the Lab!


Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6541
Posted: 02:10am 31 Jan 2021      

Running this program highlighted an interesting problem.

If I run it normally from the commandline, no problems.
I normally will run programs by clicking on the file name in my file manager (or the files command).
When I start it with a mouse left click, the LeftClick SUB gets called before the cursor has been setup.
This causes an error.

My 'fix' was to put
newclick = -1

immediately before searching for the mouse.
and then added a test in the LeftClick SUB

sub LeftClick
 if newclick = 0 then
   newclick = 1
   handx = mouse(x,mport-1)
   handy = mouse(y,mport-1)
   if mport then gui cursor handx,handy
 endif
end sub


Your code has newclick = 0 later, after all the setup, so the test inhibits the first LeftClick.


I expect that any program that uses the interrupt is likely to have the same problem.

Perhaps Peter can clear the mouse buttons on RUN.

Jim