Why is it impossible to get mouse coordinates as floating point values?

It seems to me that in some cases it would be useful to read higher accuracy values ​​from the mouse, and not just a range of discrete pixel coordinates at the current screen resolution. Obviously, there is no need for a GUI, but for some games it does not even make sense to associate it with a screen resolution in general.

Why are we forced to read it as pixel coordinates instead of the usual analog values?

+4
source share
4 answers

On Windows, at least you can get higher resolution coordinates, from 0 to 0xffff, rather than a mouse position translated to screen coordinates, for devices that support high resolution reports

Retrieves high resolution dots. Points can range from zero to 65535 (0xFFFF) in x and y coordinates. This is the resolution provided on absolute coordinate pointing devices, such as drawing tablets.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646259(v=vs.85).aspx

You can use custom scaling to achieve subpixel resolution on a Mac, according to one answer here:

Mouse coordinates with high resolution and high frame rate on OSX? (Or another solution?)

No answer to this question was accepted, but further investigation may be required.

+2
source

Windows uses WM_INPUT and WM_MOUSEMOVE , as well as DirectInput and XInput;

By default, it only supports WM_MOUSEMOVE for the main Windows GUI, which is completely integer, but if you must implement WM_INPUT and WM_MOUSEMOVE at the same time, you can move the mouse cursor with Subpixel precision.

Some programs will obviously benefit from this, such as first-person shooters, web browsers (enlarged pages and scroll bars) and image editing programs (such as GIMP, Photoshop, etc.)

In addition, if the mouse sends WM_INPUT and WM_MOUSEMOVE at the same time, and while supporting the Windows shell, it will look smoother overall.

+2
source

It depends on the language and environment used.
For example, the Morphic GUI, powered by Pharo or Squeak smalltalk, uses floats as its coordinates.

This is indicated in the accepted answer here.

Morphic was implemented in self

0
source

Because the mouse does not provide analog values ​​or floating point values. This is already a translation.

[edit] Does anyone want to comment -1?

-4
source

All Articles