forked from UCR-Solar-Car/DriverInterface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
distance.cpp
33 lines (26 loc) · 1.02 KB
/
distance.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "distance.h"
#include "scaler.h"
Distance::Distance() : distance(0) {}
void Distance::setup(Ui::MainWindow *ui, uint16_t height, uint16_t width) {
this->ui = ui;
ui->distance->display(distance);
ui->distance_label->resize(width * 15 / 100, height * 15 / 100);
ui->distance->resize(width * 15 / 100, height * 15 / 100);
ui->distance_label->move(width - width * 90 / 100,
height - height * 20 / 100);
ui->distance->move(width - width * 90 / 100 + ui->distance_label->width(),
height - height * 15 / 100);
ui->distance->resize(width * 15 / 100, height * 5 / 100);
qDebug() << "DISTANCE" << ui->distance_label->x() << ui->distance_label->y()
<< ui->distance->x() << ui->distance->y();
}
void Distance::decrease_distance(uint8_t value) {
if (distance - value > -1) {
this->distance -= value;
ui->distance->display(distance);
}
}
void Distance::increase_distance(uint8_t value) {
this->distance += value;
ui->distance->display(distance);
}