new node utility functions

This commit is contained in:
HJfod 2022-04-26 22:35:44 +03:00
parent ac792bae31
commit 27937b5144

View file

@ -45,4 +45,27 @@ namespace geode::cocos {
* Origin will be <= 0 and size will be >= 0
*/
GEODE_DLL cocos2d::CCRect calculateChildCoverage(cocos2d::CCNode* parent);
/**
* Rescale node to fit inside given size
* @param node Node to rescale
* @param size Size to fit inside
* @param def Default size
* @param min Minimum size
*/
GEODE_DLL void limitNodeSize(
cocos2d::CCNode* node,
cocos2d::CCSize const& size,
float def,
float min
);
/**
* Checks if a node is visible (recursively
* checks parent visibility)
* @param node Node to check if visible
* @returns True if node is visibile. Does
* not take into account if node is off-screen
*/
GEODE_DLL bool nodeIsVisible(cocos2d::CCNode* node);
}