2
0

BsScriptAnimationCurve.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEnginePrerequisites.h"
  5. #include "BsScriptObject.h"
  6. #include "BsAnimationCurve.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup ScriptInteropEngine
  10. * @{
  11. */
  12. /** Interop class between C++ & CLR for KeyFrame. */
  13. class BS_SCR_BE_EXPORT ScriptKeyFrame : public ScriptObject<ScriptKeyFrame>
  14. {
  15. public:
  16. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "KeyFrame")
  17. private:
  18. ScriptKeyFrame(MonoObject* instance);
  19. };
  20. /** Interop class between C++ & CLR for AnimationCurve. */
  21. class BS_SCR_BE_EXPORT ScriptAnimationCurve : public ScriptObject<ScriptAnimationCurve>
  22. {
  23. public:
  24. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "AnimationCurve")
  25. /** Returns the internal native curve stored in this wrapper. */
  26. SPtr<TAnimationCurve<float>> getInternal() const { return mCurve; }
  27. /** Creates a new managed object wrapping the provided curve. */
  28. static MonoObject* create(const TAnimationCurve<float>& curve);
  29. private:
  30. ScriptAnimationCurve(MonoObject* instance, const SPtr<TAnimationCurve<float>>& curve);
  31. SPtr<TAnimationCurve<float>> mCurve;
  32. /************************************************************************/
  33. /* CLR HOOKS */
  34. /************************************************************************/
  35. static void internal_Create(MonoObject* instance, MonoArray* keyframes);
  36. static MonoArray* internal_GetKeyFrames(ScriptAnimationCurve* thisPtr);
  37. static void internal_SetKeyFrames(ScriptAnimationCurve* thisPtr, MonoArray* keyframes);
  38. static float internal_Evaluate(ScriptAnimationCurve* thisPtr, float time, bool loop);
  39. };
  40. /** @} */
  41. }