diff options
Diffstat (limited to 'tracker_panel.cpp')
-rw-r--r-- | tracker_panel.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tracker_panel.cpp b/tracker_panel.cpp new file mode 100644 index 0000000..74bf605 --- /dev/null +++ b/tracker_panel.cpp | |||
@@ -0,0 +1,27 @@ | |||
1 | #include "tracker_panel.h" | ||
2 | |||
3 | TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) { | ||
4 | map_image_ = wxImage("assets/lingo_map.png", wxBITMAP_TYPE_PNG); | ||
5 | if (!map_image_.IsOk()) { | ||
6 | return; | ||
7 | } | ||
8 | |||
9 | Redraw(); | ||
10 | |||
11 | Bind(wxEVT_PAINT, &TrackerPanel::OnPaint, this); | ||
12 | } | ||
13 | |||
14 | void TrackerPanel::OnPaint(wxPaintEvent &event) { | ||
15 | if (GetSize() != rendered_.GetSize()) { | ||
16 | Redraw(); | ||
17 | } | ||
18 | |||
19 | wxPaintDC dc(this); | ||
20 | dc.DrawBitmap(rendered_, 0, 0); | ||
21 | } | ||
22 | |||
23 | void TrackerPanel::Redraw() { | ||
24 | wxSize sz = GetSize(); | ||
25 | rendered_ = wxBitmap( | ||
26 | map_image_.Scale(sz.GetWidth(), sz.GetHeight(), wxIMAGE_QUALITY_NORMAL)); | ||
27 | } | ||