18
18
#ifndef GAMESIMULATIONITEM_H
19
19
#define GAMESIMULATIONITEM_H
21
#include <QGraphicsItem>
21
#include <QGraphicsPixmapItem>
24
#include "ki/robosimulator.h"
25
#include "renderer/bottheme.h"
27
24
namespace BotRace {
35
class GameSimulationItem : public QObject, public QGraphicsItem
36
* @brief The simulation Pixmap item to indicate where the robot will end up after the execution of the current cards
38
* Useful to find out where the robot might end. Uses the RoboSimulator to figure out the endposition without taking other robots into account.
40
class GameSimulationItem : public QObject, public QGraphicsPixmapItem
38
Q_INTERFACES( QGraphicsItem );
43
Q_INTERFACES( QGraphicsItem )
46
* @brief Constructs a new Item
47
* @param renderer the BotTheme renderer for the used item
48
* @param parent the parent item (the GameBoard)
40
50
explicit GameSimulationItem(Renderer::BotTheme *renderer, QGraphicsItem *parent = 0);
53
* @brief Sets the client which will be used for the simulation
54
* @param client the client which cards are used
42
56
void setClient(Core::AbstractClient *client);
44
QRectF boundingRect() const;
45
void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
60
* @brief Sets the new tile size. Will be called whenenver the gamewindow will be resized
61
* @param sizeOfOneTile th enew size of one boardtile (and thus the robot)
48
63
void setTileSize( const QSizeF &sizeOfOneTile );
66
* @brief Updates the pixmap when the renderer has a new version of it. Or the bottheme was changes
71
* @brief Simulates the current card movements
73
* Takes all cards in the current CardDeck and simulates where the robot might end.
74
* Ignores any further cards if one card in the middle is missing.
75
* Does not simulate pushing of other robots
49
77
void updateSimulation();
52
QSizeF m_sizeOfTheBoard;
53
QSizeF m_sizeOfOneTile;
55
Core::AbstractClient* m_client;
56
Renderer::BotTheme *m_renderer;
57
Core::RoboSimulator* m_simulator;
59
Core::RoboSimulator::RobotSimResult m_simulationResult;
80
QSizeF m_sizeOfOneTile; /**< Caches size of one tile */
82
Core::AbstractClient *m_client; /**< Pointer to the client which Carddeck is used */
83
Renderer::BotTheme *m_renderer; /**< The Bottheme for the simulation pixmap */
84
Core::RoboSimulator *m_simulator; /**< The simulator used for the simulation */