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 12:05:05 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 12:05:05 -0400
commit22014b967d0d9651b72bffbe02aba75dc98180a4 (patch)
treeffab7ffdc21463eb6cd7160fbce6f91e050f8c3e /area_window.cpp
parent4ec5bf36218ad715657bba7649598410feae2794 (diff)
downloadlingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.tar.gz
lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.tar.bz2
lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.zip
Show locations popup when hovering over area
Diffstat (limited to 'area_window.cpp')
-rw-r--r--area_window.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/area_window.cpp b/area_window.cpp index 482dcb0..2f334e4 100644 --- a/area_window.cpp +++ b/area_window.cpp
@@ -4,14 +4,15 @@
4 4
5#include "game_data.h" 5#include "game_data.h"
6 6
7AreaWindow::AreaWindow(wxWindow* parent, int area_id) 7AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup)
8 : wxWindow(parent, wxID_ANY), area_id_(area_id) { 8 : wxWindow(parent, wxID_ANY), area_id_(area_id), popup_(popup) {
9 SetSize(EFFECTIVE_SIZE, EFFECTIVE_SIZE); 9 SetSize(EFFECTIVE_SIZE, EFFECTIVE_SIZE);
10 10
11 Redraw(); 11 Redraw();
12 12
13 Bind(wxEVT_PAINT, &AreaWindow::OnPaint, this); 13 Bind(wxEVT_PAINT, &AreaWindow::OnPaint, this);
14 Bind(wxEVT_ENTER_WINDOW, &AreaWindow::OnEnterWindow, this); 14 Bind(wxEVT_ENTER_WINDOW, &AreaWindow::OnEnterWindow, this);
15 Bind(wxEVT_LEAVE_WINDOW, &AreaWindow::OnLeaveWindow, this);
15} 16}
16 17
17void AreaWindow::OnPaint(wxPaintEvent& event) { 18void AreaWindow::OnPaint(wxPaintEvent& event) {
@@ -23,14 +24,9 @@ void AreaWindow::OnPaint(wxPaintEvent& event) {
23 dc.DrawBitmap(rendered_, 0, 0); 24 dc.DrawBitmap(rendered_, 0, 0);
24} 25}
25 26
26void AreaWindow::OnEnterWindow(wxMouseEvent& event) { 27void AreaWindow::OnEnterWindow(wxMouseEvent& event) { popup_->Show(); }
27 std::cout << GetGameData().GetMapArea(area_id_).name << std::endl; 28
28 std::cout << "---" << std::endl; 29void AreaWindow::OnLeaveWindow(wxMouseEvent& event) { popup_->Hide(); }
29 for (const Location& loc : GetGameData().GetMapArea(area_id_).locations) {
30 std::cout << loc.name << std::endl;
31 }
32 std::cout << "---" << std::endl;
33}
34 30
35void AreaWindow::Redraw() { 31void AreaWindow::Redraw() {
36 int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE; 32 int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE;