about summary refs log tree commit diff stats
path: root/area_window.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 17:26:46 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 17:26:46 -0400
commit09d67fbad9df92caf2251d36b4abd7979fd27126 (patch)
tree287be3da3588f1fb991ffd3212fdfd53a703d6ab /area_window.cpp
parent116ba412079ddf647d19a54d09eb61e67a2f9aac (diff)
downloadlingo-ap-tracker-09d67fbad9df92caf2251d36b4abd7979fd27126.tar.gz
lingo-ap-tracker-09d67fbad9df92caf2251d36b4abd7979fd27126.tar.bz2
lingo-ap-tracker-09d67fbad9df92caf2251d36b4abd7979fd27126.zip
Map + popups reflect checked locations
Diffstat (limited to 'area_window.cpp')
-rw-r--r--area_window.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/area_window.cpp b/area_window.cpp index 2f334e4..ca327b8 100644 --- a/area_window.cpp +++ b/area_window.cpp
@@ -2,6 +2,7 @@
2 2
3#include <iostream> 3#include <iostream>
4 4
5#include "ap_state.h"
5#include "game_data.h" 6#include "game_data.h"
6 7
7AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup) 8AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup)
@@ -15,6 +16,8 @@ AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup)
15 Bind(wxEVT_LEAVE_WINDOW, &AreaWindow::OnLeaveWindow, this); 16 Bind(wxEVT_LEAVE_WINDOW, &AreaWindow::OnLeaveWindow, this);
16} 17}
17 18
19void AreaWindow::UpdateIndicators() { Redraw(); }
20
18void AreaWindow::OnPaint(wxPaintEvent& event) { 21void AreaWindow::OnPaint(wxPaintEvent& event) {
19 if (GetSize() != rendered_.GetSize()) { 22 if (GetSize() != rendered_.GetSize()) {
20 Redraw(); 23 Redraw();
@@ -29,12 +32,27 @@ void AreaWindow::OnEnterWindow(wxMouseEvent& event) { popup_->Show(); }
29void AreaWindow::OnLeaveWindow(wxMouseEvent& event) { popup_->Hide(); } 32void AreaWindow::OnLeaveWindow(wxMouseEvent& event) { popup_->Hide(); }
30 33
31void AreaWindow::Redraw() { 34void AreaWindow::Redraw() {
35 const wxBrush* brush_color = wxGREY_BRUSH;
36
37 const MapArea& map_area = GetGameData().GetMapArea(area_id_);
38 int unchecked_sections = 0;
39 for (int section_id = 0; section_id < map_area.locations.size();
40 section_id++) {
41 if (!GetAPState().HasCheckedGameLocation(area_id_, section_id)) {
42 unchecked_sections++;
43 }
44 }
45
46 if (unchecked_sections > 0) {
47 brush_color = wxGREEN_BRUSH;
48 }
49
32 int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE; 50 int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE;
33 51
34 rendered_ = wxBitmap(GetSize()); 52 rendered_ = wxBitmap(GetSize());
35 wxMemoryDC dc; 53 wxMemoryDC dc;
36 dc.SelectObject(rendered_); 54 dc.SelectObject(rendered_);
37 dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); 55 dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size));
38 dc.SetBrush(*wxGREEN_BRUSH); 56 dc.SetBrush(*brush_color);
39 dc.DrawRectangle({0, 0}, GetSize()); 57 dc.DrawRectangle({0, 0}, GetSize());
40} 58}