Skip to content

Commit

Permalink
add keyboard support to extended level info popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Dec 3, 2024
1 parent ed092fa commit 1f85fd1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/layers/ExtendedLevelInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,19 @@ CCLabelBMFont* ExtendedLevelInfo::createTextLabel(const std::string text, const
bmFont->setScale(scale);
menu->addChild(bmFont);
return bmFont;
}

void ExtendedLevelInfo::keyDown(enumKeyCodes key) {
switch(key) {
case KEY_Left:
case CONTROLLER_Left:
if(m_prevBtn->isVisible()) onPrev(nullptr);
break;
case KEY_Right:
case CONTROLLER_Right:
if(m_nextBtn->isVisible()) onNext(nullptr);
break;
default:
FLAlertLayer::keyDown(key);
}
}
1 change: 1 addition & 0 deletions src/layers/ExtendedLevelInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ class BI_DLL ExtendedLevelInfo : public CvoltonAlertLayerStub, public UploadDate
void setupAdditionalInfo();
bool init(GJGameLevel* level);
static cocos2d::CCLabelBMFont* createTextLabel(const std::string text, const cocos2d::CCPoint& position, const float scale, cocos2d::CCNode* menu, const char* font = "bigFont.fnt");
void keyDown(cocos2d::enumKeyCodes key);
};

0 comments on commit 1f85fd1

Please sign in to comment.