mirror of https://github.com/axmolengine/axmol.git
Merge branch 'master' of https://github.com/cocos2d/cocos2d-x
This commit is contained in:
commit
ca8dc4bc07
|
@ -41,6 +41,9 @@ public:
|
|||
|
||||
// The back key clicked
|
||||
virtual void keyBackClicked() {}
|
||||
|
||||
// The menu key clicked. only avialble on uphone & android
|
||||
virtual void keyMenuClicked() {};
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace cocos2d {
|
|||
typedef enum {
|
||||
// the back key clicked msg
|
||||
kTypeBackClicked = 1,
|
||||
kTypeMenuClicked,
|
||||
} ccKeypadMSGType;
|
||||
|
||||
struct _ccCArray;
|
||||
|
|
|
@ -154,7 +154,9 @@ bool CCKeypadDispatcher::dispatchKeypadMSG(ccKeypadMSGType nMsgType)
|
|||
case kTypeBackClicked:
|
||||
pDelegate->keyBackClicked();
|
||||
break;
|
||||
|
||||
case kTypeMenuClicked:
|
||||
pDelegate->keyMenuClicked();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -257,6 +257,11 @@ Boolean CCXEGLView::EventHandler(TApplication * pApp, EventType * pEvent)
|
|||
{
|
||||
bHandled = CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(kTypeBackClicked);
|
||||
}
|
||||
else if (pEvent->sParam1 == SYS_KEY_SOFTKEY_LEFT_UP ||
|
||||
pEvent->sParam1 == SYS_KEY_SOFTKEY_LEFT_LONG)
|
||||
{
|
||||
bHandled == CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(kTypeMenuClicked);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ KeypadTest::KeypadTest()
|
|||
setIsKeypadEnabled(true);
|
||||
|
||||
// create a label to display the tip string
|
||||
m_pLabel = CCLabel::labelWithString("Key Back Clicked!", "Arial", 22);
|
||||
m_pLabel = CCLabel::labelWithString("Please press any key...", "Arial", 22);
|
||||
m_pLabel->setPosition(ccp(s.width / 2, s.height / 2));
|
||||
addChild(m_pLabel, 0);
|
||||
m_pLabel->setIsVisible(false);
|
||||
// m_pLabel->setIsVisible(false);
|
||||
m_pLabel->retain();
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,16 @@ KeypadTest::~KeypadTest()
|
|||
|
||||
void KeypadTest::keyBackClicked()
|
||||
{
|
||||
m_pLabel->setIsVisible(m_bShow);
|
||||
m_bShow = !m_bShow;
|
||||
m_pLabel->setString("BACK clicked!");
|
||||
// m_pLabel->setIsVisible(m_bShow);
|
||||
// m_bShow = !m_bShow;
|
||||
}
|
||||
|
||||
void KeypadTest::keyMenuClicked()
|
||||
{
|
||||
m_pLabel->setString("MENU clicked!");
|
||||
// m_pLabel->setIsVisible(m_bShow);
|
||||
// m_bShow = !m_bShow;
|
||||
}
|
||||
|
||||
void KeypadTestScene::runThisTest()
|
||||
|
|
|
@ -11,6 +11,7 @@ public:
|
|||
~KeypadTest();
|
||||
|
||||
virtual void keyBackClicked();
|
||||
virtual void keyMenuClicked();
|
||||
|
||||
private:
|
||||
CCLabel* m_pLabel;
|
||||
|
|
Loading…
Reference in New Issue