Files
kraken/kraken/KRBehavior.h

50 lines
1.1 KiB
C
Raw Normal View History

//
// KRBehavior.h
// Kraken
//
// Created by Kearwood Gilbert on 2013-05-17.
// Copyright (c) 2013 Kearwood Software. All rights reserved.
//
#ifndef KRBEHAVIOR_H
#define KRBEHAVIOR_H
#include <map>
/*
This class is a pure-virtual base class intended to be subclassed to define behavior of KRNode's in the scene
*/
class KRBehavior;
class KRNode;
2016-07-10 03:33:58 -07:00
namespace tinyxml2 {
class XMLElement;
} // namespace tinyxml2
typedef KRBehavior *(*KRBehaviorFactoryFunction)(std::map<std::string, std::string> attributes);
typedef std::map<std::string, KRBehaviorFactoryFunction> KRBehaviorFactoryFunctionMap;
class KRBehavior
{
public:
static void RegisterFactoryCTOR(std::string behaviorName, KRBehaviorFactoryFunction fnFactory);
static void UnregisterFactoryCTOR(std::string behaviorName);
KRBehavior();
virtual ~KRBehavior();
KRNode *getNode() const;
virtual void init();
virtual void update(float deltaTime) = 0;
virtual void visibleUpdate(float deltatime) = 0;
void __setNode(KRNode *node);
static KRBehavior *LoadXML(KRNode *node, tinyxml2::XMLElement *e);
private:
KRNode *__node;
};
#endif /* defined(KRBEHAVIOR_H) */