mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
more getters for cocos2d managers + bump version 0.3.1 + some addresses
+ give IDs to everything in MenuLayer when the controller is connected
This commit is contained in:
parent
7edb547462
commit
7e6a46a9d4
13 changed files with 120 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||
|
||||
set(GEODE_VERSION 0.3.0)
|
||||
set(GEODE_VERSION 0.3.1)
|
||||
|
||||
project(geode-sdk VERSION ${GEODE_VERSION} LANGUAGES CXX C)
|
||||
|
||||
|
|
|
@ -2250,7 +2250,7 @@ class GJGarageLayer : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol,
|
|||
}
|
||||
|
||||
class GJGroundLayer : cocos2d::CCLayer {
|
||||
void updateGroundWidth() = mac 0x0, win 0x12dda0, ios 0x0;
|
||||
void updateGroundWidth() = mac 0x356790, win 0x12dda0, ios 0x0;
|
||||
}
|
||||
|
||||
class GJItemIcon {
|
||||
|
@ -4095,7 +4095,9 @@ class PlatformDownloadDelegate {
|
|||
class PlatformToolbox {
|
||||
static void hideCursor() = mac 0x27c340, win 0x0, ios 0x0;
|
||||
static void showCursor() = mac 0x27c360, win 0x0, ios 0x0;
|
||||
static bool isControllerConnected() = mac 0x27d1b0, win 0x0, ios 0x0;
|
||||
static bool isControllerConnected() {
|
||||
return cocos2d::CCApplication::sharedApplication()->getControllerConnected();
|
||||
}
|
||||
}
|
||||
|
||||
class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, DialogDelegate {
|
||||
|
@ -4565,7 +4567,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
|
|||
void updatePlayerBirdFrame(int) = mac 0x22bfe0, win 0x0, ios 0x0;
|
||||
void updatePlayerDartFrame(int) = mac 0x22c260, win 0x0, ios 0x0;
|
||||
void updatePlayerFrame(int) = mac 0x22c470, win 0x0, ios 0x0;
|
||||
void updatePlayerGlow() = mac 0x22bc50, win 0x0, ios 0x0;
|
||||
void updatePlayerGlow() = mac 0x22bc50, win 0x1f9290, ios 0x0;
|
||||
void updatePlayerRobotFrame(int) = mac 0x22d620, win 0x0, ios 0x0;
|
||||
void updatePlayerRollFrame(int) = mac 0x22c6a0, win 0x0, ios 0x0;
|
||||
void updatePlayerScale() = mac 0x22b8b0, win 0x0, ios 0x0;
|
||||
|
|
|
@ -137,9 +137,7 @@ public:
|
|||
}
|
||||
|
||||
GEODE_ADD(
|
||||
inline static CCDirector* get() {
|
||||
return CCDirector::sharedDirector();
|
||||
}
|
||||
static CCDirector* get();
|
||||
)
|
||||
|
||||
// attribute
|
||||
|
|
|
@ -49,6 +49,10 @@ public:
|
|||
@brief get the shared main open gl window
|
||||
*/
|
||||
static CCEGLView* sharedOpenGLView();
|
||||
|
||||
GEODE_ADD(
|
||||
static CCEGLView* get();
|
||||
);
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -49,6 +49,10 @@ public:
|
|||
virtual void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
static CCEGLView* sharedOpenGLView();
|
||||
|
||||
GEODE_ADD(
|
||||
static CCEGLView* get();
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,10 @@ class CC_DLL CCEGLView : public CCEGLViewProtocol
|
|||
public:
|
||||
static CCEGLView* sharedOpenGLView(void);
|
||||
|
||||
GEODE_ADD(
|
||||
static CCEGLView* get();
|
||||
);
|
||||
|
||||
virtual ~CCEGLView(void);
|
||||
|
||||
virtual bool isOpenGLReady(void);
|
||||
|
|
|
@ -30,6 +30,10 @@ public:
|
|||
*/
|
||||
static CCApplication* sharedApplication();
|
||||
|
||||
GEODE_ADD(
|
||||
static CCApplication* get();
|
||||
);
|
||||
|
||||
/* override functions */
|
||||
virtual void setAnimationInterval(double interval);
|
||||
virtual ccLanguageType getCurrentLanguage();
|
||||
|
|
|
@ -95,6 +95,11 @@ public:
|
|||
@brief get the shared main open gl window
|
||||
*/
|
||||
static CCEGLView* sharedOpenGLView();
|
||||
|
||||
GEODE_ADD(
|
||||
static CCEGLView* get();
|
||||
);
|
||||
|
||||
RT_ADD( static CCEGLView* create(const gd::string&); )
|
||||
|
||||
RT_ADD(
|
||||
|
|
|
@ -137,6 +137,10 @@ public:
|
|||
*/
|
||||
static CCEGLView* sharedOpenGLView();
|
||||
|
||||
GEODE_ADD(
|
||||
static CCEGLView* get();
|
||||
);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
|
|
@ -138,6 +138,10 @@ public:
|
|||
{}
|
||||
|
||||
public:
|
||||
GEODE_ADD(
|
||||
static CCTouchDispatcher* get();
|
||||
);
|
||||
|
||||
/** Whether or not the events are going to be dispatched. Default: true */
|
||||
bool isDispatchEvents(void);
|
||||
void setDispatchEvents(bool bDispatchEvents);
|
||||
|
|
|
@ -9,4 +9,20 @@ CCKeyboardDispatcher* CCKeyboardDispatcher::get() {
|
|||
return CCDirector::get()->getKeyboardDispatcher();
|
||||
}
|
||||
|
||||
CCTouchDispatcher* CCTouchDispatcher::get() {
|
||||
return CCDirector::sharedDirector()->getTouchDispatcher();
|
||||
}
|
||||
|
||||
CCApplication* CCApplication::get() {
|
||||
return CCApplication::sharedApplication();
|
||||
}
|
||||
|
||||
CCDirector* CCDirector::get() {
|
||||
return CCDirector::sharedDirector();
|
||||
}
|
||||
|
||||
CCEGLView* CCEGLView::get() {
|
||||
return CCDirector::sharedDirector()->getOpenGLView();
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
|
|
@ -29,6 +29,8 @@ private:
|
|||
|
||||
public:
|
||||
static GeodeNodeMetadata* set(CCNode* target) {
|
||||
if (!target) return nullptr;
|
||||
|
||||
auto old = target->m_pUserObject;
|
||||
// faster than dynamic_cast, technically can
|
||||
// but extremely unlikely to fail
|
||||
|
|
|
@ -141,12 +141,68 @@ class $modify(CustomMenuLayer, MenuLayer) {
|
|||
|
||||
Loader::get()->updateResourcePaths();
|
||||
|
||||
auto bottomMenuWithID = getChildOfType<CCMenu>(this, 1);
|
||||
bottomMenuWithID->setID("bottom-menu");
|
||||
auto setIDSafe = +[](CCNode* node, int index, const char* id) {
|
||||
if (auto child = getChild(node, index)) {
|
||||
child->setID(id);
|
||||
}
|
||||
};
|
||||
|
||||
// set IDs to everything
|
||||
this->setID("main-menu-layer");
|
||||
setIDSafe(this, 0, "main-menu-bg");
|
||||
getChildOfType<CCSprite>(this, 0)->setID("main-title");
|
||||
|
||||
if (CCApplication::get()->getControllerConnected()) {
|
||||
getChildOfType<CCSprite>(this, 1)->setID("play-gamepad-icon");
|
||||
getChildOfType<CCSprite>(this, 2)->setID("editor-gamepad-icon");
|
||||
getChildOfType<CCSprite>(this, 3)->setID("icon-kit-gamepad-icon");
|
||||
|
||||
getChildOfType<CCSprite>(this, 4)->setID("settings-gamepad-icon");
|
||||
getChildOfType<CCSprite>(this, 5)->setID("mouse-gamepad-icon");
|
||||
getChildOfType<CCSprite>(this, 6)->setID("click-gamepad-icon");
|
||||
|
||||
getChildOfType<CCLabelBMFont>(this, 0)->setID("mouse-gamepad-label");
|
||||
getChildOfType<CCLabelBMFont>(this, 1)->setID("click-gamepad-label");
|
||||
|
||||
getChildOfType<CCLabelBMFont>(this, 2)->setID("player-username");
|
||||
} else {
|
||||
getChildOfType<CCLabelBMFont>(this, 0)->setID("player-username");
|
||||
}
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("main-menu");
|
||||
setIDSafe(menu, 0, "play-button");
|
||||
setIDSafe(menu, 1, "icon-kit-button");
|
||||
setIDSafe(menu, 2, "editor-button");
|
||||
setIDSafe(menu, 3, "profile-button");
|
||||
}
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("bottom-menu");
|
||||
setIDSafe(menu, 0, "achievements-button");
|
||||
setIDSafe(menu, 1, "settings-button");
|
||||
setIDSafe(menu, 2, "stats-button");
|
||||
setIDSafe(menu, 3, "newgrounds-button");
|
||||
setIDSafe(menu, -1,"daily-chest-button");
|
||||
}
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
menu->setID("social-media-menu");
|
||||
setIDSafe(menu, 0, "robtop-logo-button");
|
||||
setIDSafe(menu, 1, "facebook-button");
|
||||
setIDSafe(menu, 2, "twitter-button");
|
||||
setIDSafe(menu, 3, "youtube-button");
|
||||
}
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 3)) {
|
||||
menu->setID("more-games-menu");
|
||||
setIDSafe(menu, 0, "more-games-button");
|
||||
setIDSafe(menu, 1, "close-button");
|
||||
}
|
||||
|
||||
auto winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// add geode button
|
||||
auto bottomMenu = static_cast<CCMenu*>(this->getChildByID("bottom-menu"));
|
||||
|
||||
auto chest = getChild(bottomMenu, -1);
|
||||
// keep chest in the same position
|
||||
auto chest = bottomMenu->getChildByID("daily-chest-button");
|
||||
if (chest) {
|
||||
chest->retain();
|
||||
chest->removeFromParent();
|
||||
|
@ -167,6 +223,7 @@ class $modify(CustomMenuLayer, MenuLayer) {
|
|||
auto btn = CCMenuItemSpriteExtra::create(
|
||||
g_geodeButton.data(), this, menu_selector(CustomMenuLayer::onGeode)
|
||||
);
|
||||
btn->setID("geode-button");
|
||||
bottomMenu->addChild(btn);
|
||||
|
||||
bottomMenu->alignItemsHorizontallyWithPadding(3.f);
|
||||
|
@ -179,6 +236,12 @@ class $modify(CustomMenuLayer, MenuLayer) {
|
|||
chest->release();
|
||||
}
|
||||
|
||||
if (auto node = this->getChildByID("settings-gamepad-icon")) {
|
||||
node->setPositionX(bottomMenu->getChildByID(
|
||||
"settings-button"
|
||||
)->getPositionX() + winSize.width / 2);
|
||||
}
|
||||
|
||||
// show if some mods failed to load
|
||||
auto failed = Loader::get()->getFailedMods();
|
||||
if (failed.size()) {
|
||||
|
|
Loading…
Reference in a new issue