Author Topic: _MOUSEMOVE question  (Read 3987 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
_MOUSEMOVE question
« on: December 29, 2020, 11:19:18 pm »
Some other thread mentioned changing the cursor, so of course I had to add a customizable
cursor to my chess program.  Annoyingly, the new cursor doesn't show up until the mouse is
moved, which may lead the user into thinking the change has not happened.  A solution is to
use _MOUSEMOVE to move the cursor one pixel to the right, a barely noticeable movement.
However, this does not work in fullscreen mode, unless that fullscreen is also the desktop
size.  Is there a better workaround than following?  It's a solution I don't like because it also
generates a crude screen "blink".

Code: QB64: [Select]
  1. SUB VooDoo
  2.     cursortype = (cursortype + 1) MOD 4
  3.     _MOUSESHOW RTRIM$(MID$("LINK     CROSSHAIRTEXT     DEFAULT  ", cursortype * 9 + 1, 9))
  4.     fsf = _FULLSCREEN
  5.     IF fsf THEN
  6.         DO
  7.             _FULLSCREEN OFF
  8.             _DELAY .1
  9.         LOOP UNTIL _FULLSCREEN = 0
  10.         _DELAY .2
  11.     END IF
  12.     _MOUSEMOVE (mx + 1) MOD _WIDTH, my
  13.     IF fsf THEN
  14.         DO
  15.             _FULLSCREEN _SQUAREPIXELS , _SMOOTH
  16.             _DELAY .1
  17.         LOOP UNTIL _FULLSCREEN > 0
  18.         _DELAY .2
  19.     END IF
  20.  
« Last Edit: December 29, 2020, 11:33:54 pm by Richard Frost »
It works better if you plug it in.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: _MOUSEMOVE question
« Reply #1 on: December 30, 2020, 05:05:06 am »
For whatever reason, _MOUSESHOW disables the  _MOUSEMOVEMENTX or _MOUSEMOVEMENTY relative mouse movement reads. Have you tried using _MOUSEHIDE in the code, just before switching to _FULLSCREEN, and then re-initiating _MOUSESHOW?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: _MOUSEMOVE question
« Reply #2 on: December 30, 2020, 11:11:46 am »
Using _MOUSEHIDE before the cursor change and/or a blank _MOUSESHOW after doesn't help - the
change is not shown until the mouse is moved. 

Using _MOUSEMOVE to move one pixel works great - except in fullscreen.  The only solutions I see for
chess are:

1) disallow fullscreen
2) live with the ugly "blink" of my current solution
3) Use a screen the size of the desktop, frequently copy the desktop to it, and have a window inside
    that screen  for the smaller screen wanted. 
It works better if you plug it in.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: _MOUSEMOVE question
« Reply #3 on: December 30, 2020, 12:45:56 pm »
I'd experienced that "blink" in my firefox clone. I couldn't live with it, either.

Sorry the thought I had didn't work out. It was the only possibility I could come up with.

I've found _FULLSCREEN to be a bit glitchy at times, so I usually disable it.

You might want to ask the dev team if there is a solution to this for the upcoming v1.5. Maybe it wouldn't be too big of a fix to add it. It sounds like something that should be a part of the platform.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: _MOUSEMOVE question
« Reply #4 on: December 30, 2020, 12:52:41 pm »
I thought of another solution, probably the easiest - disable the mouse cursor and draw my own.
That'd also allow far more cursor choices, and animation. 
It works better if you plug it in.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: _MOUSEMOVE question
« Reply #5 on: December 30, 2020, 01:16:40 pm »
I think back in the QBasic Period, I did something similar. I used PCOPY, back then, to move my cursor, copy it , and return it back to the original screen. I think it was a little glitchy, due to the speed a mouse can be moved. It was fine with slower movements. I hope QB64 has a better solution to making a custom mouse. Since I stay in SCREEN 0, the only thing I normally need is the LOCATE statement to change the appearance of the cursor from an underline to some type of rectangle or square.

Best wishes with the custom cursor idea!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: _MOUSEMOVE question
« Reply #6 on: December 31, 2020, 01:09:35 am »
I thought of another solution, probably the easiest - disable the mouse cursor and draw my own.
That'd also allow far more cursor choices, and animation.

That would be my choice, in this instance.
Granted after becoming radioactive I only have a half-life!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: _MOUSEMOVE question
« Reply #7 on: December 31, 2020, 12:47:11 pm »
That would be my choice, in this instance.

+1 yep!