-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrem.h
executable file
·41 lines (35 loc) · 1.03 KB
/
trem.h
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
34
35
36
37
38
39
40
41
#ifndef TREM_H
#define TREM_H
#include <QThread>
/*
* Classe Trem herda QThread
* Classe Trem passa a ser uma thread.
* A função START inicializa a thread. Após inicializada, a thread irá executar a função RUN.
* Para parar a execução da função RUN da thread, basta executar a função TERMINATE.
*
*/
class Trem: public QThread{
Q_OBJECT
public:
Trem(int,int,int); //construtor
void run(); //função a ser executada pela thread
void setVelocidade(int);
void right();
void left();
void up();
void down();
void entraRegiaoCritica(int);
void deixaRegiaoCritica(int);
int getRegion(int, int);
int getSemaforo(int, int);
void liberaRegiao(int);
//Cria um sinal
signals:
void updateGUI(int,int,int);
private:
int x; //posição X do trem na tela
int y; //posição Y do trem na tela
int ID; //ID do trem
int velocidade; //Velocidade. É o tempo de dormir em milisegundos entre a mudança de posição do trem
};
#endif // TREM_H