ManaPlus
minimap.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2018 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef GUI_WINDOWS_MINIMAP_H
24 #define GUI_WINDOWS_MINIMAP_H
25 
26 #include "gui/widgets/window.h"
27 
28 class Image;
29 class Map;
30 
40 class Minimap final : public Window, public ConfigListener
41 {
42  public:
43  Minimap();
44 
46 
47  ~Minimap() override final;
48 
52  void setMap(const Map *const map);
53 
57  void toggle();
58 
62  void draw(Graphics *const graphics) override final A_NONNULL(2);
63 
64  void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
65 
66  void draw2(Graphics *const graphics) A_NONNULL(2);
67 
68  void mouseMoved(MouseEvent &event) override final;
69 
70  void mouseReleased(MouseEvent &event) override final;
71 
72  void mousePressed(MouseEvent &event) override final;
73 
74  void mouseExited(MouseEvent &event) override final;
75 
76  void screenToMap(int &x, int &y);
77 
78  void optionChanged(const std::string &name) override final;
79 
80  private:
81  void deleteMapImage();
82 
90  static bool mShow;
91 };
92 
93 extern Minimap *minimap;
94 
95 #endif // GUI_WINDOWS_MINIMAP_H
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
void screenToMap(int &x, int &y)
Definition: minimap.cpp:530
int mMapOriginY
Definition: minimap.h:87
void deleteMapImage()
Definition: minimap.cpp:106
void mousePressed(MouseEvent &event)
Definition: minimap.cpp:481
void toggle()
Definition: minimap.cpp:247
bool mAutoResize
Definition: minimap.h:89
Definition: window.h:98
#define final
Definition: localconsts.h:45
void mouseMoved(MouseEvent &event)
Definition: minimap.cpp:515
#define A_NONNULL(...)
Definition: localconsts.h:167
void draw2(Graphics *const graphics)
Definition: minimap.cpp:269
void mouseExited(MouseEvent &event)
Definition: minimap.cpp:524
static bool mShow
Definition: minimap.h:90
int mMapOriginX
Definition: minimap.h:86
void setMap(const Map *const map)
Definition: minimap.cpp:118
Minimap()
Definition: minimap.cpp:64
Minimap * minimap
Definition: minimap.cpp:61
Definition: map.h:71
void draw(Graphics *const graphics)
Definition: minimap.cpp:253
~Minimap()
Definition: minimap.cpp:98
void optionChanged(const std::string &name)
Definition: minimap.cpp:537
Definition: image.h:61
Image * mMapImage
Definition: minimap.h:85
float mWidthProportion
Definition: minimap.h:83
bool mCustomMapImage
Definition: minimap.h:88
float mHeightProportion
Definition: minimap.h:84
void mouseReleased(MouseEvent &event)
Definition: minimap.cpp:488
void safeDraw(Graphics *const graphics)
Definition: minimap.cpp:261