Ejemplo n.º 1
0
void CButton::onEvent(Uint8 eventType)
{
	if(!display) return;
	int mouse_x = event.button.x;
	int mouse_y = event.button.y;

	if(onButton(mouse_x, mouse_y))
	{
		if(eventType == SDL_MOUSEBUTTONDOWN)
			onMouseDown();
		else if(eventType == SDL_MOUSEBUTTONUP)
			onClick();
		else if(eventType == SDL_MOUSEMOTION)
			onMouseOver();
	}
	else
		setImageState(getType());
		
}
Ejemplo n.º 2
0
void Joystick::onButton(Button button, JoystickButtonCallbackFunction cbFunction){
	onButton(button, defaultDigitalPin[button], cbFunction);
}