Skip to content

Commit

Permalink
scale fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyAdd committed Nov 27, 2024
1 parent a9ad615 commit d20939a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ void Gui::Render() {
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::Combo("##Menu scale", &m_index_scale, items, IM_ARRAYSIZE(items))) {
m_scale = float(atof(items[m_index_scale])) / 100.0f;
config.set<float>("gui_scale", m_scale);
config.set<int>("gui_index_scale", m_index_scale);
m_needRescale = true;
ImGuiCocos::get().reload();
}
Expand Down Expand Up @@ -207,6 +209,10 @@ void Gui::Init() {
auto &config = Config::get();

stretchedWindows.clear();

m_scale = config.get<float>("gui_scale", 1.f);
m_index_scale = config.get<int>("gui_index_scale", 7);

ApplyGuiColors(config.get("gui_inverted", false));
ApplyColor(themes[config.get<int>("gui_color_index", 0)]);
ApplyStyle(m_scale);
Expand Down
4 changes: 3 additions & 1 deletion src/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class $modify(PlayLayer) {
auto label = cocos2d::CCLabelBMFont::create(fmt::format("{}/{}", selectedStartpos+1, startPositions.size()).c_str(), "bigFont.fnt");
label->setScale(0.5f);
label->setPosition(win_size.width/2, 20.f);
label->setOpacity(100);
label->setID("startposSwitcherLabels"_spr);

auto left_arrow = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png");
Expand All @@ -107,13 +108,14 @@ class $modify(PlayLayer) {
label->setCString(fmt::format("{}/{}", selectedStartpos+1, startPositions.size()).c_str());
});
right_arrowClick->setPosition(win_size.width/2 + 50, cocos2d::CCDirector::sharedDirector()->getScreenBottom() + right_arrowClick->getScaledContentHeight());
right_arrowClick->setOpacity(100);
right_arrowClick->setID("startpos_switcher_rightArrowClick"_spr);


m_fields->startposSwitcherUI = cocos2d::CCMenu::create();
m_fields->startposSwitcherUI->setID("startposSwitcherUI"_spr);
m_fields->startposSwitcherUI->setPosition(0, 0);
m_fields->startposSwitcherUI->setZOrder(999);
m_fields->startposSwitcherUI->setOpacity(100);

m_fields->startposSwitcherUI->addChild(left_arrowClick);
m_fields->startposSwitcherUI->addChild(right_arrowClick);
Expand Down

0 comments on commit d20939a

Please sign in to comment.