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()); }
void Joystick::onButton(Button button, JoystickButtonCallbackFunction cbFunction){ onButton(button, defaultDigitalPin[button], cbFunction); }