use vector for choose direction

This commit is contained in:
2023-12-28 14:57:13 +01:00
parent 17ba18a200
commit 633592a4ea
7 changed files with 162 additions and 30 deletions

18
app.h
View File

@@ -5,12 +5,19 @@
#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);
@@ -20,14 +27,12 @@ private:
void disconnectConfirmation();
void disconnectIndication();
private:
protected:
Stomp* st_;
typedef struct {
int x;
int y;
Vector2D coordinate;
int pts;
QVector2D relativePts;
} Gem;
typedef struct {
@@ -37,11 +42,10 @@ private:
} Vehicle;
QVector<Gem> gems_;
Vehicle myVehicle_;
Vector2D myVehicle_;
void addGem(int x, int y, int pts);
void printGem();
void fillField(QString body);
QVector2D computeRelativePts(Gem g);
Vector2D computeRelativePts(Gem g);
void computeMove();
};