Game Development Community

Getting the mouse cursor position no matter what

by Chris · in Torque 3D Professional · 05/28/2010 (11:11 pm) · 2 replies

I'm trying to find the current cursor position no matter what focus, hitting or visibility the control has.

Could someone show me the correct method, this is what I am doing now and it will work with my window border size and in windowed mode only. I'm sure there is a stupid simple way to make this happen and I'm just not finding it.

Thanks, Chris

GuiCanvas *pRoot = getRoot();
	PlatformWindow* pWindow = pRoot->getPlatformWindow();

	Point2I CursorPos;
	Point2I WindowPos;
	pWindow->getCursorPosition(CursorPos);
	WindowPos = pWindow->getPosition();

	CursorPos -= WindowPos;
	CursorPos -= Point2I(6, 28);

#1
05/28/2010 (11:14 pm)
Are you sure that the GUI class that is already built in doesn't already have a method that gets the mouse corrdinates? Why not just use that method or look at it to make sure it is working as you intended it to work?
#2
05/28/2010 (11:17 pm)
Well the GUI controls do have this, but it only returns guievents when the control is hit (mouse is over it or something of that nature)