56 lines
1.0 KiB
C++
56 lines
1.0 KiB
C++
#ifndef AD_GRAPHICS_H
|
|
#define AD_GRAPHICS_H
|
|
#include <QGraphicsView>
|
|
#include <QGraphicsWidget>
|
|
#include <QPushButton>
|
|
#include <QMouseEvent>
|
|
|
|
#include "adcore.h"
|
|
|
|
|
|
class AD_Graphics: public QGraphicsView
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(bool building READ building WRITE setBuilding)
|
|
public:
|
|
explicit AD_Graphics(AD_Core * core, QWidget * parent = 0);
|
|
~AD_Graphics();
|
|
|
|
bool building() const
|
|
{
|
|
return m_building;
|
|
}
|
|
|
|
public slots:
|
|
void setBuilding(bool arg)
|
|
{
|
|
m_building = arg;
|
|
}
|
|
|
|
private:
|
|
void drawBackground(QPainter * p, const QRectF &);
|
|
void drawForeground(QPainter *painter, const QRectF &rect);
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
QGraphicsScene * scene;
|
|
AD_Core * core;
|
|
QImage * mapimg;
|
|
Game_Data * data;
|
|
|
|
bool m_building;
|
|
|
|
private slots:
|
|
|
|
protected:
|
|
|
|
void timerEvent(QTimerEvent * );
|
|
signals:
|
|
|
|
void cancel();
|
|
void add_tow(QPoint pnt);
|
|
void tower_select(QPoint id);
|
|
void alien_select(int id);
|
|
};
|
|
|
|
#endif // AD_GRAPHICS_H
|