mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-23 03:15:58 -04:00
i forgot to add the LayerBG header
This commit is contained in:
parent
a38743d01d
commit
0a1b5c9281
2 changed files with 31 additions and 0 deletions
loader
13
loader/include/Geode/ui/LayerBG.hpp
Normal file
13
loader/include/Geode/ui/LayerBG.hpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode/DefaultInclude.hpp>
|
||||
#include <cocos2d.h>
|
||||
|
||||
namespace geode {
|
||||
/**
|
||||
* Creates the usual blue gradient BG for a layer. You should use this over
|
||||
* creating the sprite manually, as in the future we may provide texture
|
||||
* packs the ability to override this function.
|
||||
*/
|
||||
GEODE_DLL cocos2d::CCSprite* createLayerBG();
|
||||
}
|
18
loader/src/ui/nodes/LayerBG.cpp
Normal file
18
loader/src/ui/nodes/LayerBG.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <Geode/ui/LayerBG.hpp>
|
||||
|
||||
USE_GEODE_NAMESPACE();
|
||||
|
||||
CCSprite* geode::createLayerBG() {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
auto bg = CCSprite::create("GJ_gradientBG.png");
|
||||
auto bgSize = bg->getTextureRect().size;
|
||||
|
||||
bg->setAnchorPoint({ 0.0f, 0.0f });
|
||||
bg->setScaleX((winSize.width + 10.0f) / bgSize.width);
|
||||
bg->setScaleY((winSize.height + 10.0f) / bgSize.height);
|
||||
bg->setPosition({ -5.0f, -5.0f });
|
||||
bg->setColor({ 0, 102, 255 }); // todo: let mods customize this
|
||||
|
||||
return bg;
|
||||
}
|
Loading…
Reference in a new issue