CCEGLView::getDisplaySize and other bindings

This commit is contained in:
hjfod 2023-02-13 18:31:32 +02:00
parent cb1a6f15ee
commit 5a1545ebc1
3 changed files with 31 additions and 13 deletions

View file

@ -2818,7 +2818,7 @@ class GameManager : GManager {
void getGTexture(int) = mac 0x1cca40, win 0xc9a50;
virtual bool init() = mac 0x1c2ec0, win 0xc4ad0;
void reportAchievementWithID(char const*, int, bool) = mac 0x1c6460, win 0xc64c0;
cocos2d::CCSize* resolutionForKey(cocos2d::CCSize*, int) = mac 0x1d0b40, win 0xceca0;
cocos2d::CCSize resolutionForKey(int) = mac 0x1d0b40, win 0xceca0;
virtual void update(float) = mac 0x1d0270, win 0xce440;
bool isColorUnlocked(int _id, bool _type) = mac 0x1c3b90, win 0xc53f0;
bool isIconUnlocked(int _id, IconType _type) = mac 0x1c35b0, win 0xc4fc0;

View file

@ -96,18 +96,35 @@ public:
*/
static CCEGLView* sharedOpenGLView();
/**
* @note Geode addition
*/
static GEODE_DLL CCEGLView* get();
RT_ADD( static CCEGLView* create(const gd::string&); )
/**
* @note RobTop addition
*/
static CCEGLView* create(const gd::string&);
RT_ADD(
//actually this is my function but i dont wanna make a new macro for it
/**
* @note Geode addition
*/
inline CCPoint getMousePosition() { return { m_fMouseX, m_fMouseY }; }
/**
* @note RobTop addition
*/
void toggleFullScreen(bool fullscreen);
/**
* @note RobTop addition
*/
GLFWwindow* getWindow(void) const;
)
/**
* @note RobTop addition
*/
CCSize getDisplaySize();
protected:
static CCEGLView* s_pEglView;

View file

@ -12,7 +12,6 @@ $register_ids(EditorUI) {
setIDSafe(this, this->getChildrenCount() - 1, "object-info-label");
auto winSize = CCDirector::get()->getWinSize();
auto topMenuWidth = winSize.width / 2 - 90.f;
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
menu->setID("toolbar-categories-menu");
@ -64,6 +63,7 @@ $register_ids(EditorUI) {
toolbarTogglesMenu->setContentSize({ 100.f, 100.f });
toolbarTogglesMenu->updateLayout();
auto undoMenuWidth = winSize.width / 2 - 90.f;
auto undoMenu = detachAndCreateMenu(
this,
"undo-menu",
@ -74,9 +74,9 @@ $register_ids(EditorUI) {
menu->getChildByID("redo-button"),
menu->getChildByID("delete-trash-button")
);
undoMenu->setContentSize({ topMenuWidth, 50.f });
undoMenu->setContentSize({ undoMenuWidth, 50.f });
undoMenu->setPositionX(
undoMenu->getPositionX() + topMenuWidth / 2 -
undoMenu->getPositionX() + undoMenuWidth / 2 -
getSizeSafe(undoMenu->getChildByID("undo-button")).width / 2
);
undoMenu->updateLayout();
@ -244,6 +244,7 @@ $register_ids(EditorUI) {
"all-layers-button"
);
auto topRightMenuWidth = winSize.width / 2 - 140.f;
auto topRightMenu = detachAndCreateMenu(
this,
"settings-menu",
@ -253,9 +254,9 @@ $register_ids(EditorUI) {
menu->getChildByID("pause-button"),
menu->getChildByID("settings-button")
);
topRightMenu->setContentSize({ topMenuWidth, 60.f });
topRightMenu->setContentSize({ topRightMenuWidth, 60.f });
topRightMenu->setPositionX(
topRightMenu->getPositionX() - topMenuWidth / 2 +
topRightMenu->getPositionX() - topRightMenuWidth / 2 +
getSizeSafe(topRightMenu->getChildByID("pause-button")).width / 2
);
topRightMenu->updateLayout();