]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
robomon shows free puck positions and dispensers
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 22 Apr 2009 18:03:34 +0000 (20:03 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 22 Apr 2009 18:03:34 +0000 (20:03 +0200)
src/robodim/robodim.h
src/robomon/PlaygroundScene.cpp
src/robomon/PlaygroundScene.h

index 4381c230fcf3c53e455c57fa94d2840c96bb1228..5a4b0bb17233004d59cf232e9bf7d166654fc741 100644 (file)
 #define PUCK_GRID_COLS_NUM      3
 
 struct puck_pos {
-       float x, y;
+       float x, y;             /* In meters */
 };
 
 /*
index 268fd72ef93e292d07957c9db78abe54fd111abf..caa867a81d777462bbed0cef533804808243c609 100644 (file)
@@ -15,6 +15,7 @@
 #include <QGraphicsRectItem>
 
 #include "PlaygroundScene.h"
+#include <robodim.h>
 
 PlaygroundScene::PlaygroundScene(QObject *parent)
        : QGraphicsScene(parent)
@@ -42,6 +43,23 @@ PlaygroundScene::PlaygroundScene(QObject *parent)
        tempRect = addRect(QRect(2500, 1600, 500, 500), QPen(NoPen), QBrush(red));
        tempRect->setZValue(3);
        
+       /* free pucks */
+       for (int x=0; x<PUCK_GRID_COLS_NUM; x++) {
+               for (int y=0; y<PUCK_GRID_ROWS_NUM; y++) {
+                       QGraphicsEllipseItem *puck;
+                       struct puck_pos p = free_puck_pos(x, y);
+                       printf("%g %g\n", p.x, p.y);
+                       puck = addEllipse(1000*p.x, 1000*p.y, 70, 70);
+                       puck->setZValue(3);
+                       puck = addEllipse(1000*(3-p.x), 1000*p.y, 70, 70);
+                       puck->setZValue(3);
+               }
+       }
+       
+       /* dispenser */
+       addRect(QRect(289-40, 0, 80, 80))->setZValue(3);
+       addRect(QRect(3000-(289-40), 0, 80, 80))->setZValue(3);
+       
        QBrush brownBrush = QBrush(QColor(202, 98, 9));
        
        /* circular building area */
index c21245ddf939eaf45e726b7adb329100dbc674d2..73c22b62b722a1793ecf0985e0360b9e0aeae4e7 100644 (file)
@@ -35,6 +35,7 @@ private:
        QGraphicsItemGroup *map;
        QGraphicsRectItem *rects[MAP_WIDTH][MAP_HEIGHT];  // This must be slow - convert to pixmap. -- M.S.
        QGraphicsEllipseItem *obstacle;
+       QGraphicsItemGroup *freePucks;
 
 public slots:
        void showObstacle(int val);