Files
itgmania212121/stepmania/src/TransitionFadeWipe.cpp
T

66 lines
2.0 KiB
C++
Raw Normal View History

2001-11-03 10:52:42 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
2001-11-29 06:49:26 +00:00
File: TransitionStarWipe.cpp
2001-11-29 06:49:26 +00:00
Desc: Black bands (horizontal window blinds) gradually close.
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 "TransitionFadeWipe.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2001-11-03 10:52:42 +00:00
2001-11-29 06:49:26 +00:00
const float FADE_RECT_WIDTH = SCREEN_WIDTH/2;
2001-11-03 10:52:42 +00:00
TransitionFadeWipe::TransitionFadeWipe()
{
}
TransitionFadeWipe::~TransitionFadeWipe()
{
}
2002-05-19 01:59:48 +00:00
void TransitionFadeWipe::DrawPrimitives()
2001-11-03 10:52:42 +00:00
{
if( m_TransitionState == opened )
return;
/////////////////////////
// draw rectangles that get progressively smaller at the edge of the wipe
/////////////////////////
2001-11-29 06:49:26 +00:00
bool bLeftEdgeIsDarker = m_TransitionState == opening_left || m_TransitionState == closing_right;
bool bFadeIsMovingLeft = m_TransitionState == opening_left || m_TransitionState == closing_left;
float fPercentComplete = m_fPercentThroughTransition;
float fPercentAlongScreen = bFadeIsMovingLeft ? 1-fPercentComplete*1.3f : fPercentComplete*1.3f;
float fFadeLeftEdgeX = fPercentAlongScreen * SCREEN_WIDTH - FADE_RECT_WIDTH/2;
float fFadeRightEdgeX = fPercentAlongScreen * SCREEN_WIDTH + FADE_RECT_WIDTH/2;
float fDarkEdgeX = bLeftEdgeIsDarker ? fFadeLeftEdgeX : fFadeRightEdgeX;
float fLightEdgeX = bLeftEdgeIsDarker ? fFadeRightEdgeX : fFadeLeftEdgeX;
float fDarkOutsideX = bLeftEdgeIsDarker ? fDarkEdgeX - SCREEN_WIDTH*2 : fDarkEdgeX + SCREEN_WIDTH*2;
2002-01-16 10:01:32 +00:00
m_rectBlack.SetDiffuse( RageColor(0,0,0,1) );
2002-10-31 05:52:12 +00:00
m_rectBlack.StretchTo( RectI((int)fDarkOutsideX, 0, (int)fDarkEdgeX, (int)SCREEN_HEIGHT) );
2002-01-16 10:01:32 +00:00
m_rectBlack.Draw();
m_rectGradient.SetDiffuseLeftEdge( RageColor(0,0,0,1) );
m_rectGradient.SetDiffuseRightEdge( RageColor(0,0,0,0) );
2002-10-31 05:52:12 +00:00
m_rectGradient.StretchTo( RectI((int)fDarkEdgeX, 0, (int)fLightEdgeX, (int)SCREEN_HEIGHT) );
2002-01-16 10:01:32 +00:00
m_rectGradient.Draw();
2001-12-28 10:15:59 +00:00
2001-11-03 10:52:42 +00:00
}