2013-06-06 12:02:54 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013 cocos2d-x.org
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
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, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
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. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CCARMATUREDATAMANAGER_H__
|
|
|
|
#define __CCARMATUREDATAMANAGER_H__
|
|
|
|
|
|
|
|
#include "CCArmatureDefine.h"
|
|
|
|
#include "CCConstValue.h"
|
|
|
|
#include "../datas/CCDatas.h"
|
|
|
|
|
|
|
|
|
2013-06-17 21:32:15 +08:00
|
|
|
namespace cocos2d { namespace extension { namespace armature {
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief format and manage armature configuration and armature animation
|
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
class ArmatureDataManager : public Object
|
2013-06-06 12:02:54 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:15:53 +08:00
|
|
|
static ArmatureDataManager *sharedArmatureDataManager();
|
2013-06-10 11:43:43 +08:00
|
|
|
static void purgeArmatureSystem();
|
2013-06-06 12:02:54 +08:00
|
|
|
private:
|
2013-06-20 14:15:53 +08:00
|
|
|
ArmatureDataManager(void);
|
|
|
|
~ArmatureDataManager(void);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
2013-06-20 14:15:53 +08:00
|
|
|
* Init ArmatureDataManager
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
|
|
|
virtual bool init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add armature data
|
|
|
|
* @param id The id of the armature data
|
2013-06-20 14:15:53 +08:00
|
|
|
* @param armatureData ArmatureData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
void addArmatureData(const char *id, ArmatureData *armatureData);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief get armature data
|
|
|
|
*
|
|
|
|
* @param id the id of the armature data you want to get
|
|
|
|
*
|
2013-06-20 14:15:53 +08:00
|
|
|
* @return ArmatureData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
ArmatureData *getArmatureData(const char *id);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief add animation data
|
|
|
|
*
|
|
|
|
* @param id the id of the animation data
|
|
|
|
*
|
2013-06-20 14:15:53 +08:00
|
|
|
* @return AnimationData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
void addAnimationData(const char *id, AnimationData *animationData);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
2013-06-20 14:15:53 +08:00
|
|
|
* @brief get animation data from _animationDatas(Dictionary)
|
2013-06-06 12:02:54 +08:00
|
|
|
*
|
|
|
|
* @param id the id of the animation data you want to get
|
|
|
|
*
|
2013-06-20 14:15:53 +08:00
|
|
|
* @return AnimationData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
AnimationData *getAnimationData(const char *id);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief add texture data
|
|
|
|
*
|
|
|
|
* @param id the id of the texture data
|
|
|
|
*
|
2013-06-20 14:15:53 +08:00
|
|
|
* @return TextureData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
void addTextureData(const char *id, TextureData *textureData);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief get texture data
|
|
|
|
*
|
|
|
|
* @param _id the id of the texture data you want to get
|
|
|
|
*
|
2013-06-20 14:15:53 +08:00
|
|
|
* @return TextureData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
TextureData *getTextureData(const char *id);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
2013-06-20 14:15:53 +08:00
|
|
|
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
|
|
|
void addArmatureFileInfo(const char *armatureName, const char *useExistFileInfo, const char *imagePath, const char *plistPath, const char *configFilePath);
|
|
|
|
/**
|
2013-06-20 14:15:53 +08:00
|
|
|
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
|
|
|
void addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath);
|
|
|
|
|
|
|
|
/**
|
2013-06-20 14:15:53 +08:00
|
|
|
* @brief Add sprite frame to SpriteFrameCache, it will save display name and it's relative image name
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
|
|
|
void addSpriteFrameFromFile(const char *plistPath, const char *imagePath);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2013-06-15 14:03:30 +08:00
|
|
|
* @brief Clear the data in the _armarureDatas and _animationDatas, and set _armarureDatas and _animationDatas to NULL
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
|
|
|
void removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* @brief save amature datas
|
|
|
|
* @key std::string
|
2013-06-20 14:15:53 +08:00
|
|
|
* @value ArmatureData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
CC_SYNTHESIZE_READONLY(Dictionary *, _armarureDatas, ArmarureDatas);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief save animation datas
|
|
|
|
* @key std::string
|
2013-06-20 14:15:53 +08:00
|
|
|
* @value AnimationData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
CC_SYNTHESIZE_READONLY(Dictionary *, _animationDatas, AnimationDatas);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief save texture datas
|
|
|
|
* @key std::string
|
2013-06-20 14:15:53 +08:00
|
|
|
* @value TextureData *
|
2013-06-06 12:02:54 +08:00
|
|
|
*/
|
2013-06-20 14:15:53 +08:00
|
|
|
CC_SYNTHESIZE_READONLY(Dictionary *, _textureDatas, TextureDatas);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-17 21:32:15 +08:00
|
|
|
}}} // namespace cocos2d { namespace extension { namespace armature {
|
2013-06-06 12:02:54 +08:00
|
|
|
|
2013-06-07 10:52:32 +08:00
|
|
|
#endif/*__CCARMATUREDATAMANAGER_H__*/
|