本文整理汇总了C++中TouchButton类的典型用法代码示例。如果您正苦于以下问题:C++ TouchButton类的具体用法?C++ TouchButton怎么用?C++ TouchButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TouchButton类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: void
/**
*
* @param aPositionX
* @param aPositionY
* @param aWidthX if aWidthX == 0 render only text no background box
* @param aHeightY
* @param aButtonColor if 0 take sDefaultButtonColor
* @param aCaption
* @param aCaptionSize if aCaptionSize == 0 don't render anything, just check touch area -> transparent button ;-)
* @param aValue
* @param aOnTouchHandler
* @return pointer to allocated button
*/
TouchButton * TouchButton::allocAndInitButton(uint16_t aPositionX, uint16_t aPositionY, uint16_t aWidthX, uint16_t aHeightY,
uint16_t aButtonColor, const char * aCaption, uint8_t aCaptionSize, uint8_t aFlags, int16_t aValue,
void (*aOnTouchHandler)(TouchButton *, int16_t)) {
TouchButton * tButton;
if (aFlags & BUTTON_FLAG_TYPE_AUTOREPEAT) {
tButton = TouchButtonAutorepeat::allocAutorepeatButton();
} else {
tButton = allocButton(false);
}
tButton->mWidthX = aWidthX;
tButton->mHeightY = aHeightY;
tButton->mButtonColor = aButtonColor;
tButton->mCaptionColor = sDefaultCaptionColor;
tButton->mCaption = aCaption;
tButton->mCaptionSize = aCaptionSize;
tButton->mOnTouchHandler = aOnTouchHandler;
if (aFlags & BUTTON_FLAG_TYPE_AUTO_RED_GREEN) {
if (aValue != 0) {
// map to boolean
aValue = true;
tButton->mButtonColor = COLOR_GREEN;
} else {
tButton->mButtonColor = COLOR_RED;
}
}
tButton->mValue = aValue;
// keep internal flags set by allocButton()
tButton->mFlags = (aFlags & (~INTERNAL_FLAG_MASK)) | (tButton->mFlags & INTERNAL_FLAG_MASK);
tButton->setPosition(aPositionX, aPositionY);
return tButton;
}
开发者ID:ArminJo,项目名称:STMF3-Discovery-Demos,代码行数:48,代码来源:TouchButton.cpp
示例2: activateAllButtons
/**
* Static convenience method - activate all buttons
*/
void TouchButton::activateAllButtons() {
TouchButton * tObjectPointer = sButtonListStart;
// walk through list
while (tObjectPointer != NULL) {
tObjectPointer->activate();
tObjectPointer = tObjectPointer->mNextObject;
}
}
开发者ID:ArminJo,项目名称:STMF3-Discovery-Demos,代码行数:11,代码来源:TouchButton.cpp
示例3: getTouch
void DisplayClass::getTouch()
{
u8 i = 0;
TouchButton *pTryButton;
pTryButton = pDispButtons;
TouchedButtonIndex = END_BUT; // Use large value for non-index indication
HeldButtonIndex = END_BUT; // Use large value for non-index indication
Point p = pTS->getPoint();
if (p.z > __PRESURE) {
p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);
p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);
}
else {
p.x = 0;
p.y = 0;
#ifdef SKIP
Serial.print("p.x = "); Serial.print(p.x); Serial.print(" p.y = "); Serial.print(p.y);
Serial.println();
#endif
}
while (i < NumDispButtons) // check all the buttons
{
pTryButton->ProcessXY(p);
if (pTryButton->ButtonPressed())
{
TouchedButtonIndex = (SYS_BUTTONS)i;
#ifdef SKIP
Serial.print("TouchedButtonIndex = "); Serial.print(i);
Serial.println();
#endif
return; // take first button pressed found
}
if (pTryButton->ButtonHeld())
{
HeldButtonIndex = (SYS_BUTTONS)i;
#ifdef DEBUG
Serial.print(">>** HeldButtonIndex = "); Serial.print(i);
Serial.println();
#endif
return; // take first button pressed found
}
if (pTryButton->ButtonReleased())
{
ReleaseButtonIndex = (SYS_BUTTONS)i;
#ifdef SKIP
Serial.print("ReleaseButtonIndex = "); Serial.print(i);
Serial.println();
#endif
return; // take first button pressed found
}
pTryButton++;
i++;
}
// }
}
开发者ID:gunship13,项目名称:TStat01.10,代码行数:58,代码来源:Display.cpp
示例4: checkAllButtons
/**
* Static convenience method - checks all buttons for matching touch position.
*/
uint8_t TouchButton::checkAllButtons(unsigned int aTouchPositionX, unsigned int aTouchPositionY) {
// walk through list of active elements
TouchButton * tButtonPointer = sButtonListStart;
while (tButtonPointer != NULL) {
if ((tButtonPointer->mFlags & FLAG_IS_ACTIVE)
&& tButtonPointer->checkButton(aTouchPositionX, aTouchPositionY)) {
if (tButtonPointer->mFlags & BUTTON_FLAG_TYPE_AUTOREPEAT) {
return BUTTON_TOUCHED_AUTOREPEAT;
} else {
return BUTTON_TOUCHED;
}
}
tButtonPointer = tButtonPointer->mNextObject;
}
return NOT_TOUCHED;
}
开发者ID:ArminJo,项目名称:STMF3-Discovery-Demos,代码行数:19,代码来源:TouchButton.cpp
示例5: void
/**
*
* @param aPositionX
* @param aPositionY
* @param aWidthX if aWidthX == 0 render only text no background box
* @param aHeightY
* @param aButtonColor if 0 take sDefaultButtonColor
* @param aCaption
* @param aCaptionSize if aCaptionSize == 0 don't render anything, just check touch area -> transparent button ;-)
* @param aValue
* @param aOnTouchHandler
* @return pointer to allocated button
*/
TouchButton * TouchButton::allocAndInitSimpleButton(const uint16_t aPositionX, const uint16_t aPositionY, const uint16_t aWidthX,
const uint16_t aHeightY, const uint16_t aButtonColor, const char * aCaption, const uint8_t aCaptionSize,
const uint8_t aFlags, const int16_t aValue, void (*aOnTouchHandler)(TouchButton * const, int16_t)) {
TouchButton * tButton = allocButton(false);
tButton->mWidth = aWidthX;
tButton->mHeight = aHeightY;
tButton->mButtonColor = aButtonColor;
if (aButtonColor == 0) {
tButton->mButtonColor = sDefaultButtonColor;
}
tButton->mCaptionColor = sDefaultCaptionColor;
tButton->mCaption = aCaption;
tButton->mCaptionSize = aCaptionSize;
tButton->mOnTouchHandler = aOnTouchHandler;
tButton->mValue = aValue;
tButton->setPosition(aPositionX, aPositionY);
return tButton;
}
开发者ID:ledono,项目名称:touchscreen-apps,代码行数:32,代码来源:TouchButton.cpp
示例6: checkAllButtons
/**
* Static convenience method - checks all buttons for matching touch position.
*/
int TouchButton::checkAllButtons(const int aTouchPositionX, const int aTouchPositionY, const bool doCallback) {
TouchButton * tObjectPointer = sListStart;
// walk through list of active elements
while (tObjectPointer != NULL) {
if ((tObjectPointer->mFlags & FLAG_IS_ACTIVE)
&& tObjectPointer->checkButton(aTouchPositionX, aTouchPositionY, doCallback)) {
if (tObjectPointer->mFlags & FLAG_IS_AUTOREPEAT_BUTTON) {
sAutorepeatButtonTouched = true;
return BUTTON_TOUCHED_AUTOREPEAT;
}
sButtonTouched = true;
return BUTTON_TOUCHED;
}
tObjectPointer = tObjectPointer->mNextObject;
}
sAutorepeatButtonTouched = false;
sButtonTouched = false;
return NOT_TOUCHED;
}
开发者ID:ledono,项目名称:touchscreen-apps,代码行数:23,代码来源:TouchButton.cpp
示例7: LayoutGamepad
void LayoutGamepad(int w, int h)
{
float controlScale = g_Config.bLargeControls ? 1.6 : 1.15;
const int button_spacing = 50 * controlScale;
const int arrow_spacing = 40 * controlScale;
const int circleX = w - 40 * controlScale;
const int circleY = h - 120 * controlScale;
const int leftX = 40 * controlScale;
int leftY = h - 120 * controlScale;
if (g_Config.bShowAnalogStick) {
leftY = h - 250 * controlScale;
}
const int stickX = leftX + arrow_spacing;
const int stickY = h - 80 * controlScale;
const int halfW = w / 2;
buttonO.setPos(circleX, circleY, controlScale);
buttonX.setPos(circleX - button_spacing, circleY + button_spacing, controlScale);
buttonTri.setPos(circleX - button_spacing, circleY - button_spacing, controlScale);
buttonSq.setPos(circleX - button_spacing * 2, circleY, controlScale);
crossPad.setPos(leftX + arrow_spacing, leftY, 40, controlScale);
buttonSelect.setPos(halfW - button_spacing * 2, h - 20 * controlScale, controlScale);
buttonStart.setPos(halfW , h - 20 * controlScale, controlScale);
buttonTurbo.setPos(halfW + button_spacing * 2 , h - 20 * controlScale, controlScale);
buttonLShoulder.setPos(button_spacing + 10 * controlScale, 30 * controlScale, controlScale);
buttonRShoulder.setPos(w - button_spacing - 10 * controlScale, 30 * controlScale, controlScale);
#if defined(__SYMBIAN32__) || defined(IOS)
buttonPause.setPos(halfW, 15 * controlScale, controlScale);
#endif
leftStick.setPos(stickX, stickY, controlScale);
}
开发者ID:rodeoliba0007,项目名称:ppsspp,代码行数:42,代码来源:GamepadEmu.cpp
示例8: UpdateGamepad
void UpdateGamepad(InputState &input_state)
{
LayoutGamepad(dp_xres, dp_yres);
buttonO.update(input_state);
buttonX.update(input_state);
buttonTri.update(input_state);
buttonSq.update(input_state);
crossPad.update(input_state);
buttonSelect.update(input_state);
buttonStart.update(input_state);
buttonLShoulder.update(input_state);
buttonRShoulder.update(input_state);
buttonTurbo.update(input_state);
#if defined(__SYMBIAN32__) || defined(IOS)
buttonPause.update(input_state);
#endif
if (g_Config.bShowAnalogStick)
leftStick.update(input_state);
}
开发者ID:rodeoliba0007,项目名称:ppsspp,代码行数:24,代码来源:GamepadEmu.cpp
示例9: DrawGamepad
void DrawGamepad(DrawBuffer &db)
{
uint32_t color = 0xa0c0b080;
uint32_t colorOverlay = 0xa0FFFFFF;
buttonO.draw(db, color, colorOverlay);
buttonX.draw(db, color, colorOverlay);
buttonTri.draw(db, color, colorOverlay);
buttonSq.draw(db, color, colorOverlay);
crossPad.draw(db, color, colorOverlay);
buttonSelect.draw(db, color, colorOverlay);
buttonStart.draw(db, color, colorOverlay);
buttonLShoulder.draw(db, color, colorOverlay);
buttonRShoulder.draw(db, color, colorOverlay);
buttonTurbo.draw(db, color, colorOverlay);
#if defined(__SYMBIAN32__) || defined(IOS)
buttonPause.draw(db, color, colorOverlay);
#endif
if (g_Config.bShowAnalogStick)
leftStick.draw(db, color);
}
开发者ID:rodeoliba0007,项目名称:ppsspp,代码行数:24,代码来源:GamepadEmu.cpp
示例10: DrawGamepad
void DrawGamepad(DrawBuffer &db, float opacity)
{
uint32_t color = colorAlpha(0xc0b080, opacity);
uint32_t colorOverlay = colorAlpha(0xFFFFFF, opacity);
buttonO.draw(db, color, colorOverlay);
buttonX.draw(db, color, colorOverlay);
buttonTri.draw(db, color, colorOverlay);
buttonSq.draw(db, color, colorOverlay);
crossPad.draw(db, color, colorOverlay);
buttonSelect.draw(db, color, colorOverlay);
buttonStart.draw(db, color, colorOverlay);
buttonLShoulder.draw(db, color, colorOverlay);
buttonRShoulder.draw(db, color, colorOverlay);
if (g_Config.iFpsLimit)
buttonVPS.draw(db, color, colorOverlay);
else
buttonTurbo.draw(db, color, colorOverlay);
#if defined(__SYMBIAN32__) || defined(IOS) || defined(MEEGO_EDITION_HARMATTAN)
buttonPause.draw(db, color, colorOverlay);
#endif
if (g_Config.bShowAnalogStick)
leftStick.draw(db, color);
}
开发者ID:Darth1701,项目名称:ppsspp,代码行数:29,代码来源:GamepadEmu.cpp
示例11: DrawGamepad
void DrawGamepad(DrawBuffer &db)
{
uint32_t color = 0xa0c0b080;
uint32_t colorOverlay = 0xa0FFFFFF;
buttonO.draw(db, color, colorOverlay);
buttonX.draw(db, color, colorOverlay);
buttonTri.draw(db, color, colorOverlay);
buttonSq.draw(db, color, colorOverlay);
buttonLeft.draw(db, color, colorOverlay);
buttonUp.draw(db, color, colorOverlay);
buttonDown.draw(db, color, colorOverlay);
buttonRight.draw(db, color, colorOverlay);
buttonSelect.draw(db, color, colorOverlay);
buttonStart.draw(db, color, colorOverlay);
buttonLShoulder.draw(db, color, colorOverlay);
buttonRShoulder.draw(db, color, colorOverlay);
if (g_Config.bShowAnalogStick)
leftStick.draw(db, color);
}
开发者ID:ChrisAldama,项目名称:ppsspp,代码行数:22,代码来源:GamepadEmu.cpp
示例12: UpdateGamepad
void UpdateGamepad(InputState &input_state)
{
buttonO.update(input_state);
buttonX.update(input_state);
buttonTri.update(input_state);
buttonSq.update(input_state);
buttonLeft.update(input_state);
buttonUp.update(input_state);
buttonDown.update(input_state);
buttonRight.update(input_state);
buttonSelect.update(input_state);
buttonStart.update(input_state);
buttonLShoulder.update(input_state);
buttonRShoulder.update(input_state);
if (g_Config.bShowAnalogStick)
leftStick.update(input_state);
}
开发者ID:ChrisAldama,项目名称:ppsspp,代码行数:20,代码来源:GamepadEmu.cpp
示例13: LayoutGamepad
void LayoutGamepad(int w, int h)
{
const int button_spacing = 50;
const int arrow_spacing = 40;
const int circleX = w - 40;
const int circleY = h - 120;
const int leftX = 40;
int leftY = h - 120;
if (g_Config.bShowAnalogStick) {
leftY = h - 220;
}
const int stickX = leftX + arrow_spacing;
const int stickY = h - 80;
const int halfW = w / 2;
buttonO.setPos(circleX, circleY);
buttonX.setPos(circleX - button_spacing, circleY + button_spacing);
buttonTri.setPos(circleX - button_spacing, circleY - button_spacing);
buttonSq.setPos(circleX - button_spacing * 2, circleY);
buttonLeft.setPos(leftX, leftY);
buttonUp.setPos(leftX + arrow_spacing, leftY - arrow_spacing);
buttonDown.setPos(leftX + arrow_spacing, leftY + arrow_spacing);
buttonRight.setPos(leftX + arrow_spacing * 2, leftY);
buttonSelect.setPos(halfW - button_spacing, h - 20);
buttonStart.setPos(halfW + button_spacing, h - 20);
buttonLShoulder.setPos(button_spacing + 10, 15);
buttonRShoulder.setPos(w - button_spacing - 10, 15);
leftStick.setPos(stickX, stickY);
}
开发者ID:ChrisAldama,项目名称:ppsspp,代码行数:37,代码来源:GamepadEmu.cpp
注:本文中的TouchButton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论