Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

MouseDevice.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Lamp : Open source game middleware
00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //------------------------------------------------------------------------------
00019 
00020 /** @file
00021  * マウスデバイスヘッダ
00022  * @author Junpee
00023  */
00024 
00025 #ifndef MOUSE_DEVICE_H_
00026 #define MOUSE_DEVICE_H_
00027 
00028 #include <Input/System/InputDevice.h>
00029 #include <Input/Mouse/MouseState.h>
00030 
00031 namespace Lamp{
00032 
00033 //------------------------------------------------------------------------------
00034 /**
00035  * マウスデバイス
00036  */
00037 class MouseDevice : public InputDevice{
00038 friend class LampInput;
00039 friend class BufferedInput;
00040 public:
00041     //--------------------------------------------------------------------------
00042     // 定数
00043     //--------------------------------------------------------------------------
00044     /// 最大ボタン数
00045     static const int maxButtonCount = MouseState::maxButtonCount;
00046 
00047     //--------------------------------------------------------------------------
00048     /**
00049      * マウスステートの取得
00050      * @return マウスステート
00051      */
00052     virtual const MouseState& getMouseState() const{ return mouseState_; }
00053 
00054     /**
00055      * Z解像度の取得
00056      * @return Z解像度
00057      */
00058     int getZResolution() const{ return zResolution_; }
00059 
00060     /**
00061      * 協調レベルの設定
00062      * @param exclusive 排他モードならtrue
00063      * @param foreground フォアグラウンドモードならtrue
00064      * @return 成功すればtrue
00065      */
00066     virtual bool setCooperativeLevel(bool exclusive, bool foreground){
00067         // 不正な組み合わせチェック
00068         Assert(!(exclusive && (!foreground)));
00069         return InputDevice::setCooperativeLevel(exclusive, foreground);
00070     }
00071 
00072     /**
00073      * 文字列への変換
00074      * @return 文字列
00075      */
00076     virtual String toString() const{
00077         String deviceString;
00078         deviceString.format("ZResolution %d\n", getZResolution());
00079         return getInputDeviceString() + deviceString + mouseState_.toString();
00080     }
00081 
00082 protected:
00083     //--------------------------------------------------------------------------
00084     /**
00085      * コンストラクタ
00086      */
00087     MouseDevice();
00088 
00089     /**
00090      * デストラクタ
00091      */
00092     virtual ~MouseDevice();
00093 
00094     /**
00095      * 初期化
00096      * @param inputDevice 入力デバイス
00097      * @param windowHandle ウィンドウハンドル
00098      * @return 成功すればtrue
00099      */
00100     virtual bool initialize(DirectInputDevice* inputDevice, HWND windowHandle);
00101 
00102     /**
00103      * ポーリング
00104      * @return ポーリングが正常であればtrue
00105      */
00106     virtual bool polling();
00107 
00108 private:
00109     // マウスステート
00110     MouseState mouseState_;
00111     // Z解像度
00112     int zResolution_;
00113 };
00114 
00115 //------------------------------------------------------------------------------
00116 } // End of namespace Lamp
00117 #endif // End of MOUSE_DEVICE_H_
00118 //------------------------------------------------------------------------------

Generated on Wed Mar 16 10:29:33 2005 for Lamp by doxygen 1.3.2