|
R-Type
Distributed multiplayer game engine in C++
|
R-Type client application. More...
#include <Client.hpp>

Public Member Functions | |
| Client (const std::string &playerName, const std::string &host, uint16_t port, bool isSpectator=false) | |
| Constructor. | |
| Client (const std::string &playerName, const std::string &username, const std::string &password, const std::string &host, uint16_t port) | |
| Constructor with authentication. | |
| ~Client () | |
| Destructor - clean shutdown. | |
| bool | initialize () |
| Initialize client systems. | |
| void | run () |
| Run the client (Start Game Loop directly) | |
| void | stop () |
| Stop the client. | |
| void | SetCredentials (const std::string &username, const std::string &password) |
| Update credentials for next connection attempt. | |
| void | SetServer (const std::string &host, uint16_t port) |
| Set server address and port. | |
| bool | Connect () |
| Connect to the configured server. | |
Private Member Functions | |
| bool | connectToServer () |
| Connect to server. | |
Private Attributes | |
| std::string | _playerName |
| std::string | _username |
| std::string | _password |
| std::string | _serverHost |
| uint16_t | _serverPort |
| bool | _isSpectator |
| std::unique_ptr< EventBus > | _eventBus |
| std::unique_ptr< Replicator > | _replicator |
| std::unique_ptr< GameLoop > | _gameLoop |
| bool | _initialized = false |
R-Type client application.
Encapsulates the entire client:
Usage:
Definition at line 40 of file Client.hpp.
| Client::Client | ( | const std::string & | playerName, |
| const std::string & | host, | ||
| uint16_t | port, | ||
| bool | isSpectator = false |
||
| ) |
Constructor.
| playerName | Player's name |
| host | Server hostname/IP |
| port | Server port |
| isSpectator | Whether this client is in spectator mode |
Definition at line 10 of file Client.cpp.
| Client::Client | ( | const std::string & | playerName, |
| const std::string & | username, | ||
| const std::string & | password, | ||
| const std::string & | host, | ||
| uint16_t | port | ||
| ) |
Constructor with authentication.
| playerName | Player's display name |
| username | Username for authentication |
| password | Password for authentication |
| host | Server hostname/IP |
| port | Server port |
Definition at line 18 of file Client.cpp.
| Client::~Client | ( | ) |
Destructor - clean shutdown.
Definition at line 27 of file Client.cpp.
References _gameLoop, _replicator, deinitializeNetworking(), and LOG_INFO.

| bool Client::Connect | ( | ) |
Connect to the configured server.
Definition at line 85 of file Client.cpp.
References connectToServer().
Referenced by run().

|
private |
Connect to server.
Definition at line 89 of file Client.cpp.
References _password, _playerName, _replicator, _serverHost, _serverPort, _username, LOG_ERROR, and LOG_INFO.
Referenced by Connect().
| bool Client::initialize | ( | ) |
Initialize client systems.
Definition at line 38 of file Client.cpp.
References _eventBus, _gameLoop, _initialized, _isSpectator, _playerName, _replicator, initializeNetworking(), LOG_ERROR, and LOG_INFO.

| void Client::run | ( | ) |
Run the client (Start Game Loop directly)
Definition at line 149 of file Client.cpp.
References _eventBus, _gameLoop, _initialized, _isSpectator, _playerName, Connect(), CONNECTION_FAILED, CONNECTION_SUCCESS, LOG_ERROR, LOG_INFO, SERVER_CONNECT, and SetServer().

| void Client::SetCredentials | ( | const std::string & | username, |
| const std::string & | password | ||
| ) |
Update credentials for next connection attempt.
Definition at line 74 of file Client.cpp.
| void Client::SetServer | ( | const std::string & | host, |
| uint16_t | port | ||
| ) |
Set server address and port.
Definition at line 79 of file Client.cpp.
References _serverHost, _serverPort, and LOG_INFO.
Referenced by run().
| void Client::stop | ( | ) |
|
private |
Definition at line 115 of file Client.hpp.
Referenced by initialize(), and run().
|
private |
Definition at line 117 of file Client.hpp.
Referenced by initialize(), run(), stop(), and ~Client().
|
private |
Definition at line 119 of file Client.hpp.
Referenced by initialize(), and run().
|
private |
Definition at line 113 of file Client.hpp.
Referenced by initialize(), and run().
|
private |
Definition at line 110 of file Client.hpp.
Referenced by connectToServer(), and SetCredentials().
|
private |
Definition at line 108 of file Client.hpp.
Referenced by connectToServer(), initialize(), and run().
|
private |
Definition at line 116 of file Client.hpp.
Referenced by connectToServer(), initialize(), and ~Client().
|
private |
Definition at line 111 of file Client.hpp.
Referenced by connectToServer(), and SetServer().
|
private |
Definition at line 112 of file Client.hpp.
Referenced by connectToServer(), and SetServer().
|
private |
Definition at line 109 of file Client.hpp.
Referenced by connectToServer(), and SetCredentials().