X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Feditorwidget.h;fp=src%2Feditorwidget.h;h=0b29acb0ae7f78f1769a25f74fd4ab6d03fce028;hb=058aca46f433b3a36a341ca7272c39d2bef55c09;hp=0000000000000000000000000000000000000000;hpb=cee848899590199081c8ade4736662a8a5dc4a2f;p=warehouse-man-deluxe diff --git a/src/editorwidget.h b/src/editorwidget.h new file mode 100644 index 0000000..0b29acb --- /dev/null +++ b/src/editorwidget.h @@ -0,0 +1,72 @@ +#ifndef __EDITORWIDGET_H__ +#define __EDITORWIDGET_H__ + +#include +#include +#include + +#define BOARDSIZE 128 + +struct Point +{ + Point(int xx = 0, int yy = 0) { x = xx; y = yy; } + int x, y; +}; + +struct Level +{ + uint8_t board[BOARDSIZE][BOARDSIZE]; + char name[41]; + Point corner; // Corner dimensions on screen + Point cursor; // Cursor location +// This stuff will go into the save file, but we don't need it here... +// Point size; // Actual dimensions of the level +// Point boardCorner; // Where on the gird the UL corner of the level is +}; + +class EditorWidget: public QWidget +{ + Q_OBJECT + + public: + EditorWidget(QWidget * parent = 0); + ~EditorWidget(); + + protected: + QSize sizeHint() const; + void paintEvent(QPaintEvent * event); + void mousePressEvent(QMouseEvent * event); + void mouseMoveEvent(QMouseEvent * event); + void mouseReleaseEvent(QMouseEvent * event); + void mouseDoubleClickEvent(QMouseEvent * event); + void keyPressEvent(QKeyEvent * event); + void keyReleaseEvent(QKeyEvent * event); + void resizeEvent(QResizeEvent * event); + +// signals: +// void UpdateScore(int); +// void GameWasWon(void); + + public: + void CreateBackground(void); + void ClearLevel(void); + bool Load(void); + bool Save(void); + void SetNameOnCurrentLevel(const char *); + private: + void GetSizeAndCorner(Level *, Point &, Point &); + void ResizeGrid(void); + void Pause(int); + + public: + std::vector levelStorage; + uint32_t currentLevel; + + private: +// Level currentLevel; + QSize clientArea; + Point range; +}; + +#endif // __EDITORWIDGET_H__ +