Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Mouse doesn't stay in the window properly

5 replies · 1,286 views · Started 28 January 2010

I'm creating a project that utilizes mouse functionality in ZScript. The only problem is that when you move the mouse onto the top subscreen, the mouse jumps out of the ZC window. However, the mouse goes way below the ZC window (over an inch below the window on the 1280x720 computer I'm currently on), which is completely useless space. So any ZScript users are unable to use the mouse in the subscreen, which would be really useful.

I understand if you want the top left of the screen to be the mousex = 0 and mousey = 0, but could you not move the mouse usability area up and simply have the subscreen area as negative y values?

I just tried out the mouse stuff for the first time right now. Correct me if I'm wrong, but I noticed the following behaviour:

- The mouse is measured in in-game pixels, but
- The origin is the top-left corner of the *window*, not the playing field

Is that what you see? I'm confused as to how this could be useful to anyone at all, and whether it needs to be fixed.

Sorry, I should have included a picture. Also, I'm using version 1129. Anyway, this is how it appears for me:

User posted image

The red is the bounding box of where the mouse will jump from Windows to ZC (as shown by the Windows mouse icon disappearing when I switch over to ZC). However, green is the box where Link->InputMouseX and Link->InputMouseY resides. One thing to notice is that the the mouse (as shown by the top left corner of the heart done via a simple DrawCombo where the mouse position is) actually goes about 8 pixels or so above the playing area, and after testing, I've found that when it's to left and top of the playing area, it actually does give a negative value for its position (which is good). It also goes a bit to the left, but I forgot to move the green box over a little. You can tell by the heart though that it's not flush with the left side of the playing area. However, this change causes the mouse to jump to from the red lines to the green lines, which is annoying in and of itself.

What I would like is the green box and red box to be the same. However, I would suggest that having the top left of the playing area as (0,0) to keep scripting consistent. Anything to the left and above would be negative values, but would still be picked up by ZScript. This would allow scripters to utilize the subscreen area for scripting as well as prevent the mouse jumping. And this should be a simple fix, too, as it would only require some subtracting, which can be done by the scripter, but really it should do that automatically.

Okay, I understand your confusion. No, the mouse doesn't work the way you think. In reality, it's much worse. Check out my thread in Beta Discussion for details.

However, tonight I'll commit a fix that DOES work the way you want it.

Edit: Sorry, I misread what you said the first time and replied with something dumb. 😞

I don't quite how my drawing was incorrect, but maybe I tested it incorrectly. I tested it in multiple Windowed ZC sizes (thought not in fullscreen), and in every size the mouse would jump from the top left of the red box in Windows to the top left of the green box according to ZScript. But, I guess that's probably just how I have ZC setup, so

Anyway, I really thank you for looking into it, and I'm happy to hear that it's already being looked into. 😊 I look forward to the next ZC version with the fix. Thankfully, I don't think this will break my code, but for that we'll just have to see.

I've committed the changes I mentioned in the other thread!

LinktheMaster wrote:Thankfully, I don't think this will break my code, but for that we'll just have to see.

Alas, it probably will. However, it should be easy to fix! If you are subtracting/adding any values to Link->InputMouseX/Y, then you probably just need to get rid of them to make it work (when the next build for your platform is available).