Files
itgmania212121/stepmania/src/WheelNotifyIcon.cpp
T

86 lines
2.0 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-01-16 10:01:32 +00:00
/*
-----------------------------------------------------------------------------
2003-03-09 00:55:49 +00:00
Class: WheelNotifyIcon
2002-01-16 10:01:32 +00:00
Desc: See header.
2002-01-16 10:01:32 +00:00
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
2002-01-16 10:01:32 +00:00
-----------------------------------------------------------------------------
*/
2003-03-09 00:55:49 +00:00
#include "WheelNotifyIcon.h"
2002-01-16 10:01:32 +00:00
#include "RageUtil.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
2002-01-16 10:01:32 +00:00
#include "MusicWheel.h"
2003-03-09 00:55:49 +00:00
#include "WheelNotifyIcon.h"
2002-07-27 19:29:51 +00:00
#include "RageTimer.h"
#include <math.h>
#include "ThemeManager.h"
2002-01-16 10:01:32 +00:00
2003-03-09 00:55:49 +00:00
WheelNotifyIcon::WheelNotifyIcon()
2002-07-27 19:29:51 +00:00
{
Load( THEME->GetPathToG("WheelNotifyIcon icons 4x2") );
2002-07-27 19:29:51 +00:00
StopAnimating();
2002-08-20 21:00:56 +00:00
}
2002-01-16 10:01:32 +00:00
2003-03-09 00:55:49 +00:00
void WheelNotifyIcon::SetFlags( Flags flags )
2002-07-27 19:29:51 +00:00
{
m_vIconsToShow.clear();
2002-07-27 19:29:51 +00:00
// push onto vector in highest to lowest priority
2002-08-20 21:00:56 +00:00
switch( flags.iPlayersBestNumber )
2002-07-27 19:29:51 +00:00
{
case 1: m_vIconsToShow.push_back( best1 ); break;
case 2: m_vIconsToShow.push_back( best2 ); break;
case 3: m_vIconsToShow.push_back( best3 ); break;
2002-07-27 19:29:51 +00:00
}
if( flags.bEdits )
m_vIconsToShow.push_back( edits );
switch( flags.iStagesForSong )
{
case 1: break;
case 2: m_vIconsToShow.push_back( long_ver ); break;
case 3: m_vIconsToShow.push_back( marathon ); break;
default: ASSERT(0);
}
if( flags.bHasBeginnerOr1Meter )
m_vIconsToShow.push_back( training );
// HACK: Make players best blink if it's the only icon
if( m_vIconsToShow.size() == 1 )
{
if( m_vIconsToShow[0] >= best1 && m_vIconsToShow[0] <= best3 )
m_vIconsToShow.push_back( empty );
}
m_vIconsToShow.resize( min(m_vIconsToShow.size(),2u) ); // crop to most important 2
if( m_vIconsToShow.size() == 0 )
Sprite::SetDiffuse( RageColor(1,1,1,0) );
else
Sprite::SetDiffuse( RageColor(1,1,1,1) );
2002-08-20 21:00:56 +00:00
}
2002-07-27 19:29:51 +00:00
2003-03-09 00:55:49 +00:00
void WheelNotifyIcon::DrawPrimitives()
2002-07-27 19:29:51 +00:00
{
float fSecondFraction = fmodf(RageTimer::GetTimeSinceStart(), 1 );
if( m_vIconsToShow.size() > 0 )
2002-07-27 19:29:51 +00:00
{
int index = (int)(fSecondFraction*m_vIconsToShow.size());
Sprite::SetState( m_vIconsToShow[index] );
2002-07-27 19:29:51 +00:00
}
2002-07-27 19:29:51 +00:00
Sprite::DrawPrimitives();
2002-11-16 08:55:46 +00:00
}