コード例 #1
0
ファイル: win_tests.cpp プロジェクト: MrGurken/Babbalaur
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 ) );
}
コード例 #2
0
ファイル: DemoScene.cpp プロジェクト: DerMinze/Pim
/*
==================
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);
		}
	}
}
コード例 #3
0
ファイル: main.c プロジェクト: busmaster/homebus
/*-----------------------------------------------------------------------------
*  detect button release
*/
static void CheckButton(void) {
   uint8_t        i = 0;
   TButtonEvent buttonEventData;

   while (ButtonReleased(&i) == true) {
      if (ButtonGetReleaseEvent(i, &buttonEventData) == true) {
         ApplicationEventButton(&buttonEventData);
      }
   }
}
コード例 #4
0
ファイル: mymessagebox.cpp プロジェクト: Somefive/FlowFree
void MyMessageBox::rightButtonReleased()
{
    ButtonReleased(rightButton);
}
コード例 #5
0
ファイル: mymessagebox.cpp プロジェクト: Somefive/FlowFree
void MyMessageBox::leftButtonReleased()
{
    ButtonReleased(leftButton);
}