2011-10-23 17:52:20 +00:00
|
|
|
/*
|
2011-05-24 07:52:29 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2011-07-07 03:53:24 +00:00
|
|
|
* Contributor(s): Mitchell Stokes.
|
2011-05-24 07:52:29 +00:00
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
2011-07-07 03:53:24 +00:00
|
|
|
|
|
|
|
/** \file BL_ActionManager.cpp
|
|
|
|
* \ingroup ketsji
|
|
|
|
*/
|
|
|
|
|
2012-02-23 10:41:31 +00:00
|
|
|
#ifndef __BL_ACTIONMANAGER_H__
|
|
|
|
#define __BL_ACTIONMANAGER_H__
|
2011-05-24 07:52:29 +00:00
|
|
|
|
|
|
|
#include "BL_Action.h"
|
|
|
|
|
2011-08-16 19:59:08 +00:00
|
|
|
#define MAX_ACTION_LAYERS 8
|
2011-05-24 07:52:29 +00:00
|
|
|
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* BL_ActionManager is responsible for handling a KX_GameObject's actions.
|
|
|
|
*/
|
2011-05-24 07:52:29 +00:00
|
|
|
class BL_ActionManager
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
BL_Action* m_layers[MAX_ACTION_LAYERS];
|
|
|
|
|
|
|
|
public:
|
2011-06-11 00:14:47 +00:00
|
|
|
BL_ActionManager(class KX_GameObject* obj);
|
2011-05-24 07:52:29 +00:00
|
|
|
~BL_ActionManager();
|
|
|
|
|
2011-06-29 01:53:17 +00:00
|
|
|
bool PlayAction(const char* name,
|
2011-05-24 07:52:29 +00:00
|
|
|
float start,
|
|
|
|
float end,
|
|
|
|
short layer=0,
|
2011-06-23 22:12:49 +00:00
|
|
|
short priority=0,
|
2011-05-24 07:52:29 +00:00
|
|
|
float blendin=0.f,
|
|
|
|
short play_mode=0,
|
2011-07-03 01:59:17 +00:00
|
|
|
float layer_weight=0.f,
|
2011-06-16 01:18:52 +00:00
|
|
|
short ipo_flags=0,
|
2011-05-28 07:15:27 +00:00
|
|
|
float playback_speed=1.f);
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* Gets the current frame of an action
|
|
|
|
*/
|
2011-06-01 07:42:40 +00:00
|
|
|
float GetActionFrame(short layer);
|
2011-05-24 07:52:29 +00:00
|
|
|
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* Sets the current frame of an action
|
|
|
|
*/
|
|
|
|
void SetActionFrame(short layer, float frame);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the currently running action on the given layer
|
|
|
|
*/
|
2011-07-05 05:22:02 +00:00
|
|
|
struct bAction *GetCurrentAction(short layer);
|
|
|
|
|
2011-08-08 04:28:30 +00:00
|
|
|
/**
|
|
|
|
* Sets play mode of the action on the given layer
|
|
|
|
*/
|
|
|
|
void SetPlayMode(short layer, short mode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the start and end times of the action on the given layer
|
|
|
|
*/
|
|
|
|
void SetTimes(short layer, float start, float end);
|
|
|
|
|
2011-07-07 03:53:24 +00:00
|
|
|
/**
|
|
|
|
* Stop playing the action on the given layer
|
|
|
|
*/
|
2011-05-24 07:52:29 +00:00
|
|
|
void StopAction(short layer);
|
2011-07-07 03:53:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if an action has finished playing
|
|
|
|
*/
|
2011-06-01 05:46:19 +00:00
|
|
|
bool IsActionDone(short layer);
|
2011-07-07 03:53:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update any running actions
|
|
|
|
*/
|
2011-05-24 07:52:29 +00:00
|
|
|
void Update(float);
|
2011-06-01 07:42:40 +00:00
|
|
|
|
2011-05-24 07:52:29 +00:00
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
2012-06-25 09:14:37 +00:00
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("GE:BL_ActionManager")
|
2011-05-24 07:52:29 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2012-10-09 13:36:42 +00:00
|
|
|
#endif /* BL_ACTIONMANAGER */
|