Example #1
0
void Button::OnLoop()
{
	if (_slowActivation == false)
		return;

	if (_animationOn == false)
		return;

	if (System::GetTimeInSec() - _timestampSec < 0.2) {
		// New event within threshold - Move forward with animation
		if (_isActivated)
			_offset -= _stepSize;
		else
			_offset += _stepSize;
	}
	else {
		// No event within threshold - Move backward with animation
		if (_isActivated)
			_offset += _stepSize;
		else
			_offset -= _stepSize;
	}

	// Check if activation / de-activation limits have been reached
	if (_offset <= 0) {
		_offset = 0;
		_animationOn = false;
		ButtonClick();
	}
	if (_offset >= width) {
		_offset = width;
		_animationOn = false;
		ButtonClick();
	}
}
Example #2
0
void Button::HandleHit(TT_touch_state_t &event)
{
	if (_slowActivation) {
		if (_animationOn == false && System::GetTimeInSec() - _timestampSec < 1.0)
			// Wait time after a button has been clicked
			return;
		_animationOn = true;
		_timestampSec = System::GetTimeInSec();//(double)event.timestampSec;
	} else {
		ButtonClick();
	}
}
Example #3
0
		void update() override
		{
			//追加
			auto btnobj = ci_ext::weak_to_shared<Button>(p_playbtns);
			btnobj->ButtonClick("menu_play", 640, 300, playflag);
			auto btnobj2 = ci_ext::weak_to_shared<Button>(p_otherbtns);
			btnobj2->ButtonClick("menu_other", 640, 400, otherflag);
			auto btnobj3 = ci_ext::weak_to_shared<Button>(p_optionbtns);
			btnobj3->ButtonClick("menu_option", 640, 500, optionflag);

			if (playflag==true)
			{
				insertToParent(new game::CSceneStage("scene_stage"));		//ここにイベントを記述
				kill();
			}
			//

			if (gplib::input::CheckPush(gplib::input::KEY_BTN0))
			{
				//effect::Create(0, 0, effect::EFFECTTYPE::FADEOUTWHITE);
				sleep(5);	
			}
		}
Example #4
0
		void update() override
		{
			//追加
			auto btnobj = ci_ext::weak_to_shared<Button>(p_btns);
			btnobj->ButtonClick("start", 640, 300, btnflag);
			if (btnflag==true)
			{
				insertToParent(new game::Menu("scene_stage"));		//ここにイベントを記述
				kill();
			}
			//

			if (gplib::input::CheckPush(gplib::input::KEY_BTN0))
			{
				//effect::Create(0, 0, effect::EFFECTTYPE::FADEOUTWHITE);
				sleep(5);	
			}
		}
Example #5
0
void RtKeyButton::ButtonClicked()
{
    if(!m_bIsScroll)
        emit ButtonClick(m_iListIndex);
}
Example #6
0
/*---------------------------------------------------------------------------*
 * Routine:  TestModeTouchscreenProcedure
 *---------------------------------------------------------------------------*
 * Description:
 *      Step the user through the calibration process.  A target is shown
 *      at each of 3 locations and waits for the user to touch the
 *      target.
 * Inputs:
 *      TUInt16 *aPixels            -- Pointer to pixel memory
 *      TUInt16 aX, aY              -- Coordinate of target to draw
 *---------------------------------------------------------------------------*/
void TestModeTouchscreenProcedure(
                T_pixelColor *aPixels,
                T_uezDevice ts)
{
    static const T_uezTSReading G_coord[5] = {
        { 0,    0+TP_INSET,                 TP_INSET,                   1 }, // 0
        { 0,    DISPLAY_WIDTH-TP_INSET,     TP_INSET,                   1 }, // 1
        { 0,    0+TP_INSET,                 DISPLAY_HEIGHT-TP_INSET,    1 }, // 2
        { 0,    DISPLAY_WIDTH-TP_INSET,     DISPLAY_HEIGHT-TP_INSET,    1 }, // 3
        { 0,    DISPLAY_WIDTH/2,            DISPLAY_HEIGHT/2,           1 }, // 4
    };

    // List of expected results (based on a single screen)
#if ((UEZ_DEFAULT_LCD_CONFIG==LCD_CONFIG_SHARP_LQ043T3DG01) || (UEZ_DEFAULT_LCD_CONFIG==LCD_CONFIG_SHARP_LQ043T1DG28))
    static const T_uezTSReading G_expectedReadings[5] = {
        { 0,    0x13f6,                     0x58ec,                     1 }, // 0
        { 0,    0x6aa3,                     0x58f0,                     1 }, // 1
        { 0,    0x12d8,                     0x22cd,                     1 }, // 2
        { 0,    0x6616,                     0x1f62,                     1 }, // 3
        { 0,    0x3f47,                     0x3de0,                     1 }, // 4
    };
#elif (UEZ_DEFAULT_LCD_CONFIG==LCD_CONFIG_INTELTRONIC_LMIX0560NTN53V1)
    static const T_uezTSReading G_expectedReadings[5] = {
        { 0,    0x6D64,                     0x62F8,                     1 }, // 0
        { 0,    0x0F3A,                     0x63D7,                     1 }, // 1
        { 0,    0x6BFD,                     0x1B4B,                     1 }, // 2
        { 0,    0x0F6D,                     0x1880,                     1 }, // 3
        { 0,    0x3CC8,                     0x3C98,                     1 }, // 4
    };
#elif ((UEZ_DEFAULT_LCD_CONFIG==LCD_CONFIG_SEIKO_70WVW2T))
    static const T_uezTSReading G_expectedReadings[5] = {
        { 0,    0x6F1C,                     0x620D,                     1 }, // 0
        { 0,    0x118B,                     0x628A,                     1 }, // 1
        { 0,    0x6F01,                     0x1BF4,                     1 }, // 2
        { 0,    0x11D7,                     0x1BFB,                     1 }, // 3
        { 0,    0x4036,                     0x3F62,                     1 }, // 4
    };
#elif (UEZ_DEFAULT_LCD_CONFIG==LCD_CONFIG_TIANMA_TM070RBHG04)
        static const T_uezTSReading G_expectedReadings[5] = {
        { 0,    0x0C04,                     0x204C,                     1 }, // 0
        { 0,    0x6F2A,                     0x2134,                     1 }, // 1
        { 0,    0x0C58,                     0x6012,                     1 }, // 2
        { 0,    0x6F2C,                     0x5DBA,                     1 }, // 3
        { 0,    0x3C6A,                     0x4098,                     1 }, // 4
    };
#elif (UEZ_DEFAULT_LCD_CONFIG == LCD_CONFIG_MICROTIPS_UMSH_8596MD_20T)
    //TODO : update numbers
            static const T_uezTSReading G_expectedReadings[5] = {
        { 0,    0x0C04,                     0x204C,                     1 }, // 0
        { 0,    0x6F2A,                     0x2134,                     1 }, // 1
        { 0,    0x0C58,                     0x6012,                     1 }, // 2
        { 0,    0x6F2C,                     0x5DBA,                     1 }, // 3
        { 0,    0x3C6A,                     0x4098,                     1 }, // 4
    };
#endif

    // The raw X range is 0x560A (left) to 0x2908 (right)
    //      100% = 0x2D02
    //       20% = 0x0900
    //       10% = 0x0480
    // The raw Y range is 0x5A7A (top) to 0x24A1 (bottom)
    //      100% = 0x35D9
    //       20% = 0x0AC5
    //       10% = 0x0562
    #define READING_X_TOLERANCE         0x0900
    #define READING_Y_TOLERANCE         0x0AC5

    T_uezTSReading readings[5];
    T_uezTSReading reading;
    T_uezTSReading sum;
    TUInt32 count;
    int i;
    T_uezError error;
    TBool sawNoTouch;
    TUInt32 timeoutCount=0;
    TUInt32 timeoutStart;

    G_mmTestModeTouchscreenCalibrationValid = EFalse;
    while (1) {
        // Put the touch screen into calibration mode
        UEZTSCalibrationStart(ts);

        // Clear the screen
        //CalibrateScreen();

        // Show 5 different targets
        timeoutStart = UEZTickCounterGet();
        for (i=0; i<5; i++)  {
            // Make sure we see the screen is not being touched
            // when we start.  This ensures if the unit is being held at power
            // up that we don't go into calibration and get a bogus
            // starting reading.
            sawNoTouch = EFalse;

            // Show target to touch
            IDrawTarget(aPixels, G_coord[i].iX, G_coord[i].iY);

            // Wait for the pen to touch (while not in test mode)
            for (;;) {
                sum.iX = 0;
                sum.iY = 0;

                for (count=0; count<4; ) {
                    if (UEZTSGetReading(ts, &reading)==UEZ_ERROR_NONE)  {
                        if (reading.iFlags & TSFLAG_PEN_DOWN)  {
                            // Only accept reading if we originally
                            // were not touching the screen.
                            if (sawNoTouch) {
                                sum.iX += reading.iX;
                                sum.iY += reading.iY;
                                count++;
                                timeoutStart = UEZTickCounterGet();
                                timeoutCount = 0;
                            }
                        } else {
                            sawNoTouch = ETrue;
                            // Reset the timeout
                            timeoutStart = UEZTickCounterGet();
                            timeoutCount = 0;
                        }
                    }
                    if (!sawNoTouch) {
                        timeoutCount = UEZTickCounterGet() - timeoutStart;
                        if (timeoutCount > 10000)
                            break;
                    }
                    UEZTaskDelay(50);
                }
                reading.iX = sum.iX/count;
                reading.iY = sum.iY/count;

                // Remember this reading
                readings[i] = reading;

                if (i < 3) {
                    // If one of the first 3 points, store the data
                    UEZTSCalibrationAddReading(ts, &reading, &G_coord[i]);
                    G_nonvolatileSettings.iReadings[i] = reading;
                    G_nonvolatileSettings.iNum = i+1;
                }
                ButtonClick();
                break;
            }

            // Erase target to signal the user touched the target
            IEraseTarget(aPixels, G_coord[i].iX, G_coord[i].iY);

            if (timeoutCount < 10000) {
                // Wait for the pen to lift
                timeoutCount = 0;
                for (;;) {
                    if (UEZTSGetReading(ts, &reading)==UEZ_ERROR_NONE)  {
                        if (!(reading.iFlags & TSFLAG_PEN_DOWN))  {
                            break;
                        }
                    }
                    UEZTaskDelay(50);
                    timeoutCount += 50;
                    if (timeoutCount >= 10000)
                        break;
                }
            }
        }

        // Calibration is complete.  Put the new calibration into effect.
        error = UEZTSCalibrationEnd(ts);
        if (timeoutCount >= 10000)
            error = UEZ_ERROR_TIMEOUT;


        // Determine if this is valid or not
        if (error) {
            G_mmTestModeTouchscreenCalibrationValid = EFalse;
        } else {
            // Check the validity of the readings
            G_mmTestModeTouchscreenCalibrationValid = ETrue;
            for (i=0; i<5; i++) {
                if ((readings[i].iX < G_expectedReadings[i].iX-READING_X_TOLERANCE) ||
                        (readings[i].iX > G_expectedReadings[i].iX+READING_X_TOLERANCE)) {
                    // Outside along X
                    G_mmTestModeTouchscreenCalibrationValid = EFalse;
                    break;
                }
                if ((readings[i].iY < G_expectedReadings[i].iY-READING_Y_TOLERANCE) ||
                        (readings[i].iY > G_expectedReadings[i].iY+READING_Y_TOLERANCE)) {
                    // Outside along Y
                    G_mmTestModeTouchscreenCalibrationValid = EFalse;
                    break;
                }
            }
        }

        NVSettingsSave();
        break;
    }
}
Example #7
0
static void down_click_handler(ClickRecognizerRef recognizer, void *context) {
  //startTimer(s_duration3);
  ButtonClick(BOTTOM);
}
Example #8
0
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
  //startTimer(s_duration2);
  ButtonClick(MIDDLE);
}
Example #9
0
static void up_click_handler(ClickRecognizerRef recognizer, void *context) {
  //startTimer(s_duration1);
  ButtonClick(TOP);
}
Example #10
0
void SectionBar::MousePress( Control& /*sender*/, const pcl::Point& /*pos*/,
                             int mouseButton, unsigned /*buttons*/, unsigned /*modifiers*/ )
{
   if ( mouseButton == MouseButton::Left )
      ButtonClick( Title_ToolButton, false );
}