This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
SDi-STOMP/app.h

50 lines
1020 B
C
Raw Normal View History

2023-11-29 10:53:20 +00:00
#ifndef APP_H
#define APP_H
#include <QObject>
#include "interface/iStompObserver.h"
2023-12-22 11:44:28 +00:00
#include "stomp.h"
2023-12-26 21:09:42 +00:00
#include <QVector2D>
2023-11-29 10:53:20 +00:00
class App : public QObject, public interface::iStompObserver {
public:
2023-12-26 17:10:52 +00:00
App(Stomp* st);
2023-11-30 08:53:53 +00:00
~App() = default;
// iStompObserver interface
private:
2023-12-26 17:10:52 +00:00
void connectConfirmation(bool success, QString version);
2023-11-30 08:53:53 +00:00
void sendConfirmation(bool success);
void subscribeConfirmation(bool success);
void receiveIndication(int id, QString destination, QString body);
void disconnectConfirmation();
void disconnectIndication();
2023-12-22 11:44:28 +00:00
private:
2023-12-26 17:10:52 +00:00
Stomp* st_;
typedef struct {
int x;
int y;
int pts;
2023-12-26 21:09:42 +00:00
QVector2D relativePts;
2023-12-26 17:10:52 +00:00
} Gem;
typedef struct {
int x;
int y;
bool me;
} Vehicle;
QVector<Gem> gems_;
Vehicle myVehicle_;
void addGem(int x, int y, int pts);
2023-12-26 21:09:42 +00:00
void printGem();
2023-12-26 17:10:52 +00:00
void fillField(QString body);
2023-12-26 21:09:42 +00:00
QVector2D computeRelativePts(Gem g);
void computeMove();
2023-12-26 17:10:52 +00:00
2023-11-29 10:53:20 +00:00
};
#endif // APP_H