11#include <SFML/Graphics.hpp>
12#include <SFML/Window/Joystick.hpp>
24 sf::RenderWindow& window)
25 : _r(r), _uiRegistry(uiRegistry), _settings(settings), _net(
net), _window(window) {}
35 auto &inputs = inputsOpt.value().get();
36 for (
const auto &e : inputs.entities()) {
37 if (inputs[e].isFocused) {
68 if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::P))
76 float axisX = sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::X);
77 float axisY = sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::Y);
79 if (axisY < -deadzone)
83 if (axisX < -deadzone)
89 float povX = sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::PovX);
90 float povY = sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::PovY);
119 log::info(
"Sending InputTick with mask: {}", (
int)mask);
132 log::error(
"Failed to spawn sound event entity");
137 shootSound.
soundPath =
"assets/sounds/shoot.wav";
void sendPacket(const net::Packet &packet, net::NetworkMode mode)
Send a packet to the server.
bool isUdpReady(void) const
Check if UDP socket is ready.
Manages game settings and preferences.
unsigned int getGamepadReloadButton() const
sf::Keyboard::Key getKey(KeyAction action) const
bool getGamepadEnabled() const
unsigned int getGamepadShootButton() const
float getSfxVolume() const
float getGamepadDeadzone() const
Represents an entity in the ECS (Entity-Component-System) architecture.
auto spawn(void) -> std::expected< Entity, rtp::Error >
auto add(Entity entity, Args &&...args) -> std::expected< std::reference_wrapper< T >, rtp::Error >
auto get(this const Self &self) -> std::expected< std::reference_wrapper< ConstLike< Self, SparseArray< T > > >, rtp::Error >
Network packet with header and serializable body.
File : Network.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias-josue.hajjar-llauquen@epit...
@ Reload
Action for reloading.
@ MoveRight
Action for moving right.
@ MoveDown
Action for moving down.
@ MoveUp
Action for moving up.
@ Shoot
Action for shooting.
@ MoveLeft
Action for moving left.
void error(LogFmt< std::type_identity_t< Args >... > fmt, Args &&...args) noexcept
Log an error message.
void info(LogFmt< std::type_identity_t< Args >... > fmt, Args &&...args) noexcept
Log an informational message.
@ InputTick
Client input state.
Component for triggering one-time sound effects (SFX)
float volume
Volume level (0.0 - 1.0)
std::string soundPath
Path to the sound file.