Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Controlling the camera with mouse in DarkGDK.NET and VB

Author
Message
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 23rd Oct 2012 23:46 Edited at: 24th Oct 2012 03:58
This is my technique for controlling the camera using the mouse, but only when you press the Right Mouse Button (rmb).

I discoverd that "Mouse.MoveX" and "Mouse.MoveY" are not recognized, but "Mouse.MoveXAlternate" and "Mouse.MoveYAlternative" are.
Here is my method/routine(s) for controlling the camera with the mouse. I am using Visual Studio 2012 with the DarkGDK.NET library.

First, create a boolean variable at the module level;

Public rmb as boolean

Create additional global variables like I have:

Public Xcangle as single = 0.0f
Public Ycangle as single = 0.0f
Public xnewangle as single = 0.0f
Public MMY as single = 0.0f
Public MMX as single = 0.0f

Then, create this routine to be called anytime rmb is True.



rmb is set to true with the mouse down event attached to the CtlDarkGDKViewPort1 here when the right mouse button is pressed:



The mouse up event resets the rmb boolean back to false:



In the main game loop, call the routine anytime the rmb is true;



mmx and mmy are constantly updated to track where the mouse is before the call to PointCameraUsingMouse()

Login to post a reply

Server time is: 2024-04-23 08:08:04
Your offset time is: 2024-04-23 08:08:04