[Client] Preparing chunk request.
This commit is contained in:
parent
307a1bdb23
commit
c14e5ecd4d
2
TODO
2
TODO
@ -1,5 +1,7 @@
|
||||
TODO
|
||||
|
||||
• TODO: Use Faithful 32x for buttons, backgrounds and font (or use Minecraftia for the latter)
|
||||
|
||||
# Issues
|
||||
|
||||
• TODO: `Workbench` and `Furnace` are not scaled correctly with lower GUI scale settings
|
||||
|
@ -32,7 +32,7 @@ class Client {
|
||||
void connect(sf::IpAddress serverAddress, u16 serverPort);
|
||||
void disconnect();
|
||||
|
||||
void sendReady();
|
||||
void send(sf::Packet &packet) { m_tcpSocket->send(packet); }
|
||||
void sendKeyState();
|
||||
|
||||
void update(bool &hasGameStarted);
|
||||
|
@ -57,12 +57,6 @@ void Client::disconnect() {
|
||||
m_tcpSocket->send(packet);
|
||||
}
|
||||
|
||||
void Client::sendReady() {
|
||||
sf::Packet packet;
|
||||
packet << Network::Command::ClientReady << m_id;
|
||||
m_tcpSocket->send(packet);
|
||||
}
|
||||
|
||||
void Client::sendKeyState() {
|
||||
if (!m_keyUpdateTimer.isStarted())
|
||||
m_keyUpdateTimer.start();
|
||||
@ -108,13 +102,12 @@ void Client::update(bool &hasGameStarted) {
|
||||
disconnect();
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
||||
for (auto &it : m_commands)
|
||||
if (command == it.first)
|
||||
it.second(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::setCommandCallback(Network::Command command, const CommandCallback &callback) {
|
||||
m_commands[command] = callback;
|
||||
|
@ -47,6 +47,12 @@ GameState::GameState(Client &client) : m_client(client) {
|
||||
m_client.setCommandCallback(Network::Command::ChunkData, [this](sf::Packet &packet) {
|
||||
m_world.receiveChunkData(packet);
|
||||
});
|
||||
|
||||
m_client.setCommandCallback(Network::Command::GameStart, [](sf::Packet &) {
|
||||
sf::Packet packet;
|
||||
// TODO
|
||||
m_client.send(packet);
|
||||
});
|
||||
}
|
||||
|
||||
void GameState::testLuaAPI() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user