-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LevelEditorLayer.cpp implemented and PlayLayer.cpp modified (#31)
* LevelEditorLayer.cpp implemented * Added background string ID to PlayLayer * Improved getting method for ShaderLayer in LevelEditorLayer * Revert change in PlayLayer
- Loading branch information
1 parent
a54b011
commit 022b566
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <Geode/Bindings.hpp> | ||
#include <Geode/modify/LevelEditorLayer.hpp> | ||
#include <Geode/utils/cocos.hpp> | ||
#include <Geode/utils/NodeIDs.hpp> | ||
|
||
#include "IDCheck.hpp" | ||
|
||
using namespace geode::prelude; | ||
using namespace geode::node_ids; | ||
|
||
$register_ids(LevelEditorLayer) { | ||
setIDSafe<GJEffectManager>(this, 0, "effect-manager"); | ||
|
||
if (auto shaderLayer = getChildOfType<ShaderLayer>(this, 0)) { | ||
setIDSafe(shaderLayer, 1, "main-node"); | ||
setIDSafe<CCSprite>(static_cast<CCNode*>(shaderLayer->getChildren()->objectAtIndex(1)), 0, "background"); | ||
} else { | ||
setIDSafe(this, 1, "main-node"); | ||
setIDSafe<CCSprite>(static_cast<CCNode*>(this->getChildren()->objectAtIndex(1)), 0, "background"); | ||
} | ||
} | ||
|
||
struct LevelEditorLayerIDs : Modify<LevelEditorLayerIDs, LevelEditorLayer> { | ||
static void onModify(auto& self) { | ||
if (!self.setHookPriority("LevelEditorLayer::init", GEODE_ID_PRIORITY)) { | ||
log::warn("Failed to set LevelEditorLayer::init hook priority, node IDs may not work properly"); | ||
} | ||
} | ||
|
||
bool init(GJGameLevel* level, bool p1) { | ||
if (!LevelEditorLayer::init(level, p1)) return false; | ||
|
||
NodeIDs::get()->provide(this); | ||
|
||
return true; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters