Files
itgmania212121/stepmania/src/Transition.cpp
T

101 lines
2.1 KiB
C++
Raw Normal View History

2001-11-03 10:52:42 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: Transition.cpp
2001-11-03 10:52:42 +00:00
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
#include "RageUtil.h"
#include "Transition.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2001-11-03 10:52:42 +00:00
2002-01-16 10:01:32 +00:00
Transition::Transition()
2001-11-03 10:52:42 +00:00
{
2002-01-16 10:01:32 +00:00
m_TransitionState = closed,
m_fTransitionTime = DEFAULT_TRANSITION_TIME;
m_fPercentThroughTransition = 0.0f;
2001-11-03 10:52:42 +00:00
}
Transition::~Transition()
{
}
void Transition::Update( float fDeltaTime )
2001-11-03 10:52:42 +00:00
{
2002-01-16 10:01:32 +00:00
Actor::Update( fDeltaTime );
2001-11-03 10:52:42 +00:00
switch( m_TransitionState )
{
case opening_right:
case opening_left:
case closing_right:
case closing_left:
m_fPercentThroughTransition += fDeltaTime/m_fTransitionTime;
2001-11-03 10:52:42 +00:00
if( m_fPercentThroughTransition > 1.0f ) // the wipe is over
{
m_fPercentThroughTransition = 0.0;
switch( m_TransitionState )
{
case opening_right:
case opening_left:
m_TransitionState = opened;
break;
case closing_right:
case closing_left:
m_TransitionState = closed;
break;
}
2002-01-16 10:01:32 +00:00
2002-05-19 01:59:48 +00:00
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone, 0 );
2001-11-03 10:52:42 +00:00
}
break;
}
}
void Transition::SetClosed()
{
m_TransitionState = closed;
}
void Transition::SetOpened()
{
m_TransitionState = opened;
}
2002-05-19 01:59:48 +00:00
void Transition::OpenWipingRight( ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
m_MessageToSendWhenDone = send_when_done;
m_TransitionState = opening_right;
m_fPercentThroughTransition = 0.0;
}
2002-05-19 01:59:48 +00:00
void Transition::OpenWipingLeft( ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
m_MessageToSendWhenDone = send_when_done;
m_TransitionState = opening_left;
m_fPercentThroughTransition = 0.0;
}
2002-05-19 01:59:48 +00:00
void Transition::CloseWipingRight( ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
m_MessageToSendWhenDone = send_when_done;
m_TransitionState = closing_right;
m_fPercentThroughTransition = 0.0;
}
2002-05-19 01:59:48 +00:00
void Transition::CloseWipingLeft( ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
m_MessageToSendWhenDone = send_when_done;
m_TransitionState = closing_left;
m_fPercentThroughTransition = 0.0;
}