17 #ifndef HEADER_SUPERTUX_EDITOR_EDITOR_HPP 18 #define HEADER_SUPERTUX_EDITOR_EDITOR_HPP 24 #include "editor/overlay_widget.hpp" 25 #include "editor/toolbox_widget.hpp" 26 #include "editor/layers_widget.hpp" 27 #include "editor/scroller_widget.hpp" 28 #include "supertux/screen.hpp" 29 #include "supertux/world.hpp" 30 #include "util/currenton.hpp" 31 #include "util/file_system.hpp" 32 #include "util/log.hpp" 33 #include "video/surface_ptr.hpp" 49 static bool is_active();
52 static bool s_resaving_in_progress;
61 virtual void setup()
override;
62 virtual void leave()
override;
64 void event(
const SDL_Event& ev);
67 void disable_keyboard() { m_enabled =
false; }
69 Level* get_level()
const {
return m_level.get(); }
71 void set_world(std::unique_ptr<World> w);
72 World* get_world()
const {
return m_world.get(); }
74 TileSet* get_tileset()
const {
return m_tileset; }
75 TileSelection* get_tiles()
const {
return m_toolbox_widget->get_tiles(); }
76 std::string get_tileselect_object()
const {
return m_toolbox_widget->get_object(); }
78 EditorToolboxWidget::InputType get_tileselect_input_type()
const {
return m_toolbox_widget->get_input_type(); }
80 int get_tileselect_select_mode()
const;
81 int get_tileselect_move_mode()
const;
83 std::string get_levelfile()
const {
return m_levelfile; }
85 void set_level(
const std::string& levelfile_) {
86 m_levelfile = levelfile_;
87 m_reload_request =
true;
90 std::string get_level_directory()
const;
92 void open_level_directory();
94 bool is_testing_level()
const {
return m_leveltested; }
100 void check_unsaved_changes(
const std::function<
void ()>& action);
102 void load_sector(
const std::string& name);
103 void delete_current_sector();
105 void update_node_iterators();
107 void delete_markers();
110 void select_tilegroup(
int id);
111 const std::vector<Tilegroup>& get_tilegroups()
const;
112 void change_tileset();
114 void select_objectgroup(
int id);
115 const std::vector<ObjectGroup>& get_objectgroups()
const;
117 void scroll(
const Vector& velocity);
119 bool is_level_loaded()
const {
return m_levelloaded; }
122 m_overlay_widget->edit_path(path, new_marked_object);
125 void add_layer(
GameObject* layer) { m_layers_widget->add_layer(layer); }
127 GameObject* get_selected_tilemap()
const {
return m_layers_widget->get_selected_tilemap(); }
129 Sector* get_sector() {
return m_sector; }
135 void set_sector(
Sector* sector);
136 void set_level(std::unique_ptr<Level> level,
bool reset =
true);
141 void update_keyboard(
const Controller& controller);
144 std::unique_ptr<Level> m_level;
145 std::unique_ptr<World> m_world;
147 std::string m_levelfile;
148 std::string m_test_levelfile;
152 bool m_newlevel_request;
153 bool m_reload_request;
154 bool m_reactivate_request;
155 bool m_deactivate_request;
159 std::unique_ptr<Savegame> m_savegame;
169 std::vector<std::unique_ptr<Widget> > m_widgets;
176 SurfacePtr m_bgr_surface;
178 std::unique_ptr<UndoManager> m_undo_manager;
179 bool m_ignore_sector_change;
Definition: controller.hpp:56
Abstract base class for code the MainLoop runs exclusively and full-screen.
Definition: screen.hpp:29
Simple two dimensional vector.
Definition: vector.hpp:24
void check_save_prerequisites(const std::function< void()> &callback) const
Checks whether the level can be saved and does not contain obvious issues (currently: check if main s...
Definition: editor.cpp:697
Represents one of (potentially) multiple, separate parts of a Level.
Definition: sector.hpp:49
virtual void leave() override
gets called when the current screen is temporarily suspended
Definition: editor.cpp:510
A 'Currenton' allows access to the currently active instance of a class via the static current() func...
Definition: currenton.hpp:30
virtual void setup() override
gets called before this screen gets activated (which is at least once before the first draw or update...
Definition: editor.cpp:517
Represents a collection of Sectors running in a single GameSession.
Definition: level.hpp:29
Base class for all the things that make up Levels' Sectors.
Definition: game_object.hpp:46
Definition: tile_selection.hpp:24
Definition: compositor.hpp:29
Definition: savegame.hpp:66
Definition: object_group.hpp:27
Definition: editor.hpp:45
virtual void draw(Compositor &) override
gets called once per frame.
Definition: editor.cpp:134
Definition: undo_manager.hpp:26
virtual void update(float dt_sec, const Controller &controller) override
gets called for once (per logical) frame.
Definition: editor.cpp:159
Definition: tile_set.hpp:42