Files
itgmania212121/stepmania/src/ActorScroller.h
T

110 lines
4.0 KiB
C++
Raw Normal View History

2004-06-08 00:47:53 +00:00
/* ActorScroller - ActorFrame that moves its children. */
2003-04-03 22:10:40 +00:00
#ifndef ActorScroller_H
#define ActorScroller_H
2004-01-17 23:14:56 +00:00
#include "ActorFrame.h"
2005-04-10 23:42:47 +00:00
#include "Quad.h"
class XNode;
#include "LuaExpressionTransform.h"
2005-03-31 12:57:21 +00:00
2004-01-17 23:14:56 +00:00
class ActorScroller : public ActorFrame
2003-04-03 22:10:40 +00:00
{
public:
ActorScroller();
2006-01-22 01:00:06 +00:00
void SetTransformFromExpression( const RString &sTransformFunction );
void SetTransformFromHeight( float fItemHeight );
2005-04-10 23:42:47 +00:00
void Load2(
float fNumItemsToDraw,
2005-07-26 19:55:00 +00:00
bool bLoop );
2005-05-03 09:29:54 +00:00
void EnableMask( float fWidth, float fHeight );
2005-10-17 23:18:49 +00:00
void DisableMask();
virtual void UpdateInternal( float fDelta );
2005-07-26 19:55:00 +00:00
virtual void DrawPrimitives(); // handles drawing and doesn't call ActorFrame::DrawPrimitives
2003-04-03 22:10:40 +00:00
void PositionItems();
2006-01-22 01:00:06 +00:00
void LoadFromNode( const RString &sDir, const XNode *pNode );
2005-07-18 22:00:19 +00:00
virtual Actor *Copy() const;
2005-04-10 23:42:47 +00:00
void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; }
void SetCurrentAndDestinationItem( float fItemIndex ) { m_fCurrentItem = m_fDestinationItem = fItemIndex; }
2005-09-24 00:51:35 +00:00
float GetCurrentItem() const { return m_fCurrentItem; }
float GetDestinationItem() const { return m_fDestinationItem; }
2005-09-22 00:08:59 +00:00
void ScrollThroughAllItems();
2005-09-27 03:18:57 +00:00
void ScrollWithPadding( float fItemPaddingStart, float fItemPaddingEnd );
2005-04-10 23:42:47 +00:00
void SetPauseCountdownSeconds( float fSecs ) { m_fPauseCountdownSeconds = fSecs; }
2005-12-06 03:17:32 +00:00
void SetFastCatchup( bool bOn ) { m_bFastCatchup = bOn; }
2005-12-07 03:43:47 +00:00
void SetSecondsPerItem( float fSeconds ) { m_fSecondsPerItem = fSeconds; }
2005-12-06 03:05:57 +00:00
void SetSecondsPauseBetweenItems( float fSeconds ) { m_fSecondsPauseBetweenItems = fSeconds; }
2005-12-07 04:19:32 +00:00
void SetNumSubdivisions( int iNumSubdivisions ) { m_exprTransformFunction.SetNumSubdivisions( iNumSubdivisions ); }
float GetSecondsForCompleteScrollThrough() const;
2006-02-24 01:57:10 +00:00
float GetSecondsToDestination() const;
2005-03-31 12:57:21 +00:00
//
// Commands
//
void PushSelf( lua_State *L );
2003-04-03 22:10:40 +00:00
protected:
2005-09-24 02:35:53 +00:00
void PositionItemsAndDrawPrimitives( bool bDrawPrimitives );
virtual void ShiftSubActors( int iDist );
int m_iNumItems;
2005-09-24 03:48:30 +00:00
float m_fCurrentItem; // Item at center of list, usually between 0 and m_SubActors.size(), approaches destination
2005-04-10 23:42:47 +00:00
float m_fDestinationItem;
float m_fSecondsPerItem; // <= 0 means don't scroll
float m_fSecondsPauseBetweenItems;
float m_fNumItemsToDraw;
int m_iFirstSubActorIndex;
2005-04-10 23:42:47 +00:00
bool m_bLoop;
bool m_bFastCatchup;
bool m_bFunctionDependsOnPositionOffset;
bool m_bFunctionDependsOnItemIndex;
2005-04-10 23:42:47 +00:00
float m_fPauseCountdownSeconds;
2005-04-19 19:17:03 +00:00
float m_fQuantizePixels;
2005-04-10 23:42:47 +00:00
Quad m_quadMask;
LuaExpressionTransform m_exprTransformFunction; // params: self,offset,itemIndex,numItems
2003-04-03 22:10:40 +00:00
};
2005-03-01 16:59:29 +00:00
class ActorScrollerAutoDeleteChildren : public ActorScroller
{
public:
ActorScrollerAutoDeleteChildren() { 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
};
2003-04-03 22:10:40 +00:00
#endif
2004-06-08 00:47:53 +00:00
/*
* (c) 2003-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.
*/