How can I get the absolute screen coordinates of a pixel (for example the hot spot of an active obj) even when the program window is stretched, zoomed, moved away from the borders of the screen, etc. and pixels are very big?
I need to control a cursor both with mouse and with arrow keys, having the two methods to sync properly: when I leave the mouse the cursor can be taken by the arrow keys just where it is, and viceversa when I stop moving with keys the actual mouse position must be set just where the cursor is, and that's where the problems start to show.
I have a movable game window that can be scaled to 3X, 4X, 5X, 6X its original dimensions or set fullscreen and I need to move the actual mouse position (using Mouse Obj) to the position of the active object cursor. Obviously its coordinates are pixel-based inside the frame and are also influenced by the eventual scrolling and most of all by the scaling factor.
I've used an expression like
Set Actual X of mouse to WinXPos( "Window Control" ) - (X Left Frame * Scale) + (X("CursorObject") * Scale)
Set Actual Y of mouse to WinYPos( "Window Control" ) - (Y Top Frame * Scale) + (Y("CursorObject") * Scale)
Mouse obj sets the Actual Mouse X and Actual Mouse Y and it works fine (with a scale multiplier) until the game window is smaller than the screen and you don't get any black borders; but when screen ratio isn't the same you get a very annoying offset with keys movement.
Maybe I could figure out a way to include the possible offset in the expression, but I think that getting the absolute screen coordinates of a pixel (with approximation, I suppose, when the window is scaled and the pixels are fat) could fix the problem more easily.
Thank you in advance