feat: add map background color
This commit is contained in:
@@ -37,6 +37,7 @@ bool World::loadMap(const protocol::WorldBeginDataPacket* worldHeader) {
|
||||
m_TowerPlacePalette = worldHeader->getTowerTilePalette();
|
||||
m_WalkablePalette = worldHeader->getWalkableTileColor();
|
||||
m_DecorationPalette = worldHeader->getDecorationPalette();
|
||||
m_Background = worldHeader->getBackgroundColor();
|
||||
|
||||
getRedTeam().getSpawn() = worldHeader->getRedSpawn();
|
||||
getBlueTeam().getSpawn() = worldHeader->getBlueSpawn();
|
||||
|
||||
@@ -93,6 +93,7 @@ void ClientGame::HandlePacket(const protocol::UpdateMoneyPacket* packet) {
|
||||
|
||||
void ClientGame::HandlePacket(const protocol::DisconnectPacket* packet) {
|
||||
m_GameState = game::GameState::Disconnected;
|
||||
m_Renderer->setBackgroundColor({ 0, 0, 0 });
|
||||
}
|
||||
|
||||
void ClientGame::HandlePacket(const protocol::WorldDataPacket* packet) {
|
||||
|
||||
@@ -17,6 +17,11 @@ WorldClient::WorldClient(ClientGame* game) : game::World(game), protocol::Packet
|
||||
|
||||
void WorldClient::HandlePacket(const protocol::WorldBeginDataPacket* packet) {
|
||||
loadMap(packet);
|
||||
if (m_Game->getGameState() == game::GameState::Game) {
|
||||
const game::Color& backgroundColor = getBackgroundColor();
|
||||
m_Game->getRenderer()->setBackgroundColor({ static_cast<float>(backgroundColor.r / 255.0f), static_cast<float>(backgroundColor.g / 255.0f),
|
||||
static_cast<float>(backgroundColor.b / 255.0f) });
|
||||
}
|
||||
}
|
||||
|
||||
void WorldClient::HandlePacket(const protocol::WorldDataPacket* packet) {
|
||||
|
||||
Reference in New Issue
Block a user