[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2015-08-21T19:06:06-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/4021 2015-08-21T19:06:06-05:00 2015-08-21T19:06:06-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=23623#p23623 <![CDATA[Re: _MOUSEINPUT problem]]> Statistics: Posted by burger2227 — Fri Aug 21, 2015 7:06 pm


]]>
2015-08-21T18:21:41-05:00 2015-08-21T18:21:41-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=23622#p23622 <![CDATA[Re: _MOUSEINPUT problem]]>
I have changed my code to the following and it works perfectly (even if the mouse is moved around):

DO 'main program loop
DO WHILE _MOUSEINPUT 'check mouse status
b1 = _MOUSEBUTTON(1)
LOOP
DO WHILE b1 'check for button release
i = _MOUSEINPUT
b1 = _MOUSEBUTTON(1)
Click = 1
LOOP

IF Click = 1 THEN PRINT "CLICK" ' (this is where you do your thing; could be a GOSUB)
Click = 0: b1 = 0 'reset where needed
LOOP UNTIL INKEY$ <> "" ' press any key to quit

I will keep this as an example.

Statistics: Posted by davey — Fri Aug 21, 2015 6:21 pm


]]>
2015-08-21T16:56:04-05:00 2015-08-21T16:56:04-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=23621#p23621 <![CDATA[Re: _MOUSEINPUT problem]]>
Best way to read a button held down is to just read it every loop so that you can also read button presses after every read.

Code:

DOi = _MOUSEINPUT 'allows reads of all functions and keeps button history that is lost when it becomes 0.b = _MOUSEBUTTONN(1)LOOP UNTIL b = 0  
If moves are your main concern then use other kinds of loops. Only use _MOUSEINPUT UNTIL or WHILE to catch up.

Also use _LIMIT 100 or so to slow down loops as _DELAY stops everything!

Use our WIKI: http://www.qb64.net/wiki/index.php/MOUSEBUTTON

Statistics: Posted by burger2227 — Fri Aug 21, 2015 4:56 pm


]]>
2015-08-20T17:07:24-05:00 2015-08-20T17:07:24-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=23618#p23618 <![CDATA[_MOUSEINPUT problem]]>
In the following test code, it works as long as the mouse is not moved, although sometimes requires 2 or 3 loops to reset. If the mouse is moved between clicks, it can require over 100 loops.

SCREEN 12
_FULLSCREEN

DO WHILE INKEY$ = "" ' <--- hit any key to exit

IF _MOUSEINPUT < 0 THEN
mi = _MOUSEINPUT
PRINT "Do your thing here. mi = ", mi, c
IF _MOUSEBUTTON(1) < 0 THEN PRINT "Left"

DO WHILE _MOUSEINPUT < 0 'mi < 0 ' <--- LET THE MOUSE "RECOVER" TO ZERO!!! Or it won't work if mouse moves
mi = _MOUSEINPUT
c = c + 1 ' <--- To prove it, count how many times it loops before going to zero
_DELAY 0.1 ' <-- Even with a delay, it still needs many loops, especially if mouse has been moved between clicks
LOOP

END IF

PRINT "mouse button up", c
c = 0: mi = 0
_DELAY .5 ' <--Slow the whole thing down so you can read it

LOOP
PRINT c, "exit"

Also, the first time through the IF statement, the input is always -1, even though the mouse has not been clicked.

Am I doing something wrong here?

Statistics: Posted by davey — Thu Aug 20, 2015 5:07 pm


]]>