Skip to content

Commit

Permalink
use cvoltonalertlayerstub for customlevelsearchlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jul 7, 2024
1 parent e36ed55 commit 06e0caa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 35 deletions.
35 changes: 2 additions & 33 deletions src/layers/CustomLevelSearchLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "CustomLevelSearchLayer.h"
#include "_bases/CvoltonAlertLayerStub.h"

using namespace geode::prelude;

Expand Down Expand Up @@ -62,42 +63,10 @@ void CustomLevelSearchLayer::onNeighbors(CCObject* sender) {
}

bool CustomLevelSearchLayer::init(GJGameLevel* level){
bool init = cocos2d::CCLayerColor::initWithColor({0x00, 0x00, 0x00, 0x4B});
if(!init) return false;
if(!CvoltonAlertLayerStub::init({360.f, 180.f})) return false;

this->m_level = level;

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

setTouchEnabled(true);
setKeypadEnabled(true);

cocos2d::CCSize winSize = director->getWinSize();
m_mainLayer = cocos2d::CCLayer::create();

this->addChild(m_mainLayer);

cocos2d::extension::CCScale9Sprite* bg = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", { 0.0f, 0.0f, 80.0f, 80.0f });
bg->setContentSize({ 360.0f, 180.0f });
m_mainLayer->addChild(bg, -1);
m_mainLayer->setID("main-layer"_spr);
bg->setPosition({ winSize.width / 2, winSize.height / 2 });

auto closeButton = CCMenuItemSpriteExtra::create(
CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png"),
this,
menu_selector(CustomLevelSearchLayer::onClose)
);

m_buttonMenu = CCMenu::create();
m_buttonMenu->setID("button-menu"_spr);
m_mainLayer->addChild(m_buttonMenu, 10);
m_buttonMenu->addChild(closeButton);
closeButton->setPosition({-170.5f, 79});
closeButton->setSizeMult(1.2f);
closeButton->setID("close-button"_spr);

auto searchTitle = CCLabelBMFont::create("Search", "bigFont.fnt");
searchTitle->setPosition({0,66});
searchTitle->setID("search-title"_spr);
Expand Down
4 changes: 2 additions & 2 deletions src/layers/CustomLevelSearchLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#include <Geode/Geode.hpp>
#include "../utils.hpp"
#include "_bases/CvoltonAlertLayerStub.h"

using namespace geode::prelude;

//TODO: use CvoltonAlertLayerStub
class BI_DLL CustomLevelSearchLayer : public FLAlertLayer {
class BI_DLL CustomLevelSearchLayer : public CvoltonAlertLayerStub {
Ref<GJGameLevel> m_level = nullptr;
public:
static CustomLevelSearchLayer* create(GJGameLevel* level);
Expand Down

0 comments on commit 06e0caa

Please sign in to comment.