PixelLightAPI  .
SNMDeactivationOnTimeout.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SNMDeactivationOnTimeout.h                     *
00003  *
00004  *  Copyright (C) 2002-2011 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 __PLSCENE_SCENENODEMODIFIER_DEACTIVATIONONTIMEOUT_H__
00024 #define __PLSCENE_SCENENODEMODIFIER_DEACTIVATIONONTIMEOUT_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLScene/Scene/SceneNodeModifier.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLScene {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Deactivation on timeout scene node modifier class
00046 *
00047 *  @remarks
00048 *    Deactivates the owner scene node after the given timeout.
00049 */
00050 class SNMDeactivationOnTimeout : public SceneNodeModifier {
00051 
00052 
00053     //[-------------------------------------------------------]
00054     //[ RTTI interface                                        ]
00055     //[-------------------------------------------------------]
00056     pl_class(PLS_RTTI_EXPORT, SNMDeactivationOnTimeout, "PLScene", PLScene::SceneNodeModifier, "Deactivation on timeout scene node modifier class")
00057         // Attributes
00058         pl_attribute(Timeout,   float,  5.0f,   ReadWrite,  GetSet, "Timeout in seconds (if value set=restart)",    "")
00059         // Constructors
00060         pl_constructor_1(ParameterConstructor,  SceneNode&, "Parameter constructor",    "")
00061         // Slots
00062         pl_slot_0(OnUpdate, "Called when the scene node modifier needs to be updated",  "")
00063     pl_class_end
00064 
00065 
00066     //[-------------------------------------------------------]
00067     //[ Public RTTI get/set functions                         ]
00068     //[-------------------------------------------------------]
00069     public:
00070         PLS_API float GetTimeout() const;
00071         PLS_API void SetTimeout(float fValue);
00072 
00073 
00074     //[-------------------------------------------------------]
00075     //[ Public functions                                      ]
00076     //[-------------------------------------------------------]
00077     public:
00078         /**
00079         *  @brief
00080         *    Constructor
00081         *
00082         *  @param[in] cSceneNode
00083         *    Owner scene node
00084         */
00085         PLS_API SNMDeactivationOnTimeout(SceneNode &cSceneNode);
00086 
00087         /**
00088         *  @brief
00089         *    Destructor
00090         */
00091         PLS_API virtual ~SNMDeactivationOnTimeout();
00092 
00093 
00094     //[-------------------------------------------------------]
00095     //[ Protected virtual SceneNodeModifier functions         ]
00096     //[-------------------------------------------------------]
00097     protected:
00098         PLS_API virtual void OnActivate(bool bActivate) override;
00099 
00100 
00101     //[-------------------------------------------------------]
00102     //[ Private functions                                     ]
00103     //[-------------------------------------------------------]
00104     private:
00105         /**
00106         *  @brief
00107         *    Called when the scene node modifier needs to be updated
00108         */
00109         void OnUpdate();
00110 
00111 
00112     //[-------------------------------------------------------]
00113     //[ Private data                                          ]
00114     //[-------------------------------------------------------]
00115     private:
00116         float m_fTimeout;
00117         float m_fTimer;
00118 
00119 
00120 };
00121 
00122 
00123 //[-------------------------------------------------------]
00124 //[ Namespace                                             ]
00125 //[-------------------------------------------------------]
00126 } // PLScene
00127 
00128 
00129 #endif // __PLSCENE_SCENENODEMODIFIER_DEACTIVATIONONTIMEOUT_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:02
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported