50 lines
1020 B
C++
50 lines
1020 B
C++
#ifndef APP_H
|
|
#define APP_H
|
|
|
|
#include <QObject>
|
|
#include "interface/iStompObserver.h"
|
|
#include "stomp.h"
|
|
#include <QVector2D>
|
|
|
|
class App : public QObject, public interface::iStompObserver {
|
|
public:
|
|
App(Stomp* st);
|
|
~App() = default;
|
|
|
|
// iStompObserver interface
|
|
private:
|
|
void connectConfirmation(bool success, QString version);
|
|
void sendConfirmation(bool success);
|
|
void subscribeConfirmation(bool success);
|
|
void receiveIndication(int id, QString destination, QString body);
|
|
void disconnectConfirmation();
|
|
void disconnectIndication();
|
|
|
|
private:
|
|
Stomp* st_;
|
|
|
|
typedef struct {
|
|
int x;
|
|
int y;
|
|
int pts;
|
|
QVector2D relativePts;
|
|
} Gem;
|
|
|
|
typedef struct {
|
|
int x;
|
|
int y;
|
|
bool me;
|
|
} Vehicle;
|
|
|
|
QVector<Gem> gems_;
|
|
Vehicle myVehicle_;
|
|
void addGem(int x, int y, int pts);
|
|
void printGem();
|
|
void fillField(QString body);
|
|
QVector2D computeRelativePts(Gem g);
|
|
void computeMove();
|
|
|
|
};
|
|
|
|
#endif // APP_H
|