MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / mouseInputButton

Function mouseInputButton

Samples/NiViewer/MouseInput.cpp:72–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void mouseInputButton(int button, int state, int x, int y)
73{
74 if (button == GLUT_LEFT_BUTTON)
75 {
76 if (state == GLUT_DOWN)
77 {
78 g_MouseInput.nSelectionState = SELECTION_ACTIVE;
79 g_MouseInput.StartSelection.X = x;
80 g_MouseInput.StartSelection.Y = y;
81 }
82 else if (state == GLUT_UP && g_MouseInput.nSelectionState == SELECTION_ACTIVE)
83 {
84 // this is only a selection if mouse has moved
85 if (x != g_MouseInput.StartSelection.X && y != g_MouseInput.StartSelection.Y)
86 {
87 g_MouseInput.nSelectionState = SELECTION_DONE;
88 mouseInputCallSelection();
89 }
90
91 g_MouseInput.nSelectionState = SELECTION_NONE;
92 }
93 }
94}
95
96void mouseInputRegisterForSelectionRectangle(SelectionRectangleChangedPtr pFunc)
97{

Callers 1

MouseCallbackFunction · 0.85

Calls 1

mouseInputCallSelectionFunction · 0.85

Tested by

no test coverage detected