From 3e989517ec46c40a82671620577c40765c94a41f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 15 Mar 2015 11:19:20 -0400 Subject: Added basic ability to set tiles in map editor --- tools/mapedit/src/widget.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/mapedit/src/widget.h (limited to 'tools/mapedit/src/widget.h') diff --git a/tools/mapedit/src/widget.h b/tools/mapedit/src/widget.h new file mode 100644 index 0000000..f2bfbbe --- /dev/null +++ b/tools/mapedit/src/widget.h @@ -0,0 +1,38 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include + +#ifndef WX_PRECOMP +#include +#endif + +#include "map.h" +#include "tile_widget.h" + +class MapeditWidget : public wxControl { + public: + MapeditWidget(); + MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); + + protected: + void Init(); + virtual wxSize DoGetBestSize() const; + void OnPaint(wxPaintEvent& event); + void OnClick(wxMouseEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnMouseUp(wxMouseEvent& event); + + private: + void SetTile(wxPoint pos); + + Map* const map = nullptr; + wxBitmap tiles; + TileWidget* tileWidget; + bool mouseIsDown = false; + + DECLARE_DYNAMIC_CLASS(MapeditWidget); + DECLARE_EVENT_TABLE(); +}; + +#endif -- cgit 1.4.1