Files
itgmania212121/stepmania/src/Transition.h
T

91 lines
2.2 KiB
C++
Raw Normal View History

/*
-----------------------------------------------------------------------------
File: Transition.cpp
Desc: Abstract base class for all transitions.
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#ifndef _Transition_H_
#define _Transition_H_
2002-05-19 01:59:48 +00:00
#include "RageDisplay.h"
#include "Screen.h"
#include "ScreenManager.h"
2002-01-16 10:01:32 +00:00
#include "Actor.h"
2002-03-10 10:30:45 +00:00
#include "RandomSample.h"
2001-11-03 10:52:42 +00:00
2002-03-10 10:30:45 +00:00
const float DEFAULT_TRANSITION_TIME = 0.40f;
2001-11-03 10:52:42 +00:00
2002-01-16 10:01:32 +00:00
class Transition : public Actor
2001-11-03 10:52:42 +00:00
{
public:
Transition();
2002-01-16 10:01:32 +00:00
virtual ~Transition();
2001-11-03 10:52:42 +00:00
2002-01-16 10:01:32 +00:00
virtual void Update( float fDeltaTime );
virtual void Draw()
{
if( m_TransitionState == opened )
return; // don't draw!
Actor::Draw();
}
2001-11-03 10:52:42 +00:00
virtual void SetOpened();
virtual void SetClosed();
2002-05-19 01:59:48 +00:00
virtual void OpenWipingRight( ScreenMessage send_when_done = SM_None );
virtual void OpenWipingLeft( ScreenMessage send_when_done = SM_None );
virtual void CloseWipingRight(ScreenMessage send_when_done = SM_None );
virtual void CloseWipingLeft( ScreenMessage send_when_done = SM_None );
2001-11-03 10:52:42 +00:00
2001-12-19 01:50:57 +00:00
bool IsOpened() { return m_TransitionState == opened; };
bool IsOpening() { return m_TransitionState == opening_right || m_TransitionState == opening_left; };
bool IsClosed() { return m_TransitionState == closed; };
bool IsClosing() { return m_TransitionState == closing_right || m_TransitionState == closing_left; };
2001-11-03 10:52:42 +00:00
2001-12-28 10:15:59 +00:00
void SetTransitionTime( float fNewTransitionTime ) { m_fTransitionTime = fNewTransitionTime; };
2001-11-03 10:52:42 +00:00
protected:
enum TransitionState { opened, closed,
opening_right, opening_left,
closing_right, closing_left };
TransitionState m_TransitionState;
2001-11-28 20:26:45 +00:00
float m_fTransitionTime;
float m_fPercentThroughTransition;
2002-08-01 03:15:27 +00:00
float GetPercentageOpen()
2002-01-16 10:01:32 +00:00
{
switch( m_TransitionState )
{
case opening_right:
case opening_left:
return m_fPercentThroughTransition;
2002-01-16 10:01:32 +00:00
case closing_right:
case closing_left:
2002-05-28 20:01:22 +00:00
return 1 - m_fPercentThroughTransition;
2002-02-09 18:53:47 +00:00
case opened:
return 1;
2002-05-28 20:01:22 +00:00
case closed:
return 0;
2002-01-16 10:01:32 +00:00
default:
2002-02-11 04:46:31 +00:00
ASSERT( false );
2002-01-16 10:01:32 +00:00
return 0;
}
};
2002-08-01 03:15:27 +00:00
float GetPercentageClosed() { return 1-GetPercentageOpen(); };
2002-01-16 10:01:32 +00:00
2001-11-03 10:52:42 +00:00
2002-05-19 01:59:48 +00:00
ScreenMessage m_MessageToSendWhenDone;
2001-11-03 10:52:42 +00:00
};
#endif