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

Lamp::PS2Pad Class Reference

PS2互換パッド. More...

#include <PS2Pad.h>

Inheritance diagram for Lamp::PS2Pad:

Lamp::Pad List of all members.

Public Types

enum  Button {
  button0 = 0, button1, button2, button3,
  buttonL2, buttonR2, buttonL1, buttonR1,
  buttonStart, buttonSelect, buttonL3, buttonR3,
  buttonPOVUp, buttonPOVRight, buttonPOVDown, buttonPOVLeft,
  maxButtonCount, buttonUnknown = -1, buttonSankaku = 0, buttonMaru = 1,
  buttonBatu = 2, buttonSikaku = 3
}
 ボタン


Public Member Functions

 PS2Pad (Joystick *joystick)
 コンストラクタ

virtual ~PS2Pad ()
 デストラクタ

virtual void changeButtonMap (Button button, int id)
 ボタンマップの変更

virtual int getButtonMap (const Button button)
 ボタンマップの取得

virtual Point2f getLeftAxis () const
 左軸の取得

virtual float getLeftXAxis () const
 左X軸の取得

virtual float getLeftYAxis () const
 左Y軸の取得

virtual Point2f getRightAxis () const
 右軸の取得

virtual float getRightXAxis () const
 右X軸の取得

virtual float getRightYAxis () const
 右Y軸の取得

virtual bool upKeyPressed () const
 上キーが押されているか

virtual bool upKeyDown () const
 上キーが下がった

virtual bool upKeyUp () const
 上キーが上がった

virtual bool downKeyPressed () const
 下キーが押されているか

virtual bool downKeyDown () const
 下キーが下がった

virtual bool downKeyUp () const
 下キーが上がった

virtual bool leftKeyPressed () const
 左キーが押されているか

virtual bool leftKeyDown () const
 左キーが下がった

virtual bool leftKeyUp () const
 左キーが上がった

virtual bool rightKeyPressed () const
 右キーが押されているか

virtual bool rightKeyDown () const
 右キーが下がった

virtual bool rightKeyUp () const
 右キーが上がった

virtual bool buttonPressed (Button button) const
 ボタンが押されているか

virtual bool buttonDown (Button button) const
 ボタンが下がった

virtual bool buttonUp (Button button) const
 ボタンが上がった

virtual String toString () const
 文字列への変換


Static Public Member Functions

bool checkCompatibility (Joystick *joystick)
 互換性チェック

String getButtonString (Button button)
 ボタン文字列の取得


Protected Member Functions

bool povToUpKey (int pov) const
 視点コントローラ値から上キーへの変換

bool povToDownKey (int pov) const
 視点コントローラ値から下キーへの変換

bool povToLeftKey (int pov) const
 視点コントローラ値から左キーへの変換

bool povToRightKey (int pov) const
 視点コントローラ値から右キーへの変換


Protected Attributes

int buttonMap_ [maxButtonCount]
 ボタンマップ

bool isSmartJoypad_
 スマートジョイパッドフラグ


Static Protected Attributes

const int deg45 = 4500
 視点コントローラにおける45度


Detailed Description

PS2互換パッド.

主にELECOM、LOASのPS2コントローラ変換ケーブルを使用した場合に対応している。 FFXI互換を謳っているUSBパッドはボタン並びが違っている模様。 SmartJoypadにも対応、Z軸、Z回転の扱いが逆になり、十字キーをボタンで認識している。

Definition at line 40 of file PS2Pad.h.


Constructor & Destructor Documentation

Lamp::PS2Pad::PS2Pad Joystick joystick  ) 
 

コンストラクタ

Parameters:
joystick 使用するジョイスティック

Definition at line 53 of file PS2Pad.cpp.

References Assert, buttonMap_, changeButtonMap(), checkCompatibility(), Lamp::Joystick::getPOVCount(), isSmartJoypad_, and Lamp::Pad::joystick_.


Member Function Documentation

bool Lamp::PS2Pad::buttonDown Button  button  )  const [virtual]
 

ボタンが下がった

Parameters:
button ボタン
Returns:
ボタンが下がったならばtrue

Definition at line 199 of file PS2Pad.cpp.

References Assert, Lamp::Joystick::buttonDown(), buttonMap_, and Lamp::Pad::joystick_.

Referenced by Lamp::PS2PadCameraController::control(), downKeyDown(), leftKeyDown(), rightKeyDown(), toString(), and upKeyDown().

bool Lamp::PS2Pad::buttonPressed Button  button  )  const [virtual]
 

ボタンが押されているか

Parameters:
button ボタン
Returns:
ボタンが押されていればtrue

Definition at line 193 of file PS2Pad.cpp.

References Assert, buttonMap_, Lamp::Joystick::buttonPressed(), and Lamp::Pad::joystick_.

Referenced by Lamp::PS2PadCameraController::control(), downKeyPressed(), leftKeyPressed(), rightKeyPressed(), toString(), and upKeyPressed().

bool Lamp::PS2Pad::buttonUp Button  button  )  const [virtual]
 

ボタンが上がった

Parameters:
button ボタン
Returns:
ボタンが上がったならばtrue

Definition at line 205 of file PS2Pad.cpp.

References Assert, buttonMap_, Lamp::Joystick::buttonUp(), and Lamp::Pad::joystick_.

Referenced by downKeyUp(), leftKeyUp(), rightKeyUp(), toString(), and upKeyUp().

void Lamp::PS2Pad::changeButtonMap Button  button,
int  id
[virtual]
 

ボタンマップの変更

Parameters:
button ボタンマップを変更するボタン
id 変更するボタンID

Definition at line 74 of file PS2Pad.cpp.

References Assert, and buttonMap_.

Referenced by PS2Pad().

bool Lamp::PS2Pad::checkCompatibility Joystick joystick  )  [static]
 

互換性チェック

Parameters:
joystick 互換性をチェックするジョイスティック
Returns:
互換性があればtrueを返す

Definition at line 33 of file PS2Pad.cpp.

References Lamp::Joystick::getButtonCount(), Lamp::Joystick::getPOVCount(), Lamp::Joystick::hasXAxis(), Lamp::Joystick::hasYAxis(), Lamp::Joystick::hasZAxis(), and Lamp::Joystick::hasZRotation().

Referenced by PS2Pad().

bool Lamp::PS2Pad::downKeyDown  )  const [virtual]
 

下キーが下がった

Returns:
下キーが下がったならばtrue

Definition at line 137 of file PS2Pad.cpp.

References buttonDown(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToDownKey().

Referenced by Lamp::PS2PadCameraController::control(), and toString().

bool Lamp::PS2Pad::downKeyPressed  )  const [virtual]
 

下キーが押されているか

Returns:
下キーが押されていればtrue

Definition at line 131 of file PS2Pad.cpp.

References buttonPressed(), Lamp::Joystick::getPOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToDownKey().

Referenced by toString().

bool Lamp::PS2Pad::downKeyUp  )  const [virtual]
 

下キーが上がった

Returns:
下キーが上がったならばtrue

Definition at line 144 of file PS2Pad.cpp.

References buttonUp(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToDownKey().

Referenced by toString().

virtual int Lamp::PS2Pad::getButtonMap const Button  button  )  [inline, virtual]
 

ボタンマップの取得

Parameters:
button ボタンマップを取得するボタン
Returns:
ボタンID

Definition at line 104 of file PS2Pad.h.

References Assert, and buttonMap_.

String Lamp::PS2Pad::getButtonString Button  button  )  [static]
 

ボタン文字列の取得

Parameters:
button ボタン
Returns:
ボタン文字列

Definition at line 213 of file PS2Pad.cpp.

References Assert.

virtual Point2f Lamp::PS2Pad::getLeftAxis  )  const [inline, virtual]
 

左軸の取得

Returns:
左軸

Definition at line 116 of file PS2Pad.h.

References getLeftXAxis(), and getLeftYAxis().

Referenced by Lamp::PS2PadCameraController::control().

float Lamp::PS2Pad::getLeftXAxis  )  const [virtual]
 

左X軸の取得

Returns:
左X軸

Definition at line 87 of file PS2Pad.cpp.

References Lamp::Joystick::getXAxis(), and Lamp::Pad::joystick_.

Referenced by getLeftAxis(), and toString().

float Lamp::PS2Pad::getLeftYAxis  )  const [virtual]
 

左Y軸の取得

Returns:
左Y軸

Definition at line 92 of file PS2Pad.cpp.

References Lamp::Joystick::getYAxis(), and Lamp::Pad::joystick_.

Referenced by getLeftAxis(), and toString().

virtual Point2f Lamp::PS2Pad::getRightAxis  )  const [inline, virtual]
 

右軸の取得

Returns:
右軸

Definition at line 137 of file PS2Pad.h.

References getRightXAxis(), and getRightYAxis().

Referenced by Lamp::PS2PadCameraController::control().

float Lamp::PS2Pad::getRightXAxis  )  const [virtual]
 

右X軸の取得

Returns:
右X軸

Definition at line 97 of file PS2Pad.cpp.

References Lamp::Joystick::getZAxis(), Lamp::Joystick::getZRotation(), isSmartJoypad_, and Lamp::Pad::joystick_.

Referenced by getRightAxis(), and toString().

float Lamp::PS2Pad::getRightYAxis  )  const [virtual]
 

右Y軸の取得

Returns:
右Y軸

Definition at line 103 of file PS2Pad.cpp.

References Lamp::Joystick::getZAxis(), Lamp::Joystick::getZRotation(), isSmartJoypad_, and Lamp::Pad::joystick_.

Referenced by getRightAxis(), and toString().

bool Lamp::PS2Pad::leftKeyDown  )  const [virtual]
 

左キーが下がった

Returns:
左キーが下がったならばtrue

Definition at line 157 of file PS2Pad.cpp.

References buttonDown(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToLeftKey().

Referenced by toString().

bool Lamp::PS2Pad::leftKeyPressed  )  const [virtual]
 

左キーが押されているか

Returns:
左キーが押されていればtrue

Definition at line 151 of file PS2Pad.cpp.

References buttonPressed(), Lamp::Joystick::getPOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToLeftKey().

Referenced by toString().

bool Lamp::PS2Pad::leftKeyUp  )  const [virtual]
 

左キーが上がった

Returns:
左キーが上がったならばtrue

Definition at line 164 of file PS2Pad.cpp.

References buttonUp(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToLeftKey().

Referenced by toString().

bool Lamp::PS2Pad::povToDownKey int  pov  )  const [inline, protected]
 

視点コントローラ値から下キーへの変換

Parameters:
pov 視点コントローラ値
Returns:
下キーが押されていればtrue

Definition at line 289 of file PS2Pad.h.

References deg45.

Referenced by downKeyDown(), downKeyPressed(), and downKeyUp().

bool Lamp::PS2Pad::povToLeftKey int  pov  )  const [inline, protected]
 

視点コントローラ値から左キーへの変換

Parameters:
pov 視点コントローラ値
Returns:
左キーが押されていればtrue

Definition at line 299 of file PS2Pad.h.

References deg45.

Referenced by leftKeyDown(), leftKeyPressed(), and leftKeyUp().

bool Lamp::PS2Pad::povToRightKey int  pov  )  const [inline, protected]
 

視点コントローラ値から右キーへの変換

Parameters:
pov 視点コントローラ値
Returns:
右キーが押されていればtrue

Definition at line 309 of file PS2Pad.h.

References deg45.

Referenced by rightKeyDown(), rightKeyPressed(), and rightKeyUp().

bool Lamp::PS2Pad::povToUpKey int  pov  )  const [inline, protected]
 

視点コントローラ値から上キーへの変換

Parameters:
pov 視点コントローラ値
Returns:
上キーが押されていればtrue

Definition at line 278 of file PS2Pad.h.

References deg45.

Referenced by upKeyDown(), upKeyPressed(), and upKeyUp().

bool Lamp::PS2Pad::rightKeyDown  )  const [virtual]
 

右キーが下がった

Returns:
右キーが下がったならばtrue

Definition at line 177 of file PS2Pad.cpp.

References buttonDown(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToRightKey().

Referenced by toString().

bool Lamp::PS2Pad::rightKeyPressed  )  const [virtual]
 

右キーが押されているか

Returns:
右キーが押されていればtrue

Definition at line 171 of file PS2Pad.cpp.

References buttonPressed(), Lamp::Joystick::getPOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToRightKey().

Referenced by toString().

bool Lamp::PS2Pad::rightKeyUp  )  const [virtual]
 

右キーが上がった

Returns:
右キーが上がったならばtrue

Definition at line 184 of file PS2Pad.cpp.

References buttonUp(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToRightKey().

Referenced by toString().

String Lamp::PS2Pad::toString  )  const [virtual]
 

文字列への変換

Returns:
文字列

Reimplemented from Lamp::Pad.

Definition at line 224 of file PS2Pad.cpp.

References buttonDown(), buttonPressed(), buttonUp(), downKeyDown(), downKeyPressed(), downKeyUp(), Lamp::String::format(), getLeftXAxis(), getLeftYAxis(), getRightXAxis(), getRightYAxis(), leftKeyDown(), leftKeyPressed(), leftKeyUp(), rightKeyDown(), rightKeyPressed(), rightKeyUp(), upKeyDown(), upKeyPressed(), and upKeyUp().

bool Lamp::PS2Pad::upKeyDown  )  const [virtual]
 

上キーが下がった

Returns:
上キーが下がったならばtrue

Definition at line 117 of file PS2Pad.cpp.

References buttonDown(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToUpKey().

Referenced by Lamp::PS2PadCameraController::control(), and toString().

bool Lamp::PS2Pad::upKeyPressed  )  const [virtual]
 

上キーが押されているか

Returns:
上キーが押されていればtrue

Definition at line 111 of file PS2Pad.cpp.

References buttonPressed(), Lamp::Joystick::getPOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToUpKey().

Referenced by toString().

bool Lamp::PS2Pad::upKeyUp  )  const [virtual]
 

上キーが上がった

Returns:
上キーが上がったならばtrue

Definition at line 124 of file PS2Pad.cpp.

References buttonUp(), Lamp::Joystick::getPOV(), Lamp::Joystick::getPrePOV(), isSmartJoypad_, Lamp::Pad::joystick_, and povToUpKey().

Referenced by toString().


The documentation for this class was generated from the following files:
Generated on Wed Mar 16 10:29:50 2005 for Lamp by doxygen 1.3.2