supertux
menu_object_select.hpp
1 // SuperTux
2 // Copyright (C) 2016 Hume2 <teratux.mail@gmail.com>
3 // 2023 Vankata453
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef HEADER_SUPERTUX_GUI_MENU_OBJECT_SELECT_HPP
19 #define HEADER_SUPERTUX_GUI_MENU_OBJECT_SELECT_HPP
20 
21 #include "gui/menu.hpp"
22 
23 #include <functional>
24 
25 class GameObject;
26 
27 class ObjectSelectMenu final : public Menu
28 {
29 public:
30  ObjectSelectMenu(std::vector<std::unique_ptr<GameObject>>& objects, uint8_t get_objects_param = 0,
31  const std::function<void (std::unique_ptr<GameObject>)>& add_object_func = {});
32 
33  void refresh() override;
34  void menu_action(MenuItem& item) override;
35 
36 private:
37  void add_object();
38  void remove_object(GameObject* obj);
39 
40 private:
41  std::vector<std::unique_ptr<GameObject>>& m_objects;
42  uint8_t m_get_objects_param;
43  const std::function<void (std::unique_ptr<GameObject>)> m_add_object_function;
44 
45  std::string m_selected;
46 
47 private:
48  ObjectSelectMenu(const ObjectSelectMenu&) = delete;
49  ObjectSelectMenu& operator=(const ObjectSelectMenu&) = delete;
50 };
51 
52 #endif
53 
54 /* EOF */
void refresh() override
Perform actions to bring the menu up to date with configuration changes.
Definition: menu_object_select.cpp:42
Definition: menu_item.hpp:23
Definition: menu_object_select.hpp:27
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
Definition: menu.hpp:55