PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: AnimationEvent.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLRENDERER_ANIMATIONEVENT_H__ 00024 #define __PLRENDERER_ANIMATIONEVENT_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Container/Element.h> 00032 #include <PLCore/Container/ElementManager.h> 00033 #include "PLRenderer/PLRenderer.h" 00034 00035 00036 //[-------------------------------------------------------] 00037 //[ Namespace ] 00038 //[-------------------------------------------------------] 00039 namespace PLRenderer { 00040 00041 00042 //[-------------------------------------------------------] 00043 //[ Forward declarations ] 00044 //[-------------------------------------------------------] 00045 class AnimationEventManager; 00046 00047 00048 //[-------------------------------------------------------] 00049 //[ Classes ] 00050 //[-------------------------------------------------------] 00051 /** 00052 * @brief 00053 * Animation event 00054 */ 00055 class AnimationEvent : public PLCore::Element<AnimationEvent> { 00056 00057 00058 //[-------------------------------------------------------] 00059 //[ Public functions ] 00060 //[-------------------------------------------------------] 00061 public: 00062 /** 00063 * @brief 00064 * Constructor 00065 * 00066 * @param[in] nID 00067 * Event ID 00068 * @param[in] nFrame 00069 * Frame causing this event 00070 * @param[in] pManager 00071 * Event manager using this element, can be a null pointer 00072 * @param[in] sName 00073 * Name of the event, if empty, a default name is set automatically 00074 * 00075 * @note 00076 * - If you provide the pointer to the owner manager the animation 00077 * event will check in the animation event manager name list 00078 */ 00079 PLRENDERER_API AnimationEvent(int nID, PLCore::uint32 nFrame, AnimationEventManager *pManager = nullptr, const PLCore::String &sName = ""); 00080 00081 /** 00082 * @brief 00083 * Returns the event ID 00084 * 00085 * @return 00086 * Event ID 00087 */ 00088 inline int GetID() const; 00089 00090 /** 00091 * @brief 00092 * Sets the event ID 00093 * 00094 * @param[in] nID 00095 * Event ID 00096 */ 00097 inline void SetID(int nID); 00098 00099 /** 00100 * @brief 00101 * Returns the frame which will cause this event 00102 * 00103 * @return 00104 * The frame which will cause this event 00105 */ 00106 inline PLCore::uint32 GetFrame() const; 00107 00108 /** 00109 * @brief 00110 * Sets the frame causing this event 00111 * 00112 * @param[in] nFrame 00113 * Frame causing this event 00114 */ 00115 inline void SetFrame(PLCore::uint32 nFrame); 00116 00117 00118 //[-------------------------------------------------------] 00119 //[ Private data ] 00120 //[-------------------------------------------------------] 00121 private: 00122 int m_nID; /**< Event ID */ 00123 PLCore::uint32 m_nFrame; /**< Frame causing this event */ 00124 00125 00126 //[-------------------------------------------------------] 00127 //[ Public virtual PLCore::Element functions ] 00128 //[-------------------------------------------------------] 00129 public: 00130 PLRENDERER_API virtual AnimationEvent &operator =(const AnimationEvent &cSource); 00131 00132 00133 }; 00134 00135 /** 00136 * @brief 00137 * Animation event manager 00138 */ 00139 class AnimationEventManager : public PLCore::ElementManager<AnimationEvent> { 00140 00141 00142 //[-------------------------------------------------------] 00143 //[ Private virtual PLCore::ElementManager functions ] 00144 //[-------------------------------------------------------] 00145 private: 00146 virtual AnimationEvent *CreateElement(const PLCore::String &sName) override; 00147 00148 00149 }; 00150 00151 00152 //[-------------------------------------------------------] 00153 //[ Namespace ] 00154 //[-------------------------------------------------------] 00155 } // PLRenderer 00156 00157 00158 //[-------------------------------------------------------] 00159 //[ Implementation ] 00160 //[-------------------------------------------------------] 00161 #include "PLRenderer/Animation/AnimationEvent.inl" 00162 00163 00164 #endif // __PLRENDERER_ANIMATIONEVENT_H__
|