diff options
Diffstat (limited to 'area_window.cpp')
| -rw-r--r-- | area_window.cpp | 68 |
1 files changed, 0 insertions, 68 deletions
| diff --git a/area_window.cpp b/area_window.cpp deleted file mode 100644 index fded223..0000000 --- a/area_window.cpp +++ /dev/null | |||
| @@ -1,68 +0,0 @@ | |||
| 1 | #include "area_window.h" | ||
| 2 | |||
| 3 | #include <iostream> | ||
| 4 | |||
| 5 | #include "ap_state.h" | ||
| 6 | #include "game_data.h" | ||
| 7 | #include "tracker_state.h" | ||
| 8 | |||
| 9 | AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup) | ||
| 10 | : wxWindow(parent, wxID_ANY), area_id_(area_id), popup_(popup) { | ||
| 11 | SetSize(EFFECTIVE_SIZE, EFFECTIVE_SIZE); | ||
| 12 | |||
| 13 | Redraw(); | ||
| 14 | |||
| 15 | Bind(wxEVT_PAINT, &AreaWindow::OnPaint, this); | ||
| 16 | Bind(wxEVT_ENTER_WINDOW, &AreaWindow::OnEnterWindow, this); | ||
| 17 | Bind(wxEVT_LEAVE_WINDOW, &AreaWindow::OnLeaveWindow, this); | ||
| 18 | } | ||
| 19 | |||
| 20 | void AreaWindow::UpdateIndicators() { Redraw(); } | ||
| 21 | |||
| 22 | void AreaWindow::OnPaint(wxPaintEvent& event) { | ||
| 23 | if (GetSize() != rendered_.GetSize()) { | ||
| 24 | Redraw(); | ||
| 25 | } | ||
| 26 | |||
| 27 | wxPaintDC dc(this); | ||
| 28 | dc.DrawBitmap(rendered_, 0, 0); | ||
| 29 | } | ||
| 30 | |||
| 31 | void AreaWindow::OnEnterWindow(wxMouseEvent& event) { popup_->Show(); } | ||
| 32 | |||
| 33 | void AreaWindow::OnLeaveWindow(wxMouseEvent& event) { popup_->Hide(); } | ||
| 34 | |||
| 35 | void AreaWindow::Redraw() { | ||
| 36 | const wxBrush* brush_color = wxGREY_BRUSH; | ||
| 37 | |||
| 38 | const MapArea& map_area = GetGameData().GetMapArea(area_id_); | ||
| 39 | bool has_reachable_unchecked = false; | ||
| 40 | bool has_unreachable_unchecked = false; | ||
| 41 | for (int section_id = 0; section_id < map_area.locations.size(); | ||
| 42 | section_id++) { | ||
| 43 | if (!GetAPState().HasCheckedGameLocation(area_id_, section_id)) { | ||
| 44 | if (GetTrackerState().IsLocationReachable(area_id_, section_id)) { | ||
| 45 | has_reachable_unchecked = true; | ||
| 46 | } else { | ||
| 47 | has_unreachable_unchecked = true; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | } | ||
| 51 | |||
| 52 | if (has_reachable_unchecked && has_unreachable_unchecked) { | ||
| 53 | brush_color = wxYELLOW_BRUSH; | ||
| 54 | } else if (has_reachable_unchecked) { | ||
| 55 | brush_color = wxGREEN_BRUSH; | ||
| 56 | } else if (has_unreachable_unchecked) { | ||
| 57 | brush_color = wxRED_BRUSH; | ||
| 58 | } | ||
| 59 | |||
| 60 | int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE; | ||
| 61 | |||
| 62 | rendered_ = wxBitmap(GetSize()); | ||
| 63 | wxMemoryDC dc; | ||
| 64 | dc.SelectObject(rendered_); | ||
| 65 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); | ||
| 66 | dc.SetBrush(*brush_color); | ||
| 67 | dc.DrawRectangle({0, 0}, GetSize()); | ||
| 68 | } | ||
