Jump to content
  • Advertisement
Sign in to follow this  
one mind

Active viewport

This topic is 5129 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!