Skip to content

Commit

Permalink
Add options button
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Dec 1, 2018
1 parent f265c01 commit e4156ea
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
Expand Up @@ -44,4 +44,19 @@ GAMESTATE:UpdateDiscordMenu(
": " .. string.format("%5.2f", GetPlayerOrMachineProfile(PLAYER_1):GetPlayerRating())
)

t[#t + 1] =
Widg.Button {
text = "Options",
width = 50,
height = 25,
border = false,
bgColor = BoostColor(getMainColor("frames"), 7.5),
highlight = {color = BoostColor(getMainColor("frames"), 10)},
x = SCREEN_WIDTH / 2,
y = 5,
onClick = function(self)
SCREENMAN:GetTopScreen():OpenOptions()
end
}

return t
4 changes: 3 additions & 1 deletion Themes/_fallback/metrics.ini
@@ -1,4 +1,4 @@
# This probably is hard to understand from the way it was made in the first
get it to work and put it anywher# This probably is hard to understand from the way it was made in the first
# place, so instead just pay attention to each group, which has tons of notes.

# 01 # Global
Expand Down Expand Up @@ -2068,6 +2068,8 @@ Fallback="ScreenWithMenuElements"
NextScreen=Branch.PlayerOptions()
PrevScreen=Branch.TitleMenu()
#
PlayerOptionsScreen="ScreenPlayerOptions"
#
MusicWheelType="MusicWheel"
Codes=""
#
Expand Down
10 changes: 9 additions & 1 deletion src/ScreenNetSelectMusic.cpp
Expand Up @@ -56,7 +56,6 @@ ScreenNetSelectMusic::Init()
GAMESTATE->m_bPlayingMulti = true;
SAMPLE_MUSIC_PREVIEW_MODE.Load(m_sName, "SampleMusicPreviewMode");
MUSIC_WHEEL_TYPE.Load(m_sName, "MusicWheelType");
PLAYER_OPTIONS_SCREEN.Load(m_sName, "PlayerOptionsScreen");

// todo: handle me theme-side -aj
FOREACH_EnabledPlayer(p)
Expand Down Expand Up @@ -407,6 +406,15 @@ ScreenNetSelectMusic::MenuRight(const InputEventPlus& input)
return true;
}

void
ScreenNetSelectMusic::OpenOptions()
{
NSMAN->OnOptions();
GAMESTATE->m_EditMode = EditMode_Full;
SCREENMAN->AddNewScreenToTop(PLAYER_OPTIONS_SCREEN,
SM_BackFromPlayerOptions);
}

bool
ScreenNetSelectMusic::MenuStart(const InputEventPlus& input)
{
Expand Down
3 changes: 2 additions & 1 deletion src/ScreenNetSelectMusic.h
Expand Up @@ -27,6 +27,8 @@ class ScreenNetSelectMusic : public ScreenSelectMusic
void StartSelectedSong();
bool SelectCurrent();

void OpenOptions() override;

MusicWheel* GetMusicWheel();
// Lua
void PushSelf(lua_State* L) override;
Expand All @@ -51,7 +53,6 @@ class ScreenNetSelectMusic : public ScreenSelectMusic
RString m_sRandomMusicPath;

ThemeMetric<RString> MUSIC_WHEEL_TYPE;
ThemeMetric<RString> PLAYER_OPTIONS_SCREEN;

ThemeMetric<float> SAMPLE_MUSIC_FALLBACK_FADE_IN_SECONDS;
ThemeMetric<float> SAMPLE_MUSIC_FADE_OUT_SECONDS;
Expand Down
13 changes: 13 additions & 0 deletions src/ScreenSelectMusic.cpp
Expand Up @@ -107,6 +107,7 @@ ScreenSelectMusic::Init()
ROULETTE_TIMER_SECONDS.Load(m_sName, "RouletteTimerSeconds");
ALIGN_MUSIC_BEATS.Load(m_sName, "AlignMusicBeat");
CODES.Load(m_sName, "Codes");
PLAYER_OPTIONS_SCREEN.Load(m_sName, "PlayerOptionsScreen");
MUSIC_WHEEL_TYPE.Load(m_sName, "MusicWheelType");
SELECT_MENU_AVAILABLE.Load(m_sName, "SelectMenuAvailable");
MODE_MENU_AVAILABLE.Load(m_sName, "ModeMenuAvailable");
Expand Down Expand Up @@ -376,6 +377,12 @@ ScreenSelectMusic::Update(float fDeltaTime)
CheckBackgroundRequests(false);
}

void
ScreenSelectMusic::OpenOptions()
{
SCREENMAN->AddNewScreenToTop(PLAYER_OPTIONS_SCREEN,
SM_BackFromPlayerOptions);
}
void
ScreenSelectMusic::DifferentialReload()
{
Expand Down Expand Up @@ -1981,8 +1988,14 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
p->ChangeSteps(PLAYER_1, IArg(1));
return 0;
}
static int OpenOptions(T* p, lua_State* L)
{
p->OpenOptions();
return 0;
}
LunaScreenSelectMusic()
{
ADD_METHOD(OpenOptions);
ADD_METHOD(GetGoToOptions);
ADD_METHOD(GetMusicWheel);
ADD_METHOD(OpenOptionsList);
Expand Down
2 changes: 2 additions & 0 deletions src/ScreenSelectMusic.h
Expand Up @@ -50,6 +50,7 @@ class ScreenSelectMusic : public ScreenWithMenuElements
// ScreenWithMenuElements override: never play music here; we do it ourself.
void StartPlayingMusic() override {}

virtual void OpenOptions();
bool GetGoToOptions() const { return m_bGoToOptions; }
MusicWheel* GetMusicWheel() { return &m_MusicWheel; }

Expand Down Expand Up @@ -100,6 +101,7 @@ class ScreenSelectMusic : public ScreenWithMenuElements
RageTimer m_timerIdleComment;
ThemeMetric<float> IDLE_COMMENT_SECONDS;

ThemeMetric<RString> PLAYER_OPTIONS_SCREEN;
ThemeMetric<float> SAMPLE_MUSIC_DELAY_INIT;
ThemeMetric<float> SAMPLE_MUSIC_DELAY;
ThemeMetric<bool> SAMPLE_MUSIC_LOOPS;
Expand Down

0 comments on commit e4156ea

Please sign in to comment.