Add angle and speed display

This commit is contained in:
2024-04-19 11:19:47 +02:00
parent a62173b317
commit 8fe3aea13f
3 changed files with 30 additions and 0 deletions

View File

@@ -11,6 +11,10 @@ InGame::InGame(QWidget *parent) : QWidget(parent) {
this->y->setStyleSheet("font-size: 32px; color: black;");
this->time = new QLabel("Time : 0m0s", this);
this->time->setStyleSheet("font-size: 32px; color: black;");
this->speed = new QLabel("Vitesse : 0", this);
this->speed->setStyleSheet("font-size: 32px; color: black;");
this->angle = new QLabel("Angle : 0", this);
this->angle->setStyleSheet("font-size: 32px; color: black;");
this->mainLayout->addWidget(pts);
@@ -46,6 +50,16 @@ void InGame::updatePos(const std::string x, const std::string y) const
this->y->setText("Y : " + QString::fromStdString(y));
}
void InGame::updateSpeed(const std::string speed) const
{
this->speed->setText("Vitesse : " + QString::fromStdString(speed));
}
void InGame::updateAngle(const std::string angle) const
{
this->angle->setText("Angle : " + QString::fromStdString(angle));
}
void InGame::showEvent(QShowEvent* event)
{
@@ -60,4 +74,6 @@ void InGame::updateTime()
int sec = this->timeCounter % 60;
this->time->setText("Time : " + QString::number(min) + "m" + QString::number(sec) + "s");
emit askTCPServer("ihm;strat;get pos;1");
emit askTCPServer("ihm;strat;get speed;1");
emit askTCPServer("ihm;strat;get angle;1");
}