TEST( Input, MouseInput ) { Input newInput = {}; Input oldInput = {}; newInput.buttons[BUTTON_LEFT] = true; EXPECT_TRUE( ButtonDown( &newInput, BUTTON_LEFT ) ); EXPECT_FALSE( ButtonDown( &oldInput, BUTTON_RIGHT ) ); EXPECT_TRUE( ButtonPressed( &newInput, &oldInput, BUTTON_LEFT ) ); EXPECT_FALSE( ButtonReleased( &newInput, &oldInput, BUTTON_LEFT ) ); oldInput.buttons[BUTTON_LEFT] = true; EXPECT_TRUE( ButtonDown( &newInput, BUTTON_LEFT ) ); EXPECT_TRUE( ButtonDown( &oldInput, BUTTON_LEFT ) ); EXPECT_FALSE( ButtonPressed( &newInput, &oldInput, BUTTON_LEFT ) ); EXPECT_FALSE( ButtonReleased( &newInput, &oldInput, BUTTON_LEFT ) ); newInput.buttons[BUTTON_LEFT] = false; EXPECT_FALSE( ButtonDown( &newInput, BUTTON_LEFT ) ); EXPECT_TRUE( ButtonDown( &oldInput, BUTTON_LEFT ) ); EXPECT_FALSE( ButtonPressed( &newInput, &oldInput, BUTTON_LEFT ) ); EXPECT_TRUE( ButtonReleased( &newInput, &oldInput, BUTTON_LEFT ) ); newInput.buttons[BUTTON_RIGHT] = true; EXPECT_TRUE( ButtonDown( &newInput, BUTTON_RIGHT ) ); EXPECT_FALSE( ButtonDown( &oldInput, BUTTON_RIGHT ) ); EXPECT_TRUE( ButtonPressed( &newInput, &oldInput, BUTTON_RIGHT ) ); EXPECT_FALSE( ButtonReleased( &newInput, &oldInput, BUTTON_RIGHT ) ); }
/* ================== DemoScene::HandleCommand ================== */ void DemoScene::HandleCommand(Pim::ConsoleCommand cmd) { if (cmd.size() > 1) { if (cmd[1] == "next") { ButtonReleased(hud->buttonNext); } else if (cmd[1] == "prev") { ButtonReleased(hud->buttonPrev); } } }
/*----------------------------------------------------------------------------- * detect button release */ static void CheckButton(void) { uint8_t i = 0; TButtonEvent buttonEventData; while (ButtonReleased(&i) == true) { if (ButtonGetReleaseEvent(i, &buttonEventData) == true) { ApplicationEventButton(&buttonEventData); } } }
void MyMessageBox::rightButtonReleased() { ButtonReleased(rightButton); }
void MyMessageBox::leftButtonReleased() { ButtonReleased(leftButton); }