Graphics Reference
In-Depth Information
calls. Listing 10.16 shows the mouse event source routines of Tutorial 10.14. As
we can see at label A, the DeviceToWorld() function is called (for both mouse
button and mouse move event service routines). By running Tutorial 10.14, we
can verify that this tutorial functions as expected.
// Mouse button services
void CMainHandler::OnMouseButton( bool down, unsigned int nFlags, int hwX, int hwY)
.
Source file.
DrawAndMouseHandler.cpp
file in the WindowHandler
folder of the D3D _ MousePan
project.
HardwareToDevice(hwX, hwY, deviceX, deviceY); // hwXY -> deviceXY
A:
DeviceToWorld(deviceX, deviceY, wcX, wcY); // deviceXY -> wcXY
.
if (nFlags & MK _ LBUTTON) // Left Mouse Button down
// Compute new center of small view WC Window based on wcXY
ComputeBoundPosition(wcX, wcY);
// Mouse move services
void CMainHandler::OnMouseMove( unsigned int nFlags, int hwX, int hwY)
.
HardwareToDevice(hwX, hwY, deviceX, deviceY); // hwXY -> deviceXY
A:
DeviceToWorld(deviceX, deviceY, wcX, wcY); // deviceXY -> wcXY
.
if (nFlags & MK _ LBUTTON) // Left Mouse Button down
// Compute new center of small view WC Window based on wcXY
ComputeBoundPosition(wcX, wcY);
Listing 10.16. The MainHandler mouse event service routines of Tutorial 10.14.
Search WWH ::




Custom Search