Files
itgmania212121/stepmania/src/ActorFrame.h
T

118 lines
4.2 KiB
C++
Raw Normal View History

2004-06-08 00:47:53 +00:00
/* ActorFrame - A container for other actors. */
#ifndef ACTORFRAME_H
#define ACTORFRAME_H
2001-12-11 11:44:26 +00:00
#include "Actor.h"
2002-01-16 10:01:32 +00:00
class ActorFrame : public Actor
2001-12-11 11:44:26 +00:00
{
public:
ActorFrame();
ActorFrame( const ActorFrame &cpy );
virtual ~ActorFrame();
void LoadFromNode( const CString& sDir, const XNode* pNode );
2005-07-18 22:00:19 +00:00
virtual Actor *Copy() const;
virtual void AddChild( Actor* pActor );
2004-05-02 03:01:27 +00:00
virtual void RemoveChild( Actor* pActor );
2005-03-01 21:55:47 +00:00
Actor* GetChild( const CString &sName );
2005-03-31 12:57:21 +00:00
int GetNumChildren() const { return m_SubActors.size(); }
2005-03-01 21:55:47 +00:00
void RemoveAllChildren();
2005-01-26 11:21:43 +00:00
void MoveToTail( Actor* pActor );
void MoveToHead( Actor* pActor );
void SortByDrawOrder();
2005-05-03 09:29:54 +00:00
void SetDrawByZPosition( bool b );
2003-01-21 20:44:09 +00:00
virtual bool AutoLoadChildren() const { return false; } // derived classes override to automatically LoadChildrenFromNode
void DeleteChildrenWhenDone( bool bDelete=true ) { m_bDeleteChildren = bDelete; }
2004-01-17 23:14:56 +00:00
void DeleteAllChildren();
2001-12-11 11:44:26 +00:00
2005-01-26 11:21:43 +00:00
//
// Commands
//
2005-06-25 05:06:38 +00:00
virtual void PushSelf( lua_State *L );
2005-05-29 01:00:05 +00:00
virtual void RunCommandsOnChildren( const LuaReference& cmds ); /* but not on self */
void RunCommandsOnChildren( const apActorCommands& cmds ) { this->RunCommandsOnChildren( *cmds ); } // convenience
virtual void RunCommandsOnLeaves( const LuaReference& cmds, Actor* pParent ); /* but not on self */
2004-01-11 07:12:13 +00:00
virtual void UpdateInternal( float fDeltaTime );
virtual void ProcessMessages( float fDeltaTime );
2002-05-19 01:59:48 +00:00
virtual void DrawPrimitives();
2001-12-11 11:44:26 +00:00
2005-05-29 01:00:05 +00:00
// propagated commands
virtual void SetDiffuse( RageColor c );
2004-01-11 05:33:24 +00:00
virtual void SetDiffuseAlpha( float f );
2005-04-30 07:48:10 +00:00
virtual void SetBaseAlpha( float f );
2004-05-15 09:26:21 +00:00
virtual void SetZTestMode( ZTestMode mode );
2003-11-18 20:33:18 +00:00
virtual void SetZWrite( bool b );
2003-07-20 01:32:42 +00:00
virtual void FinishTweening();
2003-11-18 17:50:50 +00:00
virtual void HurryTweening( float factor );
2005-03-18 18:57:05 +00:00
void SetUpdateRate( float fUpdateRate ) { m_fUpdateRate = fUpdateRate; }
2005-04-01 21:00:14 +00:00
void SetFOV( float fFOV ) { m_fFOV = fFOV; }
2005-05-20 21:11:02 +00:00
void SetVanishPoint( float fX, float fY) { m_fVanishX = fX; m_fVanishY = fY; }
2005-03-18 18:57:05 +00:00
2005-05-29 01:00:05 +00:00
virtual void SetPropagateCommands( bool b );
2005-01-26 11:21:43 +00:00
2003-01-01 09:05:21 +00:00
/* Amount of time until all tweens (and all children's tweens) have stopped: */
2003-03-02 01:43:33 +00:00
virtual float GetTweenTimeLeft() const;
2003-01-01 09:05:21 +00:00
virtual void PlayCommand( const CString &sCommandName, Actor* pParent = NULL );
virtual void RunCommands( const LuaReference& cmds, Actor* pParent = NULL );
void RunCommands( const apActorCommands& cmds, Actor *pParent = NULL ) { this->RunCommands( *cmds, pParent ); } // convenience
2004-02-01 03:14:37 +00:00
protected:
void LoadChildrenFromNode( const CString& sDir, const XNode* pNode );
2003-01-03 05:56:28 +00:00
vector<Actor*> m_SubActors;
bool m_bPropagateCommands;
bool m_bDeleteChildren;
2005-05-03 09:29:54 +00:00
bool m_bDrawByZPosition;
// state effects
float m_fUpdateRate;
float m_fFOV; // -1 = no change
2005-05-20 21:11:02 +00:00
float m_fVanishX;
float m_fVanishY;
2005-10-07 02:00:42 +00:00
bool m_bOverrideLighting; // if true, set lighting to m_bLighting
bool m_bLighting;
2001-12-11 11:44:26 +00:00
};
2005-03-01 16:59:29 +00:00
class ActorFrameAutoDeleteChildren : public ActorFrame
{
public:
ActorFrameAutoDeleteChildren() { DeleteChildrenWhenDone(true); }
virtual bool AutoLoadChildren() const { return true; }
2005-07-18 22:00:19 +00:00
virtual Actor *Copy() const;
2005-03-01 16:59:29 +00:00
};
2002-11-16 08:08:46 +00:00
#endif
2004-06-08 00:47:53 +00:00
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/