diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 15:54:41 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 15:54:41 -0400 |
commit | 8ddab49cc13d809ca75dcd7f645661a3d3cb05c4 (patch) | |
tree | ba1e5f3237dbb7cdc939c35e193f5e6e46845a77 /src/area_popup.cpp | |
parent | ac38dd0a5c394eefc39b7a8cf7b96762f18c8b31 (diff) | |
parent | 6f5287b3921c843a6b322ccbdfcbef00a8f16980 (diff) | |
download | lingo-ap-tracker-8ddab49cc13d809ca75dcd7f645661a3d3cb05c4.tar.gz lingo-ap-tracker-8ddab49cc13d809ca75dcd7f645661a3d3cb05c4.tar.bz2 lingo-ap-tracker-8ddab49cc13d809ca75dcd7f645661a3d3cb05c4.zip |
Merge branch 'subway'
Diffstat (limited to 'src/area_popup.cpp')
-rw-r--r-- | src/area_popup.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/area_popup.cpp b/src/area_popup.cpp index 3b5d8d4..58d8897 100644 --- a/src/area_popup.cpp +++ b/src/area_popup.cpp | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "area_popup.h" | 1 | #include "area_popup.h" |
2 | 2 | ||
3 | #include <wx/dcbuffer.h> | ||
4 | |||
3 | #include "ap_state.h" | 5 | #include "ap_state.h" |
4 | #include "game_data.h" | 6 | #include "game_data.h" |
5 | #include "global.h" | 7 | #include "global.h" |
@@ -8,6 +10,8 @@ | |||
8 | 10 | ||
9 | AreaPopup::AreaPopup(wxWindow* parent, int area_id) | 11 | AreaPopup::AreaPopup(wxWindow* parent, int area_id) |
10 | : wxScrolledCanvas(parent, wxID_ANY), area_id_(area_id) { | 12 | : wxScrolledCanvas(parent, wxID_ANY), area_id_(area_id) { |
13 | SetBackgroundStyle(wxBG_STYLE_PAINT); | ||
14 | |||
11 | unchecked_eye_ = | 15 | unchecked_eye_ = |
12 | wxBitmap(wxImage(GetAbsolutePath("assets/unchecked.png").c_str(), | 16 | wxBitmap(wxImage(GetAbsolutePath("assets/unchecked.png").c_str(), |
13 | wxBITMAP_TYPE_PNG) | 17 | wxBITMAP_TYPE_PNG) |
@@ -61,6 +65,19 @@ void AreaPopup::UpdateIndicators() { | |||
61 | } | 65 | } |
62 | } | 66 | } |
63 | 67 | ||
68 | if (AP_IsPaintingShuffle()) { | ||
69 | for (int painting_id : map_area.paintings) { | ||
70 | const PaintingExit& painting = GD_GetPaintingExit(painting_id); | ||
71 | wxSize item_extent = mem_dc.GetTextExtent(painting.internal_id); // TODO: Replace with a friendly name. | ||
72 | int item_height = std::max(32, item_extent.GetHeight()) + 10; | ||
73 | acc_height += item_height; | ||
74 | |||
75 | if (item_extent.GetWidth() > col_width) { | ||
76 | col_width = item_extent.GetWidth(); | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
64 | int item_width = col_width + 10 + 32; | 81 | int item_width = col_width + 10 + 32; |
65 | int full_width = std::max(header_extent.GetWidth(), item_width) + 20; | 82 | int full_width = std::max(header_extent.GetWidth(), item_width) + 20; |
66 | 83 | ||
@@ -105,10 +122,31 @@ void AreaPopup::UpdateIndicators() { | |||
105 | 122 | ||
106 | cur_height += 10 + 32; | 123 | cur_height += 10 + 32; |
107 | } | 124 | } |
125 | |||
126 | if (AP_IsPaintingShuffle()) { | ||
127 | for (int painting_id : map_area.paintings) { | ||
128 | const PaintingExit& painting = GD_GetPaintingExit(painting_id); | ||
129 | bool checked = AP_IsPaintingChecked(painting.internal_id); | ||
130 | wxBitmap* eye_ptr = checked ? &checked_eye_ : &unchecked_eye_; | ||
131 | |||
132 | mem_dc.DrawBitmap(*eye_ptr, {10, cur_height}); | ||
133 | |||
134 | bool reachable = IsPaintingReachable(painting_id); | ||
135 | const wxColour* text_color = reachable ? wxWHITE : wxRED; | ||
136 | mem_dc.SetTextForeground(*text_color); | ||
137 | |||
138 | wxSize item_extent = mem_dc.GetTextExtent(painting.internal_id); // TODO: Replace with friendly name. | ||
139 | mem_dc.DrawText(painting.internal_id, | ||
140 | {10 + 32 + 10, | ||
141 | cur_height + (32 - mem_dc.GetFontMetrics().height) / 2}); | ||
142 | |||
143 | cur_height += 10 + 32; | ||
144 | } | ||
145 | } | ||
108 | } | 146 | } |
109 | 147 | ||
110 | void AreaPopup::OnPaint(wxPaintEvent& event) { | 148 | void AreaPopup::OnPaint(wxPaintEvent& event) { |
111 | wxPaintDC dc(this); | 149 | wxBufferedPaintDC dc(this); |
112 | PrepareDC(dc); | 150 | PrepareDC(dc); |
113 | dc.DrawBitmap(rendered_, 0, 0); | 151 | dc.DrawBitmap(rendered_, 0, 0); |
114 | 152 | ||