Update of /cvsroot/simspark/simspark/contrib/rsgedit
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27535
Modified Files:
sparkglcanvas.cpp sparkglcanvas.h
Log Message:
- capture mouse input when the mouse is moved and a button is pressed simultaneously. This allows to control the camera even if the mouse pointer leaves the OpenGL window
Index: sparkglcanvas.h
===================================================================
RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglcanvas.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sparkglcanvas.h 15 Mar 2007 07:26:24 -0000 1.4
--- sparkglcanvas.h 1 Apr 2007 15:48:33 -0000 1.5
***************
*** 62,65 ****
--- 62,66 ----
void OnRightUp(wxMouseEvent& event);
void OnMouseMove(wxMouseEvent& event);
+ void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
void Render(wxDC& dc);
***************
*** 74,77 ****
--- 75,79 ----
SparkGLRender mRender;
boost::shared_ptr<kerosin::InputSystem> mInputSystem;
+ bool mMouseCaptured;
private:
Index: sparkglcanvas.cpp
===================================================================
RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglcanvas.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** sparkglcanvas.cpp 31 Mar 2007 13:26:41 -0000 1.6
--- sparkglcanvas.cpp 1 Apr 2007 15:48:33 -0000 1.7
***************
*** 45,48 ****
--- 45,49 ----
EVT_RIGHT_UP(SparkGLCanvas::OnRightUp)
EVT_MOTION(SparkGLCanvas::OnMouseMove)
+ EVT_MOUSE_CAPTURE_LOST(SparkGLCanvas::OnMouseCaptureLost)
END_EVENT_TABLE()
***************
*** 54,57 ****
--- 55,59 ----
: wxGLCanvas(parent, (wxGLCanvas*) NULL, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE , name )
{
+ mMouseCaptured = false;
mInit = false;
}
***************
*** 62,65 ****
--- 64,68 ----
: wxGLCanvas(parent, other->GetContext(), id, pos, size, style|wxFULL_REPAINT_ON_RESIZE , name)
{
+ mMouseCaptured = false;
mInit = false;
}
***************
*** 244,247 ****
--- 247,270 ----
lastX = event.GetX();
lastY = event.GetY();
+
+ if (
+ (event.LeftIsDown()) ||
+ (event.MiddleIsDown()) ||
+ (event.RightIsDown())
+ )
+ {
+ if (! mMouseCaptured)
+ {
+ CaptureMouse();
+ mMouseCaptured = true;
+ }
+ } else
+ {
+ if (mMouseCaptured)
+ {
+ ReleaseMouse();
+ mMouseCaptured = false;
+ }
+ }
}
***************
*** 255,256 ****
--- 278,284 ----
mInputSystem->AddInput(input);
}
+
+ void SparkGLCanvas::OnMouseCaptureLost(wxMouseCaptureLostEvent& /*event*/)
+ {
+ mMouseCaptured = false;
+ }
|