diff options
Diffstat (limited to 'src/subway_map.h')
| -rw-r--r-- | src/subway_map.h | 50 |
1 files changed, 48 insertions, 2 deletions
| diff --git a/src/subway_map.h b/src/subway_map.h index e5f0bf6..b04c2fd 100644 --- a/src/subway_map.h +++ b/src/subway_map.h | |||
| @@ -15,9 +15,12 @@ | |||
| 15 | 15 | ||
| 16 | #include <quadtree/Quadtree.h> | 16 | #include <quadtree/Quadtree.h> |
| 17 | 17 | ||
| 18 | #include "ap_state.h" | ||
| 18 | #include "game_data.h" | 19 | #include "game_data.h" |
| 19 | #include "network_set.h" | 20 | #include "network_set.h" |
| 20 | 21 | ||
| 22 | class ReportPopup; | ||
| 23 | |||
| 21 | class SubwayMap : public wxPanel { | 24 | class SubwayMap : public wxPanel { |
| 22 | public: | 25 | public: |
| 23 | SubwayMap(wxWindow *parent); | 26 | SubwayMap(wxWindow *parent); |
| @@ -25,12 +28,33 @@ class SubwayMap : public wxPanel { | |||
| 25 | void OnConnect(); | 28 | void OnConnect(); |
| 26 | void UpdateIndicators(); | 29 | void UpdateIndicators(); |
| 27 | void UpdateSunwarp(SubwaySunwarp from_sunwarp, SubwaySunwarp to_sunwarp); | 30 | void UpdateSunwarp(SubwaySunwarp from_sunwarp, SubwaySunwarp to_sunwarp); |
| 31 | void Zoom(bool in); | ||
| 28 | 32 | ||
| 29 | private: | 33 | private: |
| 30 | void OnPaint(wxPaintEvent &event); | 34 | void OnPaint(wxPaintEvent &event); |
| 31 | void OnMouseMove(wxMouseEvent &event); | 35 | void OnMouseMove(wxMouseEvent &event); |
| 36 | void OnMouseScroll(wxMouseEvent &event); | ||
| 37 | void OnMouseLeave(wxMouseEvent &event); | ||
| 38 | void OnMouseClick(wxMouseEvent &event); | ||
| 39 | void OnTimer(wxTimerEvent &event); | ||
| 40 | void OnZoomSlide(wxCommandEvent &event); | ||
| 41 | void OnClickHelp(wxCommandEvent &event); | ||
| 32 | 42 | ||
| 33 | void Redraw(); | 43 | void Redraw(); |
| 44 | void SetUpHelpButton(); | ||
| 45 | |||
| 46 | wxPoint MapPosToRenderPos(wxPoint pos) const; | ||
| 47 | wxPoint MapPosToVirtualPos(wxPoint pos) const; | ||
| 48 | wxPoint RenderPosToMapPos(wxPoint pos) const; | ||
| 49 | |||
| 50 | void EvaluateScroll(wxPoint pos); | ||
| 51 | void EvaluateHover(); | ||
| 52 | |||
| 53 | void SetZoomPos(wxPoint pos); | ||
| 54 | void SetScrollSpeed(int scroll_x, int scroll_y); | ||
| 55 | void SetZoom(double zoom, wxPoint static_point); | ||
| 56 | |||
| 57 | std::optional<int> GetRealSubwayDoor(const SubwayItem subway_item); | ||
| 34 | 58 | ||
| 35 | wxImage map_image_; | 59 | wxImage map_image_; |
| 36 | wxImage owl_image_; | 60 | wxImage owl_image_; |
| @@ -38,8 +62,23 @@ class SubwayMap : public wxPanel { | |||
| 38 | wxBitmap rendered_; | 62 | wxBitmap rendered_; |
| 39 | int render_x_ = 0; | 63 | int render_x_ = 0; |
| 40 | int render_y_ = 0; | 64 | int render_y_ = 0; |
| 41 | int render_width_ = 0; | 65 | int render_width_ = 1; |
| 42 | int render_height_ = 0; | 66 | int render_height_ = 1; |
| 67 | |||
| 68 | double zoom_ = 1.0; | ||
| 69 | int zoom_x_ = 0; // in render space | ||
| 70 | int zoom_y_ = 0; | ||
| 71 | |||
| 72 | bool scroll_mode_ = false; | ||
| 73 | wxTimer* scroll_timer_; | ||
| 74 | int scroll_x_ = 0; | ||
| 75 | int scroll_y_ = 0; | ||
| 76 | |||
| 77 | wxSlider *zoom_slider_; | ||
| 78 | |||
| 79 | wxButton *help_button_; | ||
| 80 | |||
| 81 | std::optional<wxPoint> mouse_position_; | ||
| 43 | 82 | ||
| 44 | struct GetItemBox { | 83 | struct GetItemBox { |
| 45 | quadtree::Box<float> operator()(const int &id) const; | 84 | quadtree::Box<float> operator()(const int &id) const; |
| @@ -47,9 +86,16 @@ class SubwayMap : public wxPanel { | |||
| 47 | 86 | ||
| 48 | std::unique_ptr<quadtree::Quadtree<int, GetItemBox>> tree_; | 87 | std::unique_ptr<quadtree::Quadtree<int, GetItemBox>> tree_; |
| 49 | std::optional<int> hovered_item_; | 88 | std::optional<int> hovered_item_; |
| 89 | std::optional<int> actual_hover_; | ||
| 90 | bool sticky_hover_ = false; | ||
| 91 | |||
| 92 | ReportPopup *report_popup_; | ||
| 50 | 93 | ||
| 51 | NetworkSet networks_; | 94 | NetworkSet networks_; |
| 52 | std::set<std::string> checked_paintings_; | 95 | std::set<std::string> checked_paintings_; |
| 96 | |||
| 97 | // Cached from APState. | ||
| 98 | std::map<int, SunwarpMapping> sunwarp_mapping_; | ||
| 53 | }; | 99 | }; |
| 54 | 100 | ||
| 55 | #endif /* end of include guard: SUBWAY_MAP_H_BD2D843E */ | 101 | #endif /* end of include guard: SUBWAY_MAP_H_BD2D843E */ |
