about summary refs log tree commit diff stats
path: root/tracker_panel.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-01 17:54:50 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-01 17:54:50 -0400
commit9798316b43773e4c7d15851202977a3069f28577 (patch)
tree143b3b356dd577d32228550a176f317157842865 /tracker_panel.cpp
parentd7eb71dc931c812b57d39566f71069a51cb66f4d (diff)
downloadlingo-ap-tracker-9798316b43773e4c7d15851202977a3069f28577.tar.gz
lingo-ap-tracker-9798316b43773e4c7d15851202977a3069f28577.tar.bz2
lingo-ap-tracker-9798316b43773e4c7d15851202977a3069f28577.zip
Added map background
Diffstat (limited to 'tracker_panel.cpp')
-rw-r--r--tracker_panel.cpp27
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
3TrackerPanel::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
14void 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
23void TrackerPanel::Redraw() {
24 wxSize sz = GetSize();
25 rendered_ = wxBitmap(
26 map_image_.Scale(sz.GetWidth(), sz.GetHeight(), wxIMAGE_QUALITY_NORMAL));
27}