From b78a7361c9f9f4a9edc30b45a90a3ff94e919b19 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 6 Jun 2024 14:07:51 -0400 Subject: Added help button for subway map --- src/subway_map.cpp | 25 +++++++++++++++++++++++++ src/subway_map.h | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 77f6ae6..100d351 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp @@ -58,6 +58,10 @@ SubwayMap::SubwayMap(wxWindow *parent) : wxPanel(parent, wxID_ANY) { zoom_slider_ = new wxSlider(this, wxID_ANY, 0, 0, 8, {15, 15}); zoom_slider_->Bind(wxEVT_SLIDER, &SubwayMap::OnZoomSlide, this); + + help_button_ = new wxButton(this, wxID_ANY, "Help"); + help_button_->Bind(wxEVT_BUTTON, &SubwayMap::OnClickHelp, this); + SetUpHelpButton(); } void SubwayMap::OnConnect() { @@ -162,6 +166,8 @@ void SubwayMap::OnPaint(wxPaintEvent &event) { } SetZoomPos({zoom_x_, zoom_y_}); + + SetUpHelpButton(); } wxBufferedPaintDC dc(this); @@ -440,6 +446,18 @@ void SubwayMap::OnZoomSlide(wxCommandEvent &event) { } } +void SubwayMap::OnClickHelp(wxCommandEvent &event) { + wxMessageBox( + "Zoom in/out using the mouse wheel, Ctrl +/-, or the slider in the " + "corner.\nClick on a side of the screen to start panning. It will follow " + "your mouse. Click again to stop.\nHover over a door to see the " + "requirements to open it.\nHover over a warp or active painting to see " + "what it is connected to.\nIn painting shuffle, paintings that have not " + "yet been checked will not show their connections.\nClick on a door or " + "warp to make the popup stick until you click again.", + "Subway Map Help"); +} + void SubwayMap::Redraw() { rendered_ = wxBitmap(map_image_); @@ -514,6 +532,13 @@ void SubwayMap::Redraw() { } } +void SubwayMap::SetUpHelpButton() { + help_button_->SetPosition({ + GetSize().GetWidth() - help_button_->GetSize().GetWidth() - 15, + 15, + }); +} + void SubwayMap::EvaluateScroll(wxPoint pos) { int scroll_x; int scroll_y; diff --git a/src/subway_map.h b/src/subway_map.h index 8b8c6a6..1108cd4 100644 --- a/src/subway_map.h +++ b/src/subway_map.h @@ -35,8 +35,10 @@ class SubwayMap : public wxPanel { void OnMouseClick(wxMouseEvent &event); void OnTimer(wxTimerEvent &event); void OnZoomSlide(wxCommandEvent &event); + void OnClickHelp(wxCommandEvent &event); void Redraw(); + void SetUpHelpButton(); wxPoint MapPosToRenderPos(wxPoint pos) const; wxPoint MapPosToVirtualPos(wxPoint pos) const; @@ -70,6 +72,8 @@ class SubwayMap : public wxPanel { wxSlider *zoom_slider_; + wxButton *help_button_; + std::optional mouse_position_; struct GetItemBox { -- cgit 1.4.1