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"
|
2005-12-16 04:16:09 +00:00
|
|
|
class XNode;
|
2005-09-03 17:37:42 +00:00
|
|
|
#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 );
|
2005-12-07 05:43:49 +00:00
|
|
|
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
|
|
|
|
2005-10-17 23:17:58 +00:00
|
|
|
void EnableMask( float fWidth, float fHeight );
|
2005-10-17 23:18:49 +00:00
|
|
|
void DisableMask();
|
2005-10-17 23:17:58 +00:00
|
|
|
|
2005-06-11 10:32:58 +00:00
|
|
|
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
|
|
|
|
2005-09-03 17:37:42 +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 );
|
2005-09-27 07:49:12 +00:00
|
|
|
virtual void ShiftSubActors( int iDist );
|
2005-09-03 17:37:42 +00:00
|
|
|
|
2005-09-27 07:49:12 +00:00
|
|
|
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;
|
2005-09-27 07:49:12 +00:00
|
|
|
int m_iFirstSubActorIndex;
|
2005-04-10 23:42:47 +00:00
|
|
|
bool m_bLoop;
|
2005-05-03 23:12:29 +00:00
|
|
|
bool m_bFastCatchup;
|
2006-01-30 00:50:00 +00:00
|
|
|
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;
|
|
|
|
|
|
2005-09-03 17:37:42 +00:00
|
|
|
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); }
|
2005-10-07 02:55:47 +00:00
|
|
|
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.
|
|
|
|
|
*/
|