Skip to content

Commit

Permalink
MO6 backlog now properly takes focus
Browse files Browse the repository at this point in the history
  • Loading branch information
PringlesGang committed Oct 16, 2024
1 parent 3fd92fb commit 6bca516
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/games/cc/backlogmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ void BacklogMenu::Hide() {
UI::BacklogMenu::Hide();
}

void BacklogMenu::Update(float dt) {
if (ScrWork[SW_SYSSUBMENUCT] < 32 && State == Shown) {
Hide();
} else if (ScrWork[SW_SYSSUBMENUCT] > 0 && State == Hidden &&
ScrWork[SW_SYSSUBMENUNO] == 1) {
Show();
}

UI::BacklogMenu::Update(dt);
}

void BacklogMenu::Render() {
if (State == Hidden) return;

Expand Down
2 changes: 2 additions & 0 deletions src/games/cc/backlogmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class BacklogMenu : public UI::BacklogMenu {
public:
void Show() override;
void Hide() override;
void Update(float dt) override;
void Render() override;

void MenuButtonOnClick(Widgets::BacklogEntry* target) override;

private:
Expand Down
16 changes: 4 additions & 12 deletions src/ui/backlogmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "ui.h"
#include "../profile/game.h"
#include "../profile/vm.h"
#include "../renderer/renderer.h"
#include "../mem.h"
#include "../vm/interface/input.h"
Expand Down Expand Up @@ -224,29 +225,20 @@ void BacklogMenu::UpdateInput(float dt) {
}

void BacklogMenu::Update(float dt) {
if (ScrWork[SW_SYSSUBMENUCT] < 32 && State == Shown) {
Hide();
} else if (ScrWork[SW_SYSSUBMENUCT] > 0 && State == Hidden &&
ScrWork[SW_SYSSUBMENUNO] == 1) {
Show();
}

if (State != Hidden && State != Shown) FadeAnimation.Update(dt);

if (State == Showing && FadeAnimation.IsIn() &&
ScrWork[SW_SYSSUBMENUCT] == 32) {
if (State == Showing && FadeAnimation.IsIn()) {
State = Shown;
IsFocused = true;
} else if (State == Hiding && FadeAnimation.IsOut() &&
ScrWork[SW_SYSSUBMENUCT] == 0) {
} else if (State == Hiding && FadeAnimation.IsOut()) {
State = Hidden;
IsFocused = false;
if (UI::FocusedMenu) UI::FocusedMenu->IsFocused = true;

MainItems->Hide();
}

if (State == Shown && ScrWork[SW_SYSSUBMENUNO] == 1) {
if (State == Shown && IsFocused) {
UpdateInput(dt);

if (ItemsHeight > MainItems->RenderingBounds.Height) {
Expand Down

0 comments on commit 6bca516

Please sign in to comment.