本文整理汇总了C++中DevicePtr::getButton方法的典型用法代码示例。如果您正苦于以下问题:C++ DevicePtr::getButton方法的具体用法?C++ DevicePtr::getButton怎么用?C++ DevicePtr::getButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevicePtr
的用法示例。
在下文中一共展示了DevicePtr::getButton方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeControll
PlayerBehavior::CONTROLL PlayerBehavior::makeControll( ) {
PlayerBehavior::CONTROLL controll;
if ( _controll ) {
// 自分で動かす
DevicePtr device = Device::getTask( );
unsigned char button = device->getButton( );
CameraPtr camera = Camera::getTask( );
PlayerCameraPtr p_camera = std::dynamic_pointer_cast< PlayerCamera >( camera );
Vector move_vec = p_camera->getConvertDeviceVec( );
Character::STATUS status = _parent->getStatus( );
move_vec = move_vec.normalize( ) * status.speed;//プレイヤーの進行ベクトル
controll.move = move_vec;
if ( button & BUTTON_D ) {
controll.action = CONTROLL::DEATHBLOW;
} else if ( button & BUTTON_A ) {
controll.action = CONTROLL::ATTACK;
} else {
controll.action = CONTROLL::NONE;
}
} else {
// ネットから動かす
ClientPtr client = Client::getTask( );
CLIENTDATA data = client->getClientData( );
Vector target;
target.x = data.player[ _player_id ].x;
target.y = data.player[ _player_id ].y;
Vector vec = target - _parent->getPos( );
Character::STATUS status = _parent->getStatus( );
if ( vec.getLength( ) > status.speed * 2 ) {
vec = vec.normalize( ) * status.speed;
controll.move = vec;
}
switch ( data.player[ _player_id ].action ) {
case ACTION_NONE:
controll.action = CONTROLL::NONE;
break;
case ACTION_ATTACK:
controll.action = CONTROLL::ATTACK;
break;
case ACTION_DEATHBLOW:
controll.action = CONTROLL::MUSTDEATHBLOW;
break;
}
}
return controll;
}