-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cclcc-librarymenu: accessible menu and background
- Loading branch information
Showing
13 changed files
with
207 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include "librarymenu.h" | ||
|
||
#include "clearlistmenu.h" | ||
|
||
#include "../../profile/games/cclcc/librarymenu.h" | ||
#include "../../profile/ui/backlogmenu.h" | ||
#include "../../profile/dialogue.h" | ||
#include "../../renderer/renderer.h" | ||
#include "../../mem.h" | ||
#include "../../profile/scriptvars.h" | ||
#include "../../vm/interface/input.h" | ||
|
||
namespace Impacto { | ||
namespace UI { | ||
namespace CCLCC { | ||
|
||
using namespace Impacto::Profile::CCLCC::LibraryMenu; | ||
using namespace Impacto::Profile::ScriptVars; | ||
|
||
using namespace Impacto::Vm::Interface; | ||
|
||
using namespace Impacto::UI::Widgets; | ||
|
||
LibraryMenu::LibraryMenu() { | ||
FadeAnimation.Direction = 1; | ||
FadeAnimation.LoopMode = ALM_Stop; | ||
FadeAnimation.DurationIn = FadeInDuration; | ||
FadeAnimation.DurationOut = FadeOutDuration; | ||
} | ||
|
||
void LibraryMenu::Show() { | ||
if (State != Shown) { | ||
State = Showing; | ||
FadeAnimation.StartIn(); | ||
if (UI::FocusedMenu != 0) { | ||
LastFocusedMenu = UI::FocusedMenu; | ||
LastFocusedMenu->IsFocused = false; | ||
} | ||
IsFocused = true; | ||
UI::FocusedMenu = this; | ||
} | ||
} | ||
|
||
void LibraryMenu::Hide() { | ||
if (State != Hidden) { | ||
State = Hiding; | ||
FadeAnimation.StartOut(); | ||
if (LastFocusedMenu != 0) { | ||
UI::FocusedMenu = LastFocusedMenu; | ||
LastFocusedMenu->IsFocused = true; | ||
} else { | ||
UI::FocusedMenu = 0; | ||
} | ||
IsFocused = false; | ||
} | ||
} | ||
|
||
void LibraryMenu::Update(float dt) { | ||
if (ScrWork[SW_SYSSUBMENUCT] < 32 && State == Shown && | ||
(ScrWork[SW_SYSSUBMENUNO] == 8)) { | ||
Hide(); | ||
} else if (ScrWork[SW_SYSSUBMENUCT] >= 32 && State == Hidden && | ||
(ScrWork[SW_SYSSUBMENUNO] == 8)) { | ||
Show(); | ||
} | ||
if (State == Shown && ScrWork[SW_SYSSUBMENUNO] == 8) { | ||
UpdateInput(); | ||
} | ||
FadeAnimation.Update(dt); | ||
if (State == Showing && FadeAnimation.Progress == 1.0f) { | ||
State = Shown; | ||
} else if (State == Hiding && FadeAnimation.Progress == 0.0f) { | ||
State = Hidden; | ||
} | ||
} | ||
|
||
void LibraryMenu::Render() { | ||
if (State != Hidden && ScrWork[SW_SYSSUBMENUCT] >= 32 && | ||
ScrWork[SW_SYSSUBMENUNO] == 8) { | ||
glm::vec4 maskTint = glm::vec4(1.0f); | ||
maskTint.a = 0.85f; | ||
Renderer->DrawSprite(BackgroundSprite, glm::vec2(0.0f)); | ||
} | ||
} | ||
|
||
} // namespace CCLCC | ||
} // namespace UI | ||
} // namespace Impacto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include "../../ui/menu.h" | ||
|
||
namespace Impacto { | ||
namespace UI { | ||
namespace CCLCC { | ||
|
||
class LibraryMenu : public Menu { | ||
public: | ||
LibraryMenu(); | ||
|
||
void Show(); | ||
void Hide(); | ||
void Update(float dt); | ||
void Render(); | ||
|
||
Animation FadeAnimation; | ||
}; | ||
|
||
} // namespace CCLCC | ||
} // namespace UI | ||
} // namespace Impacto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "librarymenu.h" | ||
#include "../../profile_internal.h" | ||
#include "../../../ui/ui.h" | ||
#include "../../../games/cclcc/librarymenu.h" | ||
#include "../../../text.h" | ||
#include "../../../game.h" | ||
|
||
namespace Impacto { | ||
namespace Profile { | ||
namespace CCLCC { | ||
namespace LibraryMenu { | ||
|
||
void Configure() { | ||
BackgroundSprite = EnsureGetMemberSprite("BackgroundSprite"); | ||
|
||
FadeInDuration = EnsureGetMemberFloat("FadeInDuration"); | ||
FadeOutDuration = EnsureGetMemberFloat("FadeOutDuration"); | ||
|
||
auto drawType = Game::DrawComponentType::_from_integral_unchecked( | ||
EnsureGetMemberInt("DrawType")); | ||
|
||
auto library = new UI::CCLCC::LibraryMenu(); | ||
UI::Menus[drawType].push_back(library); | ||
} | ||
|
||
} // namespace LibraryMenu | ||
} // namespace CCLCC | ||
} // namespace Profile | ||
} // namespace Impacto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include "../../../spritesheet.h" | ||
|
||
namespace Impacto { | ||
namespace Profile { | ||
namespace CCLCC { | ||
namespace LibraryMenu { | ||
|
||
inline Sprite BackgroundSprite; | ||
|
||
inline float FadeInDuration; | ||
inline float FadeOutDuration; | ||
|
||
void Configure(); | ||
|
||
} // namespace LibraryMenu | ||
} // namespace CCLCC | ||
} // namespace Profile | ||
} // namespace Impacto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters