Skip to main content
GameDev.net gamedev.net
🔒 Locked

Active viewport

Started by one mind Sep 4, 2004 at 4:19 AM 2 replies 500+ views
Original Post
one mind
one mind
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 :)
C Fuller
C Fuller
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
one mind
one mind
Thanks Chris :)
I'll give it a try

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.