diff --git a/src/layers/CustomCreatorLayer.cpp b/src/layers/CustomCreatorLayer.cpp index 6ee17c8..d6d33af 100644 --- a/src/layers/CustomCreatorLayer.cpp +++ b/src/layers/CustomCreatorLayer.cpp @@ -114,33 +114,6 @@ bool CustomCreatorLayer::init() { infoBtn->setSizeMult(1.2f); infoBtn->setID("bi-info-button"); - auto cornerBL = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); - cornerBL->setPosition({0,0}); - cornerBL->setAnchorPoint({0,0}); - addChild(cornerBL, -1); - cornerBL->setID("bi-corner-bl"); - - auto cornerUL = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); - cornerUL->setPosition({0,winSize.height}); - cornerUL->setAnchorPoint({0,0}); - cornerUL->setRotation(90); - cornerUL->setID("bi-corner-ul"); - addChild(cornerUL, -1); - - auto cornerUR = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); - cornerUR->setPosition({winSize.width,winSize.height}); - cornerUR->setAnchorPoint({0,0}); - cornerUR->setRotation(180); - cornerUR->setID("bi-corner-ur"); - addChild(cornerUR, -1); - - auto cornerBR = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); - cornerBR->setPosition({winSize.width,0}); - cornerBR->setAnchorPoint({0,0}); - cornerBR->setRotation(270); - cornerBR->setID("bi-corner-br"); - addChild(cornerBR, -1); - return true; } diff --git a/src/layers/_bases/BIBaseLayer.cpp b/src/layers/_bases/BIBaseLayer.cpp index 7dcd0b6..7adbd63 100644 --- a/src/layers/_bases/BIBaseLayer.cpp +++ b/src/layers/_bases/BIBaseLayer.cpp @@ -1,8 +1,8 @@ #include "BIBaseLayer.h" -BIBaseLayer* BIBaseLayer::create() { +BIBaseLayer* BIBaseLayer::create(bool BL, bool BR, bool TL, bool TR) { auto ret = new BIBaseLayer(); - if (ret && ret->init()) { + if (ret && ret->init(BL, BR, TL, TR)) { ret->autorelease(); } else { delete ret; @@ -11,7 +11,7 @@ BIBaseLayer* BIBaseLayer::create() { return ret; } -bool BIBaseLayer::init() { +bool BIBaseLayer::init(bool BL, bool BR, bool TL, bool TR) { auto backgroundSprite = CCSprite::create("game_bg_14_001.png"); auto winSize = CCDirector::sharedDirector()->getWinSize(); @@ -37,13 +37,48 @@ bool BIBaseLayer::init() { menuBack->addChild(backBtn); menuBack->setPosition({25, winSize.height - 25}); + m_cornerBL = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); + m_cornerBL->setPosition({0,0}); + m_cornerBL->setAnchorPoint({0,0}); + addChild(m_cornerBL, -1); + m_cornerBL->setID("bi-corner-bl"); + + m_cornerTL = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); + m_cornerTL->setPosition({0,winSize.height}); + m_cornerTL->setAnchorPoint({0,0}); + m_cornerTL->setRotation(90); + m_cornerTL->setID("bi-corner-ul"); + addChild(m_cornerTL, -1); + + m_cornerTR = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); + m_cornerTR->setPosition({winSize.width,winSize.height}); + m_cornerTR->setAnchorPoint({0,0}); + m_cornerTR->setRotation(180); + m_cornerTR->setID("bi-corner-ur"); + addChild(m_cornerTR, -1); + + m_cornerBR = CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png"); + m_cornerBR->setPosition({winSize.width,0}); + m_cornerBR->setAnchorPoint({0,0}); + m_cornerBR->setRotation(270); + m_cornerBR->setID("bi-corner-br"); + addChild(m_cornerBR, -1); + addChild(menuBack); setKeypadEnabled(true); + setCorners(BL, BR, TL, TR); return true; } +void BIBaseLayer::setCorners(bool BL, bool BR, bool TL, bool TR) { + m_cornerBL->setVisible(BL); + m_cornerBR->setVisible(BR); + m_cornerTL->setVisible(TL); + m_cornerTR->setVisible(TR); +} + void BIBaseLayer::keyBackClicked() { CCDirector::sharedDirector()->popSceneWithTransition(0.5f, PopTransition::kPopTransitionFade); } @@ -53,8 +88,8 @@ void BIBaseLayer::onBack(CCObject* object) { keyBackClicked(); } -CCScene* BIBaseLayer::scene() { - auto layer = BIBaseLayer::create(); +CCScene* BIBaseLayer::scene(bool BL, bool BR, bool TL, bool TR) { + auto layer = BIBaseLayer::create(BL, BR, TL, TR); auto scene = CCScene::create(); scene->addChild(layer); return scene; diff --git a/src/layers/_bases/BIBaseLayer.h b/src/layers/_bases/BIBaseLayer.h index 33855bb..6790122 100644 --- a/src/layers/_bases/BIBaseLayer.h +++ b/src/layers/_bases/BIBaseLayer.h @@ -6,10 +6,16 @@ using namespace geode::prelude; class BIBaseLayer : public cocos2d::CCLayer { protected: - virtual bool init(); + virtual bool init(bool TL = true, bool TR = true, bool BL = true, bool BR = true); virtual void keyBackClicked(); void onBack(cocos2d::CCObject*); public: - static BIBaseLayer* create(); - static cocos2d::CCScene* scene(); + static BIBaseLayer* create(bool TL = true, bool TR = true, bool BL = true, bool BR = true); + static cocos2d::CCScene* scene(bool TL = true, bool TR = true, bool BL = true, bool BR = true); + void setCorners(bool TL, bool TR, bool BL, bool BR); + + CCSprite* m_cornerBL = nullptr; + CCSprite* m_cornerBR = nullptr; + CCSprite* m_cornerTL = nullptr; + CCSprite* m_cornerTR = nullptr; }; \ No newline at end of file diff --git a/src/layers/_bases/BIViewLayer.cpp b/src/layers/_bases/BIViewLayer.cpp index 6e533f3..e91d30a 100644 --- a/src/layers/_bases/BIViewLayer.cpp +++ b/src/layers/_bases/BIViewLayer.cpp @@ -14,7 +14,7 @@ BIViewLayer* BIViewLayer::create(bool paginated) { } bool BIViewLayer::init(bool paginated) { - BIBaseLayer::init(); + BIBaseLayer::init(true, true, false, false); m_paginated = paginated;