Newer
Older
Grégoire Payen de La Garanderie
committed
#ifndef TABLE_H_INCLUDED
#define TABLE_H_INCLUDED
#include <QWidget>
#include "TableGraphics.h"
#include "XMLReader.h"
#include "sensors.h"
Victor Dubois
committed
//#include "bougie.h"
//#include "v1-archive/singleton.h"
Grégoire Payen de La Garanderie
committed
#include "../hardware/tourelle.h"
#include <QList>
class MainWindow;
class Table : public QWidget//, public Singleton<Table>
Grégoire Payen de La Garanderie
committed
{
//friend class Singleton<Table>;
Grégoire Payen de La Garanderie
committed
private:
int dt;
std::vector<Objet*> objets;
std::vector<Robot*> robots;
b2World world;
b2Body* tableBody;
TableGraphics tableGraphics;
Grégoire Payen de La Garanderie
committed
bool mHideTable, mDisplayRoute, mDisplayStrategy, mRemoteMod;
Grégoire Payen de La Garanderie
committed
void addCard(unsigned int n, int column);
MainWindow* mainWindow;
static Table* _instance;
Grégoire Payen de La Garanderie
committed
public slots:
void createObjects();
void removeAllObjects();
void hideTable(bool hidden);
void displayRoute(bool display);
void displayStrategy(bool display);
void setRemoteMod(bool remote);
Grégoire Payen de La Garanderie
committed
static const int tableWidth = 3000;
Victor Dubois
committed
//Bougie p_bougies[20];
//Bougie p_balles[20];
Grégoire Payen de La Garanderie
committed
//static const int tableWidth = 2100;
//static const int tableHeight = 3000;
static Table* getMainInstance();
Table(MainWindow* mainWindow, QWidget* parent = 0, bool isYellow = true);
Grégoire Payen de La Garanderie
committed
virtual ~Table();
void treat(KrabiPacket &packet);
void watch(KrabiPacket &packet);
void update(int dt);
Grégoire Payen de La Garanderie
committed
void paintEvent(QPaintEvent* evt);
void keyPressEvent(QKeyEvent* evt, bool press);
void mousePressEvent(QMouseEvent* evt, bool press);
float getDistanceToObject(Position pos);
void removeClosestObject(Position pos);
Robot* getMainRobot();
// Returns a list of the exact position of the beacons (i.e. other bots), in polar coordinates, relative to 'bot'.
// By default, uses the main robot as reference
QList</*Tourelle::*/PositionData> getBeaconsRelativePosition(Robot* bot = 0);
float getCurrentTime();
bool isInRemoteMod();
std::vector<Objet*> findObjectsNear(Position pos, Distance searchRadius = 0., Objet::Type type = Objet::ANY);