Skip to content

Commit

Permalink
call FLAlertLayer init in CvoltonAlertLayerStub (force prio fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jan 24, 2024
1 parent 82ec517 commit b2216fd
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/layers/LevelFiltering/CvoltonSearchOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void CvoltonSearchOptions::onPrev(cocos2d::CCObject* sender)
}

bool CvoltonSearchOptions::init(){
if(!CvoltonAlertLayerStub::init({440.0f, 290.0f}, 1.f, {0x00, 0x00, 0x00, 0x96})) return false;
if(!CvoltonAlertLayerStub::init({440.0f, 290.0f}, 1.f, 0x96)) return false;
m_closeBtn->setPositionX(m_closeBtn->getPositionX() + 0.5f);

auto winSize = CCDirector::sharedDirector()->getWinSize();
Expand Down
2 changes: 1 addition & 1 deletion src/layers/LevelFiltering/IDRangePopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void IDRangePopup::onClose(cocos2d::CCObject* sender)
}

bool IDRangePopup::init(IDRangeDelegate* delegate, int min, int max, const char* text, int additional){
if(!CvoltonAlertLayerStub::init({240.0f, 150.0f}, .8f, {0x00, 0x00, 0x00, 0x96})) return false;
if(!CvoltonAlertLayerStub::init({240.0f, 150.0f}, .8f, 0x96)) return false;

this->m_delegate = delegate;

Expand Down
2 changes: 1 addition & 1 deletion src/layers/LevelFiltering/ProfileSearchOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void ProfileSearchOptions::onSecondaryInfo(cocos2d::CCObject* sender){
}

bool ProfileSearchOptions::init(LevelBrowserLayer* levelBrowserLayer, const std::string& prefix, BISearchObjectDelegate* searchObjDelegate){
if(!CvoltonAlertLayerStub::init({440.0f, 290.0f}, 1.f, {0x00, 0x00, 0x00, 0x96})) return false;
if(!CvoltonAlertLayerStub::init({440.0f, 290.0f}, 1.f, 0x96)) return false;

m_columns = 3;
m_top = 96;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void ProfileSearchOptionsSongSelect::onClose(cocos2d::CCObject* sender)
}

bool ProfileSearchOptionsSongSelect::init(SongDialogCloseDelegate* delegate){
if(!CvoltonAlertLayerStub::init({240.0f, 150.0f}, .8f, {0x00, 0x00, 0x00, 0x96})) return false;
if(!CvoltonAlertLayerStub::init({240.0f, 150.0f}, .8f, 0x96)) return false;

m_delegate = delegate;

Expand Down
2 changes: 1 addition & 1 deletion src/layers/StarsInfoPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int StarsInfoPopup::completedLevelsForDifficulty(int difficulty, bool platformer
}

bool StarsInfoPopup::init(){
if(!CvoltonAlertLayerStub::init({380.0f, 210.0f}, 0.8f, {0x00, 0x00, 0x00, 0x4B}, 2)) return false;
if(!CvoltonAlertLayerStub::init({380.0f, 210.0f}, 0.8f, 0x4B, 2)) return false;
m_closeBtn->setVisible(false);

auto winSize = CCDirector::sharedDirector()->getWinSize();
Expand Down
20 changes: 5 additions & 15 deletions src/layers/_bases/CvoltonAlertLayerStub.cpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
#include "CvoltonAlertLayerStub.h"

bool CvoltonAlertLayerStub::init(CCPoint contentSize, float closeBtnScale, const ccColor4B &color, int squareNumber){
bool init = CCLayerColor::initWithColor(color);
bool CvoltonAlertLayerStub::init(CCPoint contentSize, float closeBtnScale, uint8_t alpha, int squareNumber){
bool init = FLAlertLayer::init(alpha);
if(!init) return false;

m_alertSize = contentSize;

CCDirector* director = CCDirector::sharedDirector();
//director->getTouchDispatcher()->incrementForcePrio(2);

setTouchEnabled(true);
setKeypadEnabled(true);

m_mainLayer = CCLayer::create();

this->addChild(m_mainLayer);

CCSize winSize = director->getWinSize();
extension::CCScale9Sprite* bg = extension::CCScale9Sprite::create(fmt::format("GJ_square{:02}.png", squareNumber).c_str(), { 0.0f, 0.0f, 80.0f, 80.0f });
auto winSize = CCDirector::sharedDirector()->getWinSize();
auto bg = CCScale9Sprite::create(fmt::format("GJ_square{:02}.png", squareNumber).c_str(), { 0.0f, 0.0f, 80.0f, 80.0f });
bg->setContentSize(m_alertSize);
m_mainLayer->addChild(bg, -1);
bg->setPosition({ winSize.width / 2, winSize.height / 2 });
bg->setID("background"_spr);
m_mainLayer->addChild(bg, -1);

m_buttonMenu = CCMenu::create();
m_buttonMenu->setID("button-menu"_spr);
Expand Down
2 changes: 1 addition & 1 deletion src/layers/_bases/CvoltonAlertLayerStub.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CvoltonAlertLayerStub : public FLAlertLayer {
CCPoint m_alertSize;
CCMenuItemSpriteExtra* m_closeBtn;

bool init(CCPoint contentSize, float closeBtnScale = 1, const ccColor4B& color = {0x00, 0x00, 0x00, 0x4B}, int squareNumber = 1);
bool init(CCPoint contentSize, float closeBtnScale = 1, uint8_t alpha = 0x4B, int squareNumber = 1);
void createTitle(std::string text, float separatorScale = .75f, float usernameScale = 1);
CCMenuItemSpriteExtra* createButton(const char* texture, CCPoint position, SEL_MenuHandler callback, float textureScale = 1.0f, float sizeMult = 1.2f);
void onCloseThunk(CCObject* sender);
Expand Down

0 comments on commit b2216fd

Please sign in to comment.