Jump to content
  • 0

What is the difference between mouse modes 1 and -1


lamb-duh
 Share

Question

The documentation gives this explanation for the three modes:

Quote
0 Hide mouse
1 Show mouse, set default mouse pointer
$FF Show mouse, don't configure mouse cursor

However, from testing it seems that mode 0 does not "hide" the mouse, it completely disables it. Using both modes 1 and -1, I can get meaningful mouse coordinates, but something is still trying to draw a pointer (I'm not entirely sure what it's doing, but it looks like it's trying to hijack a sprite).

I want to use a mouse, but I want to be in control of drawing my own pointer, how can I get that? And what does "don't configure mouse cursor mean"-- does that mean it's still going to *show* the cursor, but it's up to me to configure a sprite or something for it?

 

eta: I guess I've figured out that I was right about the difference between the two modes---mode 1 puts a cursor icon into the sprite and -1 doesn't, however both modes update the x,y position of sprite 0 every time the mouse is moved. If I set mode 0 though, then mouse_get doesn't work. so I'm still left wondering if there's any way to use the mouse without the coordinates being written into sprite data? also, where in vram is the cursor icon loaded?

Edited by lamb-duh
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I believe your assumption is correct. If you turn on the mouse (with either 1 or -1) it will automatically update x and y coordinate.

I experimented a bit with it and it can be quite annoying because if you try to use Sprite 0 for an active object in your game it will sometimes jump to some erratic locations. My workaround was to turn on the mouse, and use empty sprite for Sprite 0 and just use it to read the movements and then display Sprite 1 accordingly but still have control over the actual coordinates.

Edited by DusanStrakl
Link to comment
Share on other sites

  • 0
13 hours ago, DusanStrakl said:

My workaround was to turn on the mouse, and use empty sprite for Sprite 0 and just use it to read the movements and then display Sprite 1 accordingly but still have control over the actual coordinates.

That's exactly what I do, too 🙂. Maybe not very elegant, but it works.

Link to comment
Share on other sites

  • 0

That's unfortunate that you can't use the kernal mouse routines without losing a sprite to a pointer. I looked at the source, which confirms that the same variable is used to control the pointer sprite and bail out of reading mouse data at all. I guess the solution would be to access the ps/2 interface directly if you really didn't want it.

Link to comment
Share on other sites

  • 0
On 12/22/2020 at 3:41 PM, lamb-duh said:

That's unfortunate that you can't use the kernal mouse routines without losing a sprite to a pointer. I looked at the source, which confirms that the same variable is used to control the pointer sprite and bail out of reading mouse data at all. I guess the solution would be to access the ps/2 interface directly if you really didn't want it.

I suppose, if that 128th sprite is that crucial. But considering the per-line limit for sprite counts, you'll be hard pressed to even get 127 sprites visible at once.

On 12/22/2020 at 11:32 AM, AndyMt said:

Maybe not very elegant, but it works.

I think that's perfectly elegant. if you want to do a paddle or trackball style game, that's the way to go.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use