54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#ifndef APP_H
|
|
#define APP_H
|
|
|
|
#include <QObject>
|
|
#include "interface/iStompObserver.h"
|
|
#include "stomp.h"
|
|
#include <QVector2D>
|
|
#include <cmath>
|
|
|
|
#include "Vector2D.h"
|
|
|
|
#define GRID_SIZE 32
|
|
|
|
|
|
class App : public QObject, public interface::iStompObserver {
|
|
public:
|
|
App(Stomp* st);
|
|
~App() = default;
|
|
|
|
const double MAX_LENGHT = sqrt(GRID_SIZE*GRID_SIZE + GRID_SIZE*GRID_SIZE);
|
|
// 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();
|
|
|
|
protected:
|
|
Stomp* st_;
|
|
|
|
typedef struct {
|
|
Vector2D coordinate;
|
|
int pts;
|
|
} Gem;
|
|
|
|
typedef struct {
|
|
int x;
|
|
int y;
|
|
bool me;
|
|
} Vehicle;
|
|
|
|
QVector<Gem> gems_;
|
|
Vector2D myVehicle_;
|
|
void addGem(int x, int y, int pts);
|
|
void fillField(QString body);
|
|
Vector2D computeRelativePts(Gem g);
|
|
void computeMove();
|
|
|
|
};
|
|
|
|
#endif // APP_H
|