Beispiel #1
0
void Window::MousePressedHandle(int button, int state, int x, int y)
{
	Window* wInst = Window::GetInstance();
	int cur = wInst->CurrentActive(x, y);
	if (cur < 0) return;
	else
	{
		Info I = Info(x,y,button, state, 0);
		wInst -> _components[cur] -> EventHandle(MouseClick, I);
		glutSwapBuffers();
	}
}
Beispiel #2
0
void Window::MouseMoveHandle(int ax, int ay)
{
	Window* wInst = Window::GetInstance();
	int cur = wInst->_currentActive;
	int newCur = wInst->CurrentActive(ax, ay);
	if (newCur == cur)
		return;
	else
	{
		Info I = Info(ax, ay);
		if (cur >= 0)
			wInst->_components[cur]->EventHandle(MouseOut, I);
		cur = wInst->_currentActive = newCur;
		if (cur >= 0)
			wInst->_components[cur]->EventHandle(MouseOn, I);
		glutSwapBuffers();
	}
}