PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SNMMoveController.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 __PLENGINE_CONTROLLER_SNMMOVECONTROLLER_H__ 00024 #define __PLENGINE_CONTROLLER_SNMMOVECONTROLLER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/Base/Event/EventHandler.h> 00032 #include <PLScene/Scene/SceneNodeModifiers/SNMTransform.h> 00033 #include "PLEngine/PLEngine.h" 00034 00035 00036 //[-------------------------------------------------------] 00037 //[ Namespace ] 00038 //[-------------------------------------------------------] 00039 namespace PLEngine { 00040 00041 00042 //[-------------------------------------------------------] 00043 //[ Forward declarations ] 00044 //[-------------------------------------------------------] 00045 class MoveController; 00046 00047 00048 //[-------------------------------------------------------] 00049 //[ Classes ] 00050 //[-------------------------------------------------------] 00051 /** 00052 * @brief 00053 * Scene node move input controller modifier class 00054 * 00055 * @remarks 00056 * When using the unchanged virtual standard controller: 00057 * Use a/w/d/s or cursor keys to walk. 'PageUp/PageDown' to move upwards/downwards. 00058 * Hold the 'shift'-key to speed up, hold the 'strg'-key to slow down. 00059 * 00060 * @note 00061 * - Primary intended for rapid prototyping 00062 */ 00063 class SNMMoveController : public PLScene::SNMTransform { 00064 00065 00066 //[-------------------------------------------------------] 00067 //[ RTTI interface ] 00068 //[-------------------------------------------------------] 00069 pl_class(PL_RTTI_EXPORT, SNMMoveController, "PLEngine", PLScene::SNMTransform, "Scene node move input controller modifier class") 00070 // Attributes 00071 pl_attribute(InputSemantic, PLCore::String, "", ReadWrite, DirectValue, "Semantic of this input controller (e.g. \"Camera\")", "") 00072 pl_attribute(Speed, float, 1.0f, ReadWrite, DirectValue, "Movement speed", "Min='0.0001'") 00073 // Constructors 00074 pl_constructor_1(ParameterConstructor, PLScene::SceneNode&, "Parameter constructor", "") 00075 pl_class_end 00076 00077 00078 //[-------------------------------------------------------] 00079 //[ Public functions ] 00080 //[-------------------------------------------------------] 00081 public: 00082 /** 00083 * @brief 00084 * Constructor 00085 * 00086 * @param[in] cSceneNode 00087 * Owner scene node 00088 */ 00089 PL_API SNMMoveController(PLScene::SceneNode &cSceneNode); 00090 00091 /** 00092 * @brief 00093 * Destructor 00094 */ 00095 PL_API virtual ~SNMMoveController(); 00096 00097 00098 //[-------------------------------------------------------] 00099 //[ Public virtual PLScene::SceneNodeModifier functions ] 00100 //[-------------------------------------------------------] 00101 public: 00102 PL_API virtual PLInput::Controller *GetInputController() const override; 00103 00104 00105 //[-------------------------------------------------------] 00106 //[ Protected virtual PLScene::SceneNodeModifier functions ] 00107 //[-------------------------------------------------------] 00108 protected: 00109 PL_API virtual void InformedOnInit() override; 00110 PL_API virtual void OnActivate(bool bActivate) override; 00111 00112 00113 //[-------------------------------------------------------] 00114 //[ Private functions ] 00115 //[-------------------------------------------------------] 00116 private: 00117 /** 00118 * @brief 00119 * Called when the scene node modifier needs to be updated 00120 */ 00121 void OnUpdate(); 00122 00123 00124 //[-------------------------------------------------------] 00125 //[ Private event handlers ] 00126 //[-------------------------------------------------------] 00127 private: 00128 PLCore::EventHandler<> EventHandlerUpdate; 00129 00130 00131 //[-------------------------------------------------------] 00132 //[ Private data ] 00133 //[-------------------------------------------------------] 00134 private: 00135 MoveController *m_pController; /**< Move input controller instance, always valid! */ 00136 00137 00138 }; 00139 00140 00141 //[-------------------------------------------------------] 00142 //[ Namespace ] 00143 //[-------------------------------------------------------] 00144 } // PLEngine 00145 00146 00147 #endif // __PLENGINE_CONTROLLER_SNMMOVECONTROLLER_H__
|