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 #include "LampBasic.h" 00026 #include "Input/Pad/Pad.h" 00027 #include "Input/Joystick/Joystick.h" 00028 00029 namespace Lamp{ 00030 00031 //------------------------------------------------------------------------------ 00032 // コンストラクタ 00033 Pad::Pad(Joystick* joystick) : joystick_(joystick){ 00034 Assert(joystick_ != NULL); 00035 } 00036 //------------------------------------------------------------------------------ 00037 // デストラクタ 00038 Pad::~Pad(){ 00039 } 00040 //------------------------------------------------------------------------------ 00041 // 名前の取得 00042 String Pad::getName() const{ 00043 return joystick_->getName(); 00044 } 00045 //------------------------------------------------------------------------------ 00046 // アタッチされているか 00047 bool Pad::isAttached() const{ 00048 return joystick_->isAttached(); 00049 } 00050 //------------------------------------------------------------------------------ 00051 // クリア 00052 void Pad::clear(){ 00053 joystick_->clear(); 00054 } 00055 //------------------------------------------------------------------------------ 00056 // 協調レベルの設定 00057 bool Pad::setCooperativeLevel(bool exclusive, bool foreground){ 00058 return joystick_->setCooperativeLevel(exclusive, foreground); 00059 } 00060 //------------------------------------------------------------------------------ 00061 // 排他モードか 00062 bool Pad::isExclusive() const{ 00063 return joystick_->isExclusive(); 00064 } 00065 //------------------------------------------------------------------------------ 00066 // フォアグラウンドモードか 00067 bool Pad::isForeground() const{ 00068 return joystick_->isForeground(); 00069 } 00070 //------------------------------------------------------------------------------ 00071 // 文字列への変換 00072 String Pad::toString() const{ 00073 String result; 00074 result += getName() + " ("; 00075 if(isExclusive()){ result += " Exclusive"; } 00076 else{ result += " NonExclusive"; } 00077 if(isForeground()){ result += " Foreground"; } 00078 else{ result += " Background"; } 00079 if(isAttached()){ result += " Attached"; } 00080 result += " )\n"; 00081 return result; 00082 } 00083 //------------------------------------------------------------------------------ 00084 } // End of namespace Lamp 00085 //------------------------------------------------------------------------------