Author Topic: Possible QB1.3 Bug with mouse input  (Read 3499 times)

0 Members and 1 Guest are viewing this topic.

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Possible QB1.3 Bug with mouse input
« on: April 25, 2019, 07:58:52 pm »
seems like _MOUSEMOVEMENTX returns nothing and _MOUSEMOVEMENTY only returns 1 and not -1. Possible bug or did the way _MOUSEMOVMENT is handled change.

Code: QB64: [Select]

FellippeHeitor

  • Guest
Re: Possible QB1.3 Bug with mouse input
« Reply #1 on: April 25, 2019, 09:53:54 pm »
_MOUSEMOVEMENTX and _MOUSEMOVEMENTY have not ever been fully implemented in stable versions of QB64, having only been available in beta versions prior to 1.0, before the creator decided to integrate QB64 and OpenGL. They simply remained there in a non-functional state - nothing specifically related to the recent 1.3 release, sorry.
« Last Edit: April 25, 2019, 09:55:00 pm by FellippeHeitor »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Possible QB1.3 Bug with mouse input
« Reply #2 on: April 26, 2019, 02:38:02 am »
This is my attempt to solve this problem. It's without guarantee, I've only tested it on one computer where the mouse has two axes.

Code: QB64: [Select]
  1.     D& = _DEVICEINPUT
  2.     IF D& THEN
  3.         IF _LASTAXIS(D&) >= 2 THEN
  4.             IF oldx <> _AXIS(1) THEN
  5.                 IF oldx < _AXIS(1) THEN MOUSEMOVEMENTX = 1 ELSE MOUSEMOVEMENTX = -1
  6.                 oldx = _AXIS(1)
  7.             END IF
  8.  
  9.             IF oldy <> _AXIS(2) THEN
  10.                 IF oldy < _AXIS(2) THEN MOUSEMOVEMENTY = 1 ELSE MOUSEMOVEMENTY = -1
  11.                 oldy = _AXIS(2)
  12.             END IF
  13.         END IF
  14.     ELSE
  15.         MOUSEMOVEMENTX = 0: MOUSEMOVEMENTY = 0
  16.     END IF
  17.     PRINT MOUSEMOVEMENTX, MOUSEMOVEMENTY
  18.     _LIMIT 50
  19.  

_LIMIT must be used, otherwise is program so fast, that just zeros are displayed.

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: Possible QB1.3 Bug with mouse input
« Reply #3 on: April 26, 2019, 09:27:18 am »
_MOUSEMOVEMENTX and _MOUSEMOVEMENTY have not ever been fully implemented in stable versions of QB64, having only been available in beta versions prior to 1.0, before the creator decided to integrate QB64 and OpenGL. They simply remained there in a non-functional state - nothing specifically related to the recent 1.3 release, sorry.

That is really odd then. Because in the game I just released I used them and they worked fine? Here is the mouse input section.

Code: QB64: [Select]
  1.        DO WHILE _MOUSEINPUT
  2.             IF Player1.Locked = 0 THEN
  3.                 IF _MOUSEMOVEMENTX > 0 THEN
  4.                     Player1.PosX = Player1.PosX + Player1.Speed
  5.                     IF Player1.PosX > Settings.RezX THEN Player1.PosX = Settings.RezX
  6.                 END IF
  7.  
  8.                 IF _MOUSEMOVEMENTX < 0 THEN
  9.                     Player1.PosX = Player1.PosX - Player1.Speed
  10.                     IF Player1.PosX < 5 THEN Player1.PosX = 5
  11.                 END IF
  12.  
  13.                 IF _MOUSEMOVEMENTY > 0 THEN
  14.                     Player1.Frame = 3
  15.                     Player1.PosY = Player1.PosY + Player1.Speed
  16.                     IF Player1.PosY > Settings.RezY - 20 THEN Player1.PosY = Settings.RezY - 20
  17.                 END IF
  18.  
  19.                 IF _MOUSEMOVEMENTY < 0 THEN
  20.                     Player1.Frame = 2
  21.                     Player1.PosY = Player1.PosY - Player1.Speed
  22.                     IF Player1.PosY < 0 THEN Player1.PosY = 0
  23.                 END IF
  24.  
  25.                 IF _MOUSEBUTTON(1) = -1 THEN TIMER(FireLazarTimer) ON
  26.                 IF _MOUSEBUTTON(1) = 0 THEN TIMER(FireLazarTimer) OFF
  27.  
  28.                 IF _MOUSEBUTTON(2) AND DisableLaserInput = 0 AND Player1.SLaser > 0 THEN
  29.                     DisableLaserInput = 1
  30.                     Player1.Locked = 1
  31.                     Player1.SLaser = Player1.SLaser - 1
  32.                     CALL SetupSprite(Player1.PosX + 150, Player1.PosY + 5, 0, 0, "SLase", 80, 0, 0, 1, 0, 1, 1, 0)
  33.                 END IF
  34.             END IF
  35.         LOOP
  36.  

FellippeHeitor

  • Guest
Re: Possible QB1.3 Bug with mouse input
« Reply #4 on: April 26, 2019, 09:45:30 am »
Was that in v1.2?

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: Possible QB1.3 Bug with mouse input
« Reply #5 on: April 26, 2019, 10:22:03 am »
The file name was "qb64_2018-02-12-19-30-35_1d0f920-master_win.7z"

looks like i downloaded it on 10-28-2018
« Last Edit: April 26, 2019, 10:23:05 am by Craz1000 »

FellippeHeitor

  • Guest
Re: Possible QB1.3 Bug with mouse input
« Reply #6 on: April 26, 2019, 10:39:06 am »
Code: QB64: [Select]
  1.     CLS
  2.     PRINT player1.posx
  3.     PRINT player1.posy
  4.  
  5.         player1.posx = player1.posx + 1
  6.     END IF
  7.  
  8.         player1.posx = player1.posx - 1
  9.     END IF
  10.  
  11.         player1.posy = player1.posy + 1
  12.     END IF
  13.  
  14.         player1.posy = player1.posy - 1
  15.     END IF
  16.  
  17.     _DISPLAY
  18.     _LIMIT 30

Does the above produce any results on your machine?

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Possible QB1.3 Bug with mouse input
« Reply #7 on: April 26, 2019, 10:53:11 am »
Hi Fellippe. Your code do nothing under QB 1.3 for me, BUT i found QB64 version, which work correctly with _MOUSEMOVEMENTX and _MOUSEMOVEMENTY. Its V 1.1? QB64.EXE date is 09.02.2017 (DDMMYY), filesize is 7.654.912

After rewriting your source as this:

Code: QB64: [Select]
  1.     CLS
  2.     PRINT player1.posx, _MOUSEMOVEMENTX
  3.     PRINT player1.posy, _MOUSEMOVEMENTY
  4.  
  5.     a = _MOUSEINPUT
  6.         player1.posx = player1.posx + 1
  7.     END IF
  8.  
  9.         player1.posx = player1.posx - 1
  10.     END IF
  11.  
  12.         player1.posy = player1.posy + 1
  13.     END IF
  14.  
  15.         player1.posy = player1.posy - 1
  16.     END IF
  17.  
  18.     _DISPLAY
  19.     _LIMIT 30
  20.  

it then work in the OLD ide correctly, in 1.3 it show Y axis, but badly.

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: Possible QB1.3 Bug with mouse input
« Reply #8 on: April 26, 2019, 12:57:43 pm »
Changed it to this. Game was ported to QB64-1.3 just now

Code: QB64: [Select]
  1.         DO WHILE _MOUSEINPUT
  2.             IF Player1.Locked = 0 THEN
  3.                 IF _MOUSEX > Player1.PosX THEN
  4.                     Player1.PosX = Player1.PosX + Player1.Speed
  5.                     IF Player1.PosX > Settings.RezX THEN Player1.PosX = Settings.RezX
  6.                 END IF
  7.  
  8.                 IF _MOUSEX < Player1.PosX THEN
  9.                     Player1.PosX = Player1.PosX - Player1.Speed
  10.                     IF Player1.PosX < 5 THEN Player1.PosX = 5
  11.                 END IF
  12.  
  13.                 IF _MOUSEY > Player1.PosY THEN
  14.                     Player1.Frame = 3
  15.                     Player1.PosY = Player1.PosY + Player1.Speed
  16.                     IF Player1.PosY > Settings.RezY - 20 THEN Player1.PosY = Settings.RezY - 20
  17.                 END IF
  18.  
  19.                 IF _MOUSEY < Player1.PosY THEN
  20.                     Player1.Frame = 2
  21.                     Player1.PosY = Player1.PosY - Player1.Speed
  22.                     IF Player1.PosY < 0 THEN Player1.PosY = 0
  23.                 END IF
  24.  
  25.                 IF _MOUSEBUTTON(1) = -1 THEN TIMER(FireLazarTimer) ON
  26.                 IF _MOUSEBUTTON(1) = 0 THEN TIMER(FireLazarTimer) OFF
  27.  
  28.                 IF _MOUSEBUTTON(2) AND DisableLaserInput = 0 AND Player1.SLaser > 0 THEN
  29.                     DisableLaserInput = 1
  30.                     Player1.Locked = 1
  31.                     Player1.SLaser = Player1.SLaser - 1
  32.                     CALL SetupSprite(Player1.PosX + 150, Player1.PosY + 5, 0, 0, "SLase", 80, 0, 0, 1, 0, 1, 1, 0)
  33.                 END IF
  34.             END IF
  35.         LOOP
  36.  

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Possible QB1.3 Bug with mouse input
« Reply #9 on: April 27, 2019, 09:34:03 am »
Here my feedback

I've got these results:
noone works
  [ You are not allowed to view this attachment ]    [ You are not allowed to view this attachment ]    [ You are not allowed to view this attachment ]  
Programming isn't difficult, only it's  consuming time and coffee

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: Possible QB1.3 Bug with mouse input
« Reply #10 on: April 27, 2019, 11:21:05 am »
The middle one is the version i was using before i switched to 1.3

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Possible QB1.3 Bug with mouse input
« Reply #11 on: April 27, 2019, 02:27:03 pm »
Yeah, ok, is better see version info.... So QB64, which is work right with my repaired version original from Fellippe is this:

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Possible QB1.3 Bug with mouse input
« Reply #12 on: April 27, 2019, 02:36:17 pm »
And also version 1.1 revision 20170120/51 works correctly with my version. There can not be row "DO WHILE _MOUSEINPUT: LOOP" but "a = _MOUSEINPUT" to work.

With row contains "DO WHILE _MOUSEINPUT: LOOP" it work not under all versions.
« Last Edit: April 27, 2019, 02:38:54 pm by Petr »