about summary refs log tree commit diff stats
path: root/tracker_panel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker_panel.cpp')
-rw-r--r--tracker_panel.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tracker_panel.cpp b/tracker_panel.cpp index 38d7c86..0cd65cc 100644 --- a/tracker_panel.cpp +++ b/tracker_panel.cpp
@@ -1,11 +1,17 @@
1#include "tracker_panel.h" 1#include "tracker_panel.h"
2 2
3#include "game_data.h"
4
3TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) { 5TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) {
4 map_image_ = wxImage("assets/lingo_map.png", wxBITMAP_TYPE_PNG); 6 map_image_ = wxImage("assets/lingo_map.png", wxBITMAP_TYPE_PNG);
5 if (!map_image_.IsOk()) { 7 if (!map_image_.IsOk()) {
6 return; 8 return;
7 } 9 }
8 10
11 for (const MapArea &map_area : GetGameData().GetMapAreas()) {
12 area_windows_.push_back(new AreaWindow(this, map_area.id));
13 }
14
9 Redraw(); 15 Redraw();
10 16
11 Bind(wxEVT_PAINT, &TrackerPanel::OnPaint, this); 17 Bind(wxEVT_PAINT, &TrackerPanel::OnPaint, this);
@@ -43,4 +49,18 @@ void TrackerPanel::Redraw() {
43 rendered_ = wxBitmap( 49 rendered_ = wxBitmap(
44 map_image_.Scale(final_width, final_height, wxIMAGE_QUALITY_NORMAL) 50 map_image_.Scale(final_width, final_height, wxIMAGE_QUALITY_NORMAL)
45 .Size(panel_size, {final_x, final_y}, 0, 0, 0)); 51 .Size(panel_size, {final_x, final_y}, 0, 0, 0));
52
53 for (AreaWindow *area_window : area_windows_) {
54 const MapArea &map_area =
55 GetGameData().GetMapArea(area_window->GetAreaId());
56 int real_area_size =
57 final_width * AreaWindow::EFFECTIVE_SIZE / image_size.GetWidth();
58 area_window->SetSize({real_area_size, real_area_size});
59 area_window->SetPosition({
60 final_x + (map_area.map_x - (AreaWindow::EFFECTIVE_SIZE / 2)) *
61 final_width / image_size.GetWidth(),
62 final_y + (map_area.map_y - (AreaWindow::EFFECTIVE_SIZE / 2)) *
63 final_width / image_size.GetWidth(),
64 });
65 }
46} 66}