R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
UIEvent.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** rtype
4** File description:
5** UIEvent.hpp - Events triggered by UI interactions
6*/
7
8#pragma once
9
10#include <string>
11#include <vector>
12#include "Events/IEvent.hpp"
13
14// Room data structure for events
15struct RoomData {
16 std::string roomId;
17 std::string roomName;
18 uint32_t playerCount;
19 uint32_t maxPlayers;
21 uint8_t state;
22};
23
24enum class UIEventType {
33 AUTO_MATCHMAKING, // Auto-matchmaking request (trigger matchmaking)
34 UPDATE_AUTO_MATCHMAKING_PREF, // Update auto-matchmaking preference on server
35 APPLY_AUTO_MATCHMAKING_PREF, // Apply auto-matchmaking preference to settings menu
43 REGISTER_ACCOUNT, // data format: "username:password"
44 REGISTER_SUCCESS, // data format: success message
45 REGISTER_FAILED, // data format: error message
46 LOGIN_ACCOUNT, // data format: "username:password"
47 LOGIN_FAILED, // data format: error message
48 AUTH_SUCCESS // data format: authenticated username (e.g., "lucas" or "guest_a3f2")
49};
50
51class UIEvent : public IEvent {
52 public:
53 explicit UIEvent(UIEventType type, const std::string &data = "") : _type(type), _data(data) {}
54
55 [[nodiscard]] UIEventType getType() const { return _type; }
56 [[nodiscard]] const std::string &getData() const { return _data; }
57
58 private:
60 std::string _data;
61};
UIEventType
Definition UIEvent.hpp:24
@ APPLY_AUTO_MATCHMAKING_PREF
@ UPDATE_AUTO_MATCHMAKING_PREF
Base interface for all event types.
Definition IEvent.hpp:26
const std::string & getData() const
Definition UIEvent.hpp:56
UIEvent(UIEventType type, const std::string &data="")
Definition UIEvent.hpp:53
std::string _data
Definition UIEvent.hpp:60
UIEventType getType() const
Definition UIEvent.hpp:55
UIEventType _type
Definition UIEvent.hpp:59
uint32_t playerCount
Definition UIEvent.hpp:18
std::string roomName
Definition UIEvent.hpp:17
bool isPrivate
Definition UIEvent.hpp:20
std::string roomId
Definition UIEvent.hpp:16
uint32_t maxPlayers
Definition UIEvent.hpp:19
uint8_t state
Definition UIEvent.hpp:21