Files
itgmania212121/stepmania/src/ScreenOptions.h
T

169 lines
6.3 KiB
C++
Raw Normal View History

2004-06-08 05:22:33 +00:00
/* ScreenOptions - A grid of options; the selected option is drawn with a highlight rectangle. */
#ifndef SCREENOPTIONS_H
#define SCREENOPTIONS_H
2002-05-20 08:59:37 +00:00
#include "ScreenWithMenuElements.h"
2002-05-20 08:59:37 +00:00
#include "Sprite.h"
#include "RandomSample.h"
2003-12-18 00:17:04 +00:00
#include "DualScrollBar.h"
2005-02-02 08:31:15 +00:00
#include "ThemeMetric.h"
2005-02-11 07:50:26 +00:00
#include "OptionRow.h"
2002-05-20 08:59:37 +00:00
class OptionRowHandler;
2002-05-20 08:59:37 +00:00
enum InputMode
{
INPUTMODE_INDIVIDUAL, // each player controls their own cursor
2004-03-14 18:53:19 +00:00
INPUTMODE_SHARE_CURSOR // both players control the same cursor
};
2002-05-20 08:59:37 +00:00
class ScreenOptions : public ScreenWithMenuElements
2002-05-20 08:59:37 +00:00
{
public:
2003-09-27 04:58:30 +00:00
ScreenOptions( CString sClassName );
virtual void Init();
2005-02-25 19:36:58 +00:00
void InitMenu( InputMode im, const vector<OptionRowDefinition> &vDefs, const vector<OptionRowHandler*> &vHands );
2002-05-20 08:59:37 +00:00
virtual ~ScreenOptions();
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleScreenMessage( const ScreenMessage SM );
protected:
virtual void ImportOptions( int row, PlayerNumber pn ) = 0;
virtual void ExportOptions( int row, PlayerNumber pn ) = 0;
2002-05-20 08:59:37 +00:00
void InitOptionsText();
2004-01-10 06:57:05 +00:00
void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, int &iWidthOut, int &iXOut, int &iYOut );
2003-11-08 02:46:12 +00:00
CString GetExplanationText( int row ) const;
CString GetExplanationTitle( int row ) const;
2004-01-10 06:57:05 +00:00
BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow );
2002-05-20 08:59:37 +00:00
void PositionUnderlines();
2002-09-03 06:33:08 +00:00
void PositionIcons();
virtual void RefreshIcons();
void PositionCursors();
2003-06-16 03:29:59 +00:00
void PositionItems();
void TweenCursor( PlayerNumber pn );
void UpdateText( int row );
void UpdateEnabledDisabled();
void UpdateEnabledDisabled( int row );
2003-11-06 09:54:40 +00:00
virtual void OnChange( PlayerNumber pn );
2002-05-20 08:59:37 +00:00
2003-02-12 00:41:56 +00:00
virtual void MenuBack( PlayerNumber pn );
virtual void MenuStart( PlayerNumber pn, const InputEventType type );
2003-02-12 00:41:56 +00:00
2005-02-26 21:35:27 +00:00
virtual void BeginFadingOut() { this->PostScreenMessage( SM_BeginFadingOut, 0 ); }
2004-12-05 11:59:39 +00:00
virtual void GoToNextScreen() = 0;
virtual void GoToPrevScreen() = 0;
2002-05-20 08:59:37 +00:00
void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
void MoveRow( PlayerNumber pn, int dir, bool Repeat );
2002-05-20 08:59:37 +00:00
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,-1,type != IET_FIRST_PRESS); }
void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,+1,type != IET_FIRST_PRESS); }
void MenuUp( PlayerNumber pn, const InputEventType type );
void MenuDown( PlayerNumber pn, const InputEventType type );
2005-02-11 07:50:26 +00:00
/* Returns -1 if on a row with no OptionRowDefinition (eg. EXIT). */
2004-01-09 04:14:13 +00:00
int GetCurrentRow(PlayerNumber pn = PLAYER_1) const;
2005-02-26 21:35:27 +00:00
bool IsOnLastRow( PlayerNumber pn ) const;
bool AllAreOnLastRow() const;
2003-05-30 21:36:56 +00:00
2003-11-01 19:36:52 +00:00
protected: // derived classes need access to these
2004-01-09 04:14:13 +00:00
void LoadOptionIcon( PlayerNumber pn, int iRow, CString sText );
enum Navigation { NAV_THREE_KEY, NAV_THREE_KEY_MENU, NAV_FIVE_KEY, NAV_TOGGLE_THREE_KEY, NAV_TOGGLE_FIVE_KEY };
void SetNavigation( Navigation nav ) { m_OptionsNavigation = nav; }
2004-01-08 23:32:14 +00:00
2004-01-10 04:35:30 +00:00
protected:
/* Map menu lines to m_OptionRow entries. */
2005-02-11 07:50:26 +00:00
vector<OptionRow*> m_Rows;
2004-01-09 04:14:13 +00:00
Navigation m_OptionsNavigation;
2004-01-09 04:43:27 +00:00
2004-01-09 04:14:13 +00:00
int m_iCurrentRow[NUM_PLAYERS];
int m_iFocusX[NUM_PLAYERS];
void StoreFocus( PlayerNumber pn );
InputMode m_InputMode;
2002-05-20 08:59:37 +00:00
ActorFrame m_framePage;
2003-12-19 22:10:06 +00:00
AutoActor m_sprPage;
2002-05-20 08:59:37 +00:00
OptionsCursor m_Highlight[NUM_PLAYERS];
2003-12-19 22:10:06 +00:00
Sprite m_sprLineHighlight[NUM_PLAYERS];
2003-12-18 22:51:43 +00:00
BitmapText m_textPlayerName[NUM_PLAYERS];
BitmapText m_textExplanation[NUM_PLAYERS];
2003-12-18 00:17:04 +00:00
DualScrollBar m_ScrollBar;
2004-01-10 03:36:14 +00:00
AutoActor m_sprMore;
bool m_bMoreShown, m_bWasOnExit[NUM_PLAYERS];
// show if the current selections will disqualify a high score
AutoActor m_sprDisqualify[NUM_PLAYERS];
2005-01-31 03:32:59 +00:00
// TRICKY: People hold Start to get to PlayerOptions, then
// the repeat events cause them to zip to the bottom. So, ignore
// Start repeat events until we've seen one first pressed event.
bool m_bGotAtLeastOneStartPressed[NUM_PLAYERS];
2004-01-10 03:36:14 +00:00
2003-01-02 08:13:34 +00:00
RageSound m_SoundChangeCol;
RageSound m_SoundNextRow;
RageSound m_SoundPrevRow;
2004-01-10 21:34:18 +00:00
RageSound m_SoundToggleOn;
RageSound m_SoundToggleOff;
2005-02-02 08:31:15 +00:00
// metrics
2005-02-13 07:10:35 +00:00
ThemeMetric<int> NUM_ROWS_SHOWN;
ThemeMetric1D<float> ROW_Y;
2005-02-14 01:16:08 +00:00
ThemeMetric<float> ROW_Y_OFF_SCREEN_TOP;
ThemeMetric<float> ROW_Y_OFF_SCREEN_CENTER;
ThemeMetric<float> ROW_Y_OFF_SCREEN_BOTTOM;
ThemeMetric1D<float> EXPLANATION_X;
ThemeMetric1D<float> EXPLANATION_Y;
ThemeMetric1D<apActorCommands> EXPLANATION_ON_COMMAND;
ThemeMetric<float> EXPLANATION_TOGETHER_X;
ThemeMetric<float> EXPLANATION_TOGETHER_Y;
ThemeMetric<apActorCommands> EXPLANATION_TOGETHER_ON_COMMAND;
ThemeMetric<bool> SHOW_SCROLL_BAR;
ThemeMetric<float> SCROLL_BAR_HEIGHT;
ThemeMetric<float> SCROLL_BAR_TIME;
ThemeMetric<float> EXPLANATION_ZOOM;
ThemeMetric<bool> SHOW_BPM_IN_SPEED_TITLE;
ThemeMetric<apActorCommands> FRAME_ON_COMMAND;
ThemeMetric<apActorCommands> FRAME_OFF_COMMAND;
2005-02-26 21:35:27 +00:00
ThemeMetric<bool> SHOW_EXIT_ROW;
ThemeMetric<bool> SEPARATE_EXIT_ROW;
ThemeMetric<float> SEPARATE_EXIT_ROW_Y;
ThemeMetric<CString> OPTION_ROW_TYPE;
2002-05-20 08:59:37 +00:00
};
#endif
2004-06-08 05:22:33 +00:00
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/