Odd2D problem with system mouse pointer

BlitzMax Forums/BlitzMax Programming/Odd2D problem with system mouse pointer

GfK(Posted 2014) [#1]
Anybody know how to correct this? Basically when using Odd2D with letterbox mode and a virtual resolution, the reported mouse coords do not correspond to the correct screen coords. In the example below, the circle should be where the mouse pointer is.

How do I get around this?

Import odd.d3d9odd2d

SetGraphicsDriver(D3D9Odd2DDriver())

Graphics DesktopWidth(), DesktopHeight(), 32
SetBorderMode(BORDER_LETTERBOX_SOLID)
SetClsColor(40, 40, 40)

SetVirtualResolution(1024, 768)
While Not KeyDown(KEY_ESCAPE)
	Cls
	DrawOval(VirtualMouseX() - 5, VirtualMouseY() - 5, 10, 10)
	Flip
Wend



GfK(Posted 2014) [#2]
Hmm.... OddMouse()? That the only way?


Henri(Posted 2014) [#3]
Haven't tried Odd2D , but reading upon from the introductory page it seems that you are correct.

Q: Why do VirtualMouseX and VirtualMouseY now return incorrect results?
A: Unfortunately I cannot alter their behaviour as Max2D calculates them without accessing the driver. Use the new function OddMouse to get the correct draw position of the mouse pointer.


-Henri


BlitzSupport(Posted 2014) [#4]
Don't know if you ever saw this thing (it's similar to AutoFit but specific to Max) or if you specifically needed Odd2D features, but...

VirtualGfx


Oddball(Posted 2014) [#5]
OddMouse() is the only way to get the correct mouse coordinates when using Odd2D. There's nothing I can do about that. As the faq says MouseX/Y and VirtualMouseX/Y are never exposed to the driver so I have no access to them from Odd2D.


GfK(Posted 2014) [#6]
No worries, the OddMouse thing slotted nicely into my mousepointer class and everything works now. :)