diff --git a/Common/UI/View.h b/Common/UI/View.h index 190da0b115..87941167cc 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -903,6 +903,18 @@ public: void GetContentDimensions(const UIContext &dc, float &w, float &h) const override { w = size_; h = size_; } + + void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override { + if (horiz.type == AT_MOST || horiz.type == EXACTLY) + w = horiz.size; + else + w = size_; + if (vert.type == AT_MOST || vert.type == EXACTLY) + h = vert.size; + else + h = size_; + } + void Draw(UIContext &dc) override {} std::string DescribeText() const override { return ""; } diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 229ef82062..b78781f20f 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -25,7 +25,7 @@ namespace UI { static constexpr Size ITEM_HEIGHT = 64.f; -void ApplyGravity(const Bounds outer, const Margins &margins, float w, float h, int gravity, Bounds &inner) { +void ApplyGravity(const Bounds &outer, const Margins &margins, float w, float h, int gravity, Bounds &inner) { inner.w = w; inner.h = h; @@ -495,6 +495,10 @@ void LinearLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v if (views_.empty()) return; + if (tag_ == "debug") { + tag_ = "debug"; + } + float sum = 0.0f; float maxOther = 0.0f; float totalWeight = 0.0f; @@ -666,6 +670,10 @@ void LinearLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v void LinearLayout::Layout() { const Bounds &bounds = bounds_; + if (tag_ == "debug") { + tag_ = "debug"; + } + Bounds itemBounds; float pos; diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index bf329710eb..c94f9abcd7 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -356,8 +356,12 @@ void GamePauseScreen::CreateViews() { leftColumnItems->Add(new NoticeView(NoticeLevel::INFO, notAvailable, "")); } - ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(vertical ? 200 : 300, FILL_PARENT, actionMenuMargins)); - root_->Add(rightColumn); + ViewGroup *rightColumnHolder = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(vertical ? 200 : 300, FILL_PARENT, actionMenuMargins)); + + ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); + rightColumnHolder->Add(rightColumn); + + root_->Add(rightColumnHolder); LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL); rightColumn->Add(rightColumnItems); @@ -414,8 +418,17 @@ void GamePauseScreen::CreateViews() { } else { rightColumnItems->Add(new Choice(pa->T("Exit to menu")))->OnClick.Handle(this, &GamePauseScreen::OnExitToMenu); } - rightColumnItems->Add(new Spacer(25.0f)); - rightColumnItems->Add(new CheckBox(&g_Config.bRunBehindPauseMenu, "Run Behind")); + + ViewGroup *playControls = rightColumnHolder->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); + playControls->SetTag("debug"); + playControls->Add(new Spacer(new LinearLayoutParams(1.0f))); + playButton_ = playControls->Add(new Button("", g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY"), new LinearLayoutParams(0.0f, G_RIGHT))); + playButton_->OnClick.Add([=](UI::EventParams &e) { + g_Config.bRunBehindPauseMenu = !g_Config.bRunBehindPauseMenu; + playButton_->SetImageID(g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY")); + return UI::EVENT_DONE; + }); + rightColumnHolder->Add(new Spacer(10.0f)); } UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) { diff --git a/UI/PauseScreen.h b/UI/PauseScreen.h index ec8d1d2bdc..ee4aaf2cdc 100644 --- a/UI/PauseScreen.h +++ b/UI/PauseScreen.h @@ -66,5 +66,5 @@ private: bool finishNextFrame_ = false; PauseScreenMode mode_ = PauseScreenMode::MAIN; - UI::Button *pauseButton_ = nullptr; + UI::Button *playButton_ = nullptr; }; diff --git a/assets/ui_atlas.meta b/assets/ui_atlas.meta index 83517b60b9..aa5453eab3 100644 Binary files a/assets/ui_atlas.meta and b/assets/ui_atlas.meta differ diff --git a/assets/ui_atlas.zim b/assets/ui_atlas.zim index 15b934c5d3..d7ba96a849 100644 Binary files a/assets/ui_atlas.zim and b/assets/ui_atlas.zim differ diff --git a/buildatlas.sh b/buildatlas.sh index 4e20f19b81..2866f9959d 100755 --- a/buildatlas.sh +++ b/buildatlas.sh @@ -1,9 +1,9 @@ # Note that we do not copy the big font atlas to Android assets. No longer needed! ./ext/native/tools/build/atlastool ui_atlasscript.txt ui 8888 && cp ui_atlas.zim ui_atlas.meta assets && rm ui_atlas.cpp ui_atlas.h -./ext/native/tools/build/atlastool font_atlasscript.txt font 8888 && cp font_atlas.zim font_atlas.meta assets && rm font_atlas.cpp font_atlas.h -./ext/native/tools/build/atlastool asciifont_atlasscript.txt asciifont 8888 && cp asciifont_atlas.zim asciifont_atlas.meta assets && rm asciifont_atlas.cpp asciifont_atlas.h +#./ext/native/tools/build/atlastool font_atlasscript.txt font 8888 && cp font_atlas.zim font_atlas.meta assets && rm font_atlas.cpp font_atlas.h +#./ext/native/tools/build/atlastool asciifont_atlasscript.txt asciifont 8888 && cp asciifont_atlas.zim asciifont_atlas.meta assets && rm asciifont_atlas.cpp asciifont_atlas.h rm ui_atlas.zim ui_atlas.meta -rm font_atlas.zim font_atlas.meta -rm asciifont_atlas.zim asciifont_atlas.meta +#rm font_atlas.zim font_atlas.meta +#rm asciifont_atlas.zim asciifont_atlas.meta diff --git a/source_assets/image/pausepng.png b/source_assets/image/pause.png similarity index 100% rename from source_assets/image/pausepng.png rename to source_assets/image/pause.png diff --git a/ui_atlasscript.txt b/ui_atlasscript.txt index ded4b23143..1bcd79bef3 100644 --- a/ui_atlasscript.txt +++ b/ui_atlasscript.txt @@ -74,6 +74,7 @@ image I_RETROACHIEVEMENTS_LOGO source_assets/image/retroachievements_logo.png co image I_CHECKMARK source_assets/image/checkmark.png copy image I_PLAY source_assets/image/play.png copy image I_STOP source_assets/image/stop.png copy +image I_PAUSE source_assets/image/pause.png copy image I_FASTFORWARD source_assets/image/fast_forward.png copy image I_RECORD source_assets/image/record.png copy image I_SPEAKER source_assets/image/speaker.png copy