Skip to content

Commit

Permalink
Implemented static cclcc config ui mockup
Browse files Browse the repository at this point in the history
  • Loading branch information
PringlesGang committed Oct 19, 2024
1 parent 69fc822 commit 4382d70
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 20 deletions.
46 changes: 28 additions & 18 deletions profiles/cclcc/hud/optionsmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ root.OptionsMenu = {
PageHeaderPosition = { X = 696, Y = 182 },

PagePanelSprite = "OptionsPagePanel",
PagePanelPosition = { X = 0, Y = -8 },
PagePanelPosition = { X = -114, Y = 0 },
PagePanelSprites = {},
PoleAnimation = "OptionsPoleAnimation",

Expand Down Expand Up @@ -127,14 +127,14 @@ root.Sprites["OptionsVoiceGuide"] = {
Bounds = { X = 0, Y = 2416, Width = 1926, Height = 57 }
};

for i = 1, 4 do
for i = 0, 3 do
height = 80;

root.Sprites["OptionsPageHeader" .. i] = {
Sheet = "Config",
Bounds = {
X = 0,
Y = 1510 + height * (i - 1),
Y = 1510 + height * i,
Width = 942,
Height = height
}
Expand All @@ -143,47 +143,52 @@ for i = 1, 4 do
root.OptionsMenu.PageHeaderSprites[#root.OptionsMenu.PageHeaderSprites + 1] = "OptionsPageHeader" .. i;
end

for i = 1, 16 do
offset = ((i > 12) and {104} or {0})[1];
height = 52;
-- Rearange the labels in the array so they're in order of appearance
labelIndices = {5, 6, 7, 1,
2, 3, 8,
9, 10, 11, 12, 13, 4, 15, 14,
16};
height = 52;
for i = 0, 15 do
offset = ((i > 11) and {104} or {0})[1];

root.Sprites["OptionsLabel" .. i] = {
Sheet = "Config",
Bounds = {
X = 1239,
Y = 1237 + height * (i - 1) + offset,
Y = 1237 + height * i + offset,
Width = 809,
Height = height
}
};
root.OptionsMenu.LabelSprites[#root.OptionsMenu.LabelSprites + 1] = "OptionsLabel" .. i;
root.OptionsMenu.LabelSprites[labelIndices[i + 1]] = "OptionsLabel" .. i;
end

for i = 1, 13 do
for i = 0, 12 do
width = 218;
height = 53;

root.Sprites["OptionsNametag" .. i] = {
Sheet = "Config",
Bounds = {
X = width * ((i - 1) % 6),
Y = 1863 + height * ((i - 1) // 6),
X = width * (i % 6),
Y = 1863 + height * (i // 6),
Width = width,
Height = height
}
};
root.OptionsMenu.NametagSprites[#root.OptionsMenu.NametagSprites + 1] = "OptionsNametag" .. i;
end

for i = 1, 8 do
for i = 0, 7 do
-- Interweave highlighted and non-highlighted variants
width = 224;
offset = ((i % 2 == 0) and {width * 4} or {0})[1];
offset = ((i % 2 == 1) and {width * 4} or {0})[1];

root.Sprites["OptionsPagePanel" .. i] = {
Sheet = "Config",
Bounds = {
X = offset + width * ((i - 1) // 2),
X = offset + width * (i // 2),
Y = 2205,
Width = width,
Height = 195
Expand All @@ -192,15 +197,15 @@ for i = 1, 8 do
root.OptionsMenu.PagePanelSprites[#root.OptionsMenu.PagePanelSprites + 1] = "OptionsPagePanel" .. i;
end

for i = 1, 26 do
for i = 0, 25 do
-- Interweave on and muted variants
width = 100;

root.Sprites["OptionsPortrait" .. i] = {
Sheet = "ConfigEx",
Bounds = {
X = 768 + (width + 1) * (i - 1),
Y = ((i % 2 == 1) and {2256} or {2357})[1],
X = 768 + (width + 1) * i,
Y = ((i % 2 == 0) and {2256} or {2357})[1],
Width = width,
Height = width
}
Expand All @@ -211,15 +216,20 @@ end
MakeAnimation({
Name = "OptionsPoleAnimation",
Sheet = "ConfigEx",

FirstFrameX = 0,
FirstFrameY = 0,

FrameWidth = 539,
ColWidth = 539,
FrameHeight = 1080,
RowHeight = 1096,

Frames = 15,
Duration = 1,
Rows = 3,
Columns = 7,
PrimaryDirection = AnimationDirections.Right

PrimaryDirection = AnimationDirections.Right,
SecondaryDirection = AnimationDirections.Down
});
35 changes: 33 additions & 2 deletions src/games/cclcc/optionsmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ OptionsMenu::OptionsMenu() {
FadeAnimation.LoopMode = ALM_Stop;
FadeAnimation.DurationIn = FadeInDuration;
FadeAnimation.DurationOut = FadeOutDuration;

PoleAnimation = Profile::CCLCC::OptionsMenu::PoleAnimation.Instantiate();
}

void OptionsMenu::Show() {
if (State != Shown) {
State = Showing;
FadeAnimation.StartIn();
PoleAnimation.StartIn();
// FirstPage->Show();
if (UI::FocusedMenu != 0) {
LastFocusedMenu = UI::FocusedMenu;
Expand All @@ -44,6 +47,7 @@ void OptionsMenu::Hide() {
if (State != Hidden) {
State = Hiding;
FadeAnimation.StartOut();
PoleAnimation.StartOut();
if (LastFocusedMenu != 0) {
UI::FocusedMenu = LastFocusedMenu;
LastFocusedMenu->IsFocused = true;
Expand All @@ -58,6 +62,7 @@ void OptionsMenu::Update(float dt) {
UpdateInput();

FadeAnimation.Update(dt);
PoleAnimation.Update(dt);
if (ScrWork[SW_SYSSUBMENUCT] < 32 && State == Shown &&
ScrWork[SW_SYSSUBMENUNO] == 5) {
Hide();
Expand All @@ -70,8 +75,34 @@ void OptionsMenu::Update(float dt) {
void OptionsMenu::Render() {
if (State != Hidden && ScrWork[SW_SYSSUBMENUCT] >= 32 &&
ScrWork[SW_SYSSUBMENUNO] == 5) {
// glm::vec4 col(1.0f, 1.0f, 1.0f, FadeAnimation.Progress);
Renderer->DrawSprite(BackgroundSprite, glm::vec2(0.0f));
glm::vec4 col(1.0f, 1.0f, 1.0f, FadeAnimation.Progress);

Renderer->DrawSprite(BackgroundSprite, BackgroundPosition, col);
Renderer->DrawSprite(HeaderSprite, HeaderPosition, col);

Renderer->DrawSprite(PageHeaderSprites[2], PageHeaderPosition, col);
for (int i = 7; i < 15; i++) {
glm::vec2 pos = SoundEntriesStartPosition;
pos.y += SoundEntriesVerticalOffset * (i - 7);

Renderer->DrawSprite(LabelSprites[i], pos, col);

if (11 <= i && i <= 13) {
glm::vec2 boxPos = pos + BinaryBoxOffset;

Renderer->DrawSprite(BinaryBoxSprite, boxPos, col);
Renderer->DrawSprite(YesSprite, boxPos, col);
Renderer->DrawSprite(
NoSprite, boxPos + glm::vec2(BinaryBoxSprite.ScaledWidth() / 2, 0),
col);
} else {
Renderer->DrawSprite(SliderTrackSprite, pos + SliderTrackOffset, col);
}
}

Renderer->DrawSprite(PoleAnimation.CurrentSprite(), PagePanelPosition, col);

Renderer->DrawSprite(GuideSprite, GuidePosition, col);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/games/cclcc/optionsmenu.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "../../ui/menu.h"
#include "../../spriteanimation.h"

namespace Impacto {
namespace UI {
Expand All @@ -17,6 +18,7 @@ class OptionsMenu : public Menu {

private:
Animation FadeAnimation;
SpriteAnimation PoleAnimation;
};

} // namespace CCLCC
Expand Down

0 comments on commit 4382d70

Please sign in to comment.