PDA

View Full Version : Mouse in ZScript. Anyone use it?



pkmnfrk
01-27-2010, 11:44 PM
Does anyone use the InputMouseX/Y feature of ZScript? Like, anyone at all?

As they are now, the mouse position, as reported to ZScript is based in the top-left corner of the window.

However, this is stupid. This is far outside of the actual playing field, with which ZScript cannot interact. Further, this out of bounds area is variable, depending on the window size and the -big parameter (if supplied). So, I would like to change this.

Basically, I would like to reset the origin to be the top-left pixel of the actual playing field. This origin is used by the drawing function (DrawTile, etc), and I think it would be much more useful there. The subscreen would be reported as negative-y values (as with the drawing functions, not that you can draw on the subscreen currently!)

The benefits are two-fold:

1. The origin is the same no matter what screen size you have, and
2. It's the same coordinates used by the drawing functions.

Of course, the downside is that any script that uses them would be broken by this change. Of course, if no one actually uses them (possibly because of this), then it's free to change!

Note to Freedom: I consider this a bug, so I wouldn't feel bad about breaking it.

That said, it would also (theoretically) be possible to change this without breaking old scripts until they recompile next, but I don't want to think about that if I don't have to.

Edit: Oh, also, I've already written the code to do this and tested it thoroughly, so I highly doubt this would introduce any new bugs into the engine. So, that would not factor into this decision.

Joe123
01-28-2010, 12:44 AM
Yeah, the mouse using a different coordinate system to the rest of the game isn't a good idea.
I think it'd have to change if the screen offset changed for screens with no subscreen though.

pkmnfrk
01-28-2010, 03:17 AM
I've taken that into account, worry you not!

Gleeok
01-28-2010, 08:23 AM
Yeah just fix it. Let the scripters deal with the repercusions. D: