File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < Geode/Geode.hpp>
4+
5+ #define BLUR_TAG " thesillydoggo.blur-api/blur-options"
6+
7+ namespace BlurAPI
8+ {
9+ class BlurOptions : public cocos2d ::CCObject
10+ {
11+ public:
12+ int apiVersion = 1 ; // dont change
13+ cocos2d::CCRenderTexture* rTex = nullptr ;
14+ geode::Ref<cocos2d::CCClippingNode> clip = nullptr ;
15+ bool forcePasses = false ;
16+ int passes = 3 ;
17+ float alphaThreshold = 0 .01f ;
18+
19+ virtual bool init () { return true ; }
20+ CREATE_FUNC (BlurOptions);
21+ };
22+
23+ inline BlurOptions* getOptions (cocos2d::CCNode* node)
24+ {
25+ return static_cast <BlurOptions*>(node->getUserObject (BLUR_TAG));
26+ }
27+
28+ inline void addBlur (cocos2d::CCNode* node)
29+ {
30+ if (getOptions (node))
31+ return ;
32+
33+ node->setUserObject (BLUR_TAG, BlurOptions::create ());
34+ }
35+
36+ inline void removeBlur (cocos2d::CCNode* node)
37+ {
38+ node->setUserObject (BLUR_TAG, nullptr );
39+ }
40+
41+ inline bool isBlurAPIEnabled ()
42+ {
43+ if (auto blur = geode::Loader::get ()->getLoadedMod (" thesillydoggo.blur-api" ))
44+ {
45+ if (blur->getSettingValue <bool >(" enabled" ))
46+ return true ;
47+ }
48+
49+ return false ;
50+ }
51+
52+ inline bool willLoad ()
53+ {
54+ if (auto blur = geode::Loader::get ()->getInstalledMod (" thesillydoggo.blur-api" ))
55+ {
56+ if (blur->shouldLoad ())
57+ {
58+ return true ;
59+ }
60+ }
61+
62+ return false ;
63+ }
64+ };
Original file line number Diff line number Diff line change @@ -184,4 +184,11 @@ namespace horrible {
184184#define HORRIBLE_DELEGATE_HOOKS (optID ) \
185185 static void onModify (auto & self) { \
186186 horrible::delegateHooks (optID, self.m_hooks ); \
187+ }
188+
189+ #define HORRIBLE_REGISTER_OPTION_DEPENDENCY (opt, modId ) \
190+ $on_game(Loaded) { \
191+ if (Loader::get ()->isModLoaded (modId)) { \
192+ if (auto om = horrible::OptionManager::get ()) om->registerOption (opt); \
193+ }; \
187194 }
Original file line number Diff line number Diff line change 1+ #include < Utils.hpp>
2+
3+ #include < Geode/Geode.hpp>
4+
5+ #include < Geode/modify/PlayLayer.hpp>
6+ #include < BlurAPI.hpp>
7+ #include " Geode/cocos/layers_scenes_transitions_nodes/CCLayer.h"
8+
9+ using namespace geode ::prelude;
10+ using namespace horrible ::prelude;
11+
12+ inline static constexpr auto id = " blurry" ;
13+
14+ inline static Option const o = {
15+ id,
16+ " Blurry Game" ,
17+ " Makes the entire game blurry. I think you forgot your glasses.\n <cy>Required Blur API by the thesillydoggo mod installed.</c>\n <cl>Credit: ArcticWoof</c>" ,
18+ category::obstructive,
19+ SillyTier::Medium,
20+ };
21+ HORRIBLE_REGISTER_OPTION (o);
22+ HORRIBLE_REGISTER_OPTION_DEPENDENCY (o, " thesillydoggo.blur-api" );
23+
24+ class $modify(BlurPlayLayer, PlayLayer) {
25+ HORRIBLE_DELEGATE_HOOKS (id);
26+
27+ void setupHasCompleted () {
28+ PlayLayer::setupHasCompleted ();
29+
30+ auto colorLayer = CCLayerColor::create ({0 , 0 , 0 , 0 });
31+ colorLayer->setID (" blur-color-layer" _spr);
32+ colorLayer->setContentSize ({getScaledContentWidth (), getScaledContentHeight ()});
33+ colorLayer->setPosition ({0 , 0 });
34+ m_uiLayer->addChild (colorLayer, 98 );
35+ BlurAPI::addBlur (colorLayer);
36+ }
37+
38+ };
You can’t perform that action at this time.
0 commit comments