Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

Background.h

Go to the documentation of this file.
00001 /* Background - Background behind notes while playing. */ 00002 00003 #ifndef BACKGROUND_H 00004 #define BACKGROUND_H 00005 00006 #include "Sprite.h" 00007 #include "Quad.h" 00008 #include "ActorFrame.h" 00009 #include "BGAnimation.h" 00010 #include "song.h" 00011 #include <deque> 00012 #include <map> 00013 00014 class DancingCharacters; 00015 00016 class BrightnessOverlay: public ActorFrame 00017 { 00018 public: 00019 BrightnessOverlay(); 00020 void Update( float fDeltaTime ); 00021 00022 void FadeToActualBrightness(); 00023 void SetActualBrightness(); 00024 void Set( float fBrightness ); 00025 00026 private: 00027 Quad m_quadBGBrightness[NUM_PLAYERS]; 00028 Quad m_quadBGBrightnessFade; 00029 }; 00030 00031 class Background : public ActorFrame 00032 { 00033 public: 00034 Background(); 00035 ~Background(); 00036 void Init(); 00037 00038 virtual void LoadFromSong( const Song *pSong ); 00039 virtual void Unload(); 00040 00041 virtual void Update( float fDeltaTime ); 00042 virtual void DrawPrimitives(); 00043 00044 void FadeToActualBrightness() { m_Brightness.FadeToActualBrightness(); } 00045 void SetBrightness( float fBrightness ) { m_Brightness.Set(fBrightness); } /* overrides pref and Cover */ 00046 00047 DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; }; 00048 00049 protected: 00050 const Song *m_pSong; 00051 void LoadFromRandom( float fFirstBeat, float fLastBeat, const TimingData &timing ); 00052 int FindBGSegmentForBeat( float fBeat ) const; 00053 00054 bool IsDangerPlayerVisible( PlayerNumber pn ); 00055 bool IsDangerAllVisible(); 00056 bool IsDeadPlayerVisible( PlayerNumber pn ); 00057 void UpdateCurBGChange( float fCurrentTime ); 00058 00059 bool m_bInitted; 00060 DancingCharacters* m_pDancingCharacters; 00061 00062 BGAnimation m_DangerPlayer[NUM_PLAYERS]; 00063 BGAnimation m_DangerAll; 00064 00065 BGAnimation m_DeadPlayer[NUM_PLAYERS]; 00066 00067 Actor *CreateSongBGA( CString sBGName ) const; 00068 CString CreateRandomBGA(); 00069 00070 map<CString,Actor*> m_BGAnimations; 00071 deque<CString> m_RandomBGAnimations; 00072 vector<BackgroundChange> m_aBGChanges; 00073 int m_iCurBGChangeIndex; 00074 Actor *m_pCurrentBGA; 00075 Actor *m_pFadingBGA; 00076 float m_fSecsLeftInFade; 00077 float m_fLastMusicSeconds; 00078 Quad m_quadBorder[4]; // l, t, r, b - cover up the edge of animations that might hang outside of the background rectangle 00079 00080 BrightnessOverlay m_Brightness; 00081 }; 00082 00083 00084 #endif 00085 00086 /* 00087 * (c) 2001-2004 Chris Danford, Ben Nordstrom 00088 * All rights reserved. 00089 * 00090 * Permission is hereby granted, free of charge, to any person obtaining a 00091 * copy of this software and associated documentation files (the 00092 * "Software"), to deal in the Software without restriction, including 00093 * without limitation the rights to use, copy, modify, merge, publish, 00094 * distribute, and/or sell copies of the Software, and to permit persons to 00095 * whom the Software is furnished to do so, provided that the above 00096 * copyright notice(s) and this permission notice appear in all copies of 00097 * the Software and that both the above copyright notice(s) and this 00098 * permission notice appear in supporting documentation. 00099 * 00100 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00101 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00102 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00103 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00104 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00105 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00106 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00107 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00108 * PERFORMANCE OF THIS SOFTWARE. 00109 */

Generated on Thu Jan 27 20:57:18 2005 for StepMania by doxygen 1.3.7