Allowing players to join the lobby

This commit is contained in:
Zoe Roux
2021-06-11 12:15:51 +02:00
21 changed files with 180 additions and 64 deletions
@@ -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);