Sign in to follow this  
one mind

Active viewport

Recommended Posts

Hi, I'm making a simlple modeler. So far i have a window with 4 viewports and now i am trying to implement camera controls. The trouble i am having is, when i click on my pan button and drag in a viewport, all viewports pan. What i need is a way to activate viewports, like in max how the active viewport is surrounded by a yellow square and you have to click in a viewport to activate it. How do i go about testing for mouse clicks in a specific viewport? Any suggestions would be great Thanks heaps :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You need to make yourself a nice little MouseOver( ) function. Something like this:

bool MouseOver( int iX, int iY, int iWidth, int iHeight ) {

if ( MouseX( ) >= iX && MouseX( ) = iY && MouseY( )
Then, for each viewport check to see if the mouse is over the viewport coordinates, and if it is, check for mouse down events from any of the mouse buttons.

Assuming you have your own mouse input functions that should work nicely.

Regards,
Chris

Share this post


Link to post
Share on other sites
You need to make yourself a nice little MouseOver( ) function. Something like this:

bool MouseOver( int iX, int iY, int iWidth, int iHeight ) {

if ( MouseX( ) >= iX && MouseX( ) < iX + iWidth && MouseY( ) >= iY && MouseY( ) < iY + iHeight )
return true;

return false;

}


Then, for each viewport check to see if the mouse is over the viewport coordinates, and if it is, check for mouse down events from any of the mouse buttons.

Assuming you have your own mouse input functions that should work nicely.

Regards,
Chris

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this