Skip to content
table.h 1.48 KiB
Newer Older
#ifndef TABLE_H_INCLUDED
#define TABLE_H_INCLUDED

#include <QWidget>
#include <Box2D.h>
#include "TableGraphics.h"
#include "XMLReader.h"
//#include "v1-archive/singleton.h"
#include "position.h"
#include "robot.h"
Victor Dubois's avatar
Victor Dubois committed
#include "contactlistener.h"
class Table : public QWidget//, public Singleton<Table>
    //friend class Singleton<Table>;
    std::vector<Objet*> objets;
    std::vector<Robot*> robots;
Victor Dubois's avatar
Victor Dubois committed
    ContactListener contactListenerTable;
    static Table* _instance;
    static const int tableHeight = 2000;
	static b2AABB getWorldAABB();
	//static const int tableWidth = 2100;
	//static const int tableHeight = 3000;

    static Table* getMainInstance();

    Table(MainWindow* mainWindow, QWidget* parent = 0, bool isBlue = true);
	void keyPressEvent(QKeyEvent* evt, bool press);
    void mousePressEvent(QMouseEvent* evt, bool press);

    float getDistanceToObject(Position pos);
    void removeClosestObject(Position pos);
    Robot* getMainRobot();

    std::vector<Objet*> findObjectsNear(Position pos, Distance searchRadius = 0., Objet::Type type = Objet::ANY);