TESTTRAZE: added protocol support for 'owned' counter
parent
e696ed7aae
commit
bc3839b805
|
@ -264,7 +264,7 @@ void TestTraze::doRender() {
|
||||||
yOffset += _voxelFontRender.lineHeight();
|
yOffset += _voxelFontRender.lineHeight();
|
||||||
for (const traze::Player& p : _players) {
|
for (const traze::Player& p : _players) {
|
||||||
_voxelFontRender.text(glm::ivec3(0, yOffset, 0), p.color, "* %s", p.name.c_str());
|
_voxelFontRender.text(glm::ivec3(0, yOffset, 0), p.color, "* %s", p.name.c_str());
|
||||||
_voxelFontRender.text(glm::ivec3(_maxLength, yOffset, 0), p.color, "%i", p.frags);
|
_voxelFontRender.text(glm::ivec3(_maxLength, yOffset, 0), p.color, "%i/%i", p.frags, p.owned);
|
||||||
yOffset += _voxelFontRender.lineHeight();
|
yOffset += _voxelFontRender.lineHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,7 @@ void Protocol::parsePlayers(const std::string& json) {
|
||||||
p.color = materialColors[index];
|
p.color = materialColors[index];
|
||||||
p.id = player["id"].get<int>();
|
p.id = player["id"].get<int>();
|
||||||
p.frags = player["frags"].get<int>();
|
p.frags = player["frags"].get<int>();
|
||||||
|
p.owned = player["owned"].get<int>();
|
||||||
players.push_back(p);
|
players.push_back(p);
|
||||||
Log::debug("Player %s with id %i", p.name.c_str(), p.id);
|
Log::debug("Player %s with id %i", p.name.c_str(), p.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ struct Player {
|
||||||
std::string name;
|
std::string name;
|
||||||
PlayerId id = 0u;
|
PlayerId id = 0u;
|
||||||
uint32_t frags = 0u;
|
uint32_t frags = 0u;
|
||||||
|
uint32_t owned = 0u;
|
||||||
uint8_t colorIndex = 0u;
|
uint8_t colorIndex = 0u;
|
||||||
glm::vec4 color {0.0f};
|
glm::vec4 color {0.0f};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue