mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-05 10:59:48 +00:00
Allowing players to join the lobby
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// Edited by Benjamin Henry on 2021-05-20.
|
||||
//
|
||||
|
||||
#include <Component/Controllable/ControllableComponent.hpp>
|
||||
#include "GamepadComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
@@ -31,4 +32,27 @@ namespace BBM
|
||||
return this->_ID;
|
||||
}
|
||||
|
||||
void GamepadComponent::onStart()
|
||||
{
|
||||
auto *controller = this->_entity.tryGetComponent<ControllableComponent>();
|
||||
if (!controller)
|
||||
return;
|
||||
switch (this->_ID) {
|
||||
case 0:
|
||||
controller->layout = ControllableComponent::GAMEPAD_0;
|
||||
break;
|
||||
case 1:
|
||||
controller->layout = ControllableComponent::GAMEPAD_1;
|
||||
break;
|
||||
case 2:
|
||||
controller->layout = ControllableComponent::GAMEPAD_2;
|
||||
break;
|
||||
case 3:
|
||||
controller->layout = ControllableComponent::GAMEPAD_3;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace BMM
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace BBM
|
||||
//! @inherit
|
||||
WAL::Component *clone(WAL::Entity &entity) const override;
|
||||
|
||||
void onStart() override;
|
||||
|
||||
//! @brief Create a new gampad component using default keys.
|
||||
explicit GamepadComponent(WAL::Entity &entity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user