00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- 00002 00003 this file is part of rcssserver3D 00004 Fri May 9 2003 00005 Copyright (C) 2002,2003 Koblenz University 00006 Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group 00007 $Id: inputsystem.h,v 1.6 2004/04/23 20:19:42 fruit Exp $ 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; version 2 of the License. 00012 00013 This program 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 General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 #ifndef KEROSIN_INPUTSYSTEM_H 00023 #define KEROSIN_INPUTSYSTEM_H 00024 00025 /* \class InputSystem 00026 00027 An input system is the basic abstraction for an input API. You would 00028 want to have a specific input system for SDL, DirectX, Windows API, X, 00029 etc.. 00030 00031 The job of InputSystem is: 00032 - Initialize the input API 00033 - Initialize the inputcodes used in the InputServer 00034 - Handle the creation of individual devices 00035 00036 HISTORY: 21.08.02 - MK - Initial version 00037 */ 00038 00039 #include "inputserver.h" 00040 00041 #include <deque> 00042 #include <zeitgeist/node.h> 00043 00044 namespace kerosin 00045 { 00046 00047 class InputSystem : public zeitgeist::Node 00048 { 00049 // 00050 // functions 00051 // 00052 public: 00053 InputSystem(); 00054 virtual ~InputSystem(); 00055 00057 virtual bool Init(kerosin::InputServer* inputServer); 00058 00062 virtual bool CreateDevice(const std::string& deviceName) = 0; 00063 00069 virtual void AddInput(InputServer::Input& input); 00070 00074 void AddInputInternal(InputServer::Input& input); 00075 00077 virtual bool GetInput(InputServer::Input& input); 00078 00079 InputServer* GetInputServer() { return mInputServer; } 00080 00081 protected: 00082 virtual bool UpdateTimerInput(InputServer::Input &input); 00083 00084 // 00085 // members 00086 // 00087 protected: 00088 InputServer* mInputServer; 00089 00090 private: 00091 std::deque<InputServer::Input> mInputQueue; 00092 }; 00093 00094 DECLARE_ABSTRACTCLASS(InputSystem); 00095 00096 } // namespace kerosin 00097 00098 #endif //KEROSIN_INPUTSYSTEM_H