Codeblocks

cppanimating.h

Jul 30th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. #if !defined( PUPPETEERANIMATING_H )
  2. #define PUPPETEERANIMATING_H
  3. #pragma once
  4.  
  5. #include "../Core/base.h"
  6. #include "../Core/puppeteer.h"
  7.  
  8. namespace Leadwerks
  9. {
  10.     typedef void(*func_ptr)(Entity* entity, const std::string&);
  11.     class Animation
  12.     {
  13.     public:
  14.         Animation() {};
  15.         virtual ~Animation() {};
  16.  
  17.         long blendstart;
  18.         long blendfinish;
  19.         int blendtime;
  20.         std::string sequence;
  21.         int length;
  22.         float speed;
  23.         bool mode;
  24.         bool endOfSequenceReached = false;
  25.         func_ptr endHook;
  26.     };
  27.  
  28.  
  29.     class AnimationManager : public Object
  30.     {
  31.     public:
  32.         AnimationManager(Entity* pEntity);
  33.         virtual ~AnimationManager();
  34.         virtual void SetAnimationSequence(const std::string& pSequence, const float pSpeed = 1.0f, const int pBlendTime = 500, const bool pMode = false, func_ptr pEndHook = nullptr);
  35.         virtual void Update();
  36.         void ClearAnimations();
  37.     private:
  38.         Entity* entity;
  39.         short frameoffset;
  40.         std::vector<Animation*> animations;
  41.     };
  42.  
  43.     class PuppeteerAnimating : public Puppeteer
  44.     {
  45.     public:
  46.         PuppeteerAnimating(Entity* pEntity);
  47.         virtual ~PuppeteerAnimating();
  48.  
  49.         virtual void Start();
  50.         virtual void PostStart() {};
  51.  
  52.         virtual void Collision(Entity* pEntity, float* position, float* normal, float speed) {};
  53.         virtual void Draw(Camera* camera);
  54.         virtual void DrawEach() {};
  55.         virtual void PostRender(Context* context) {};
  56.         virtual void UpdateMatrix() {};
  57.         virtual void UpdatePhysics() {};
  58.         virtual void UpdateWorld() {};
  59.         virtual void Use(Entity* pCaller);
  60.  
  61.     private:
  62.         AnimationManager animationmanager;
  63.     };
  64. }
  65.  
  66. #endif // PUPPETEERANIMATING_H
Add Comment
Please, Sign In to add comment