17 #ifndef HEADER_SUPERTUX_EDITOR_PARTICLE_EDITOR_HPP 18 #define HEADER_SUPERTUX_EDITOR_PARTICLE_EDITOR_HPP 26 #include "interface/control.hpp" 27 #include "interface/control_button.hpp" 28 #include "interface/control_enum.hpp" 29 #include "interface/control_checkbox.hpp" 30 #include "interface/control_textbox_float.hpp" 31 #include "interface/control_textbox_int.hpp" 32 #include "interface/label.hpp" 33 #include "object/custom_particle_system.hpp" 34 #include "supertux/screen.hpp" 35 #include "util/currenton.hpp" 36 #include "util/writer.hpp" 44 static bool is_active();
57 virtual void setup()
override;
58 virtual void leave()
override;
62 void event(
const SDL_Event& ev);
63 void update_keyboard(
const Controller& controller);
64 void check_unsaved_changes(
const std::function<
void ()>& action);
69 void open_particle_directory();
72 void save(
const std::string& filename,
bool retry =
false);
74 void request_save(
bool is_save_as =
false,
75 const std::function<
void(
bool)>& callback = [](
bool was_saved){});
76 void open(
const std::string& filename) { m_filename = filename;
reload(); }
77 void new_file() { m_filename =
"";
reload(); }
85 void reload_particles();
87 void reset_texture_ui();
89 void addTextboxFloat(
const std::string& name,
float* bind,
92 void addTextboxFloatWithImprecision(
const std::string& name,
float* bind,
93 float* imprecision_bind,
98 void addTextboxInt(
const std::string& name,
int* bind,
101 void addCheckbox(std::string name,
bool* bind);
102 void addControl(std::string name,
103 std::unique_ptr<InterfaceControl> new_control);
104 void addEasingEnum(std::string name, EasingMode* bind);
113 std::vector<std::unique_ptr<InterfaceControl>> m_controls;
114 std::vector<std::unique_ptr<InterfaceControl>> m_controls_textures;
115 std::vector<std::function<void()>> m_texture_rebinds;
116 std::vector<std::shared_ptr<CustomParticleSystem::ParticleProps>> m_undo_stack;
117 std::vector<std::shared_ptr<CustomParticleSystem::ParticleProps>> m_redo_stack;
118 bool m_in_texture_tab;
119 int m_texture_current;
121 std::shared_ptr<CustomParticleSystem::ParticleProps> m_saved_version;
123 std::unique_ptr<CustomParticleSystem> m_particles;
124 std::string m_filename;
Definition: particle_editor.hpp:38
Definition: controller.hpp:57
Abstract base class for code the MainLoop runs exclusively and full-screen.
Definition: screen.hpp:31
virtual void setup() override
gets called before this screen gets activated (which is at least once before the first draw or update...
Definition: particle_editor.cpp:754
virtual void draw(Compositor &) override
gets called once per frame.
Definition: particle_editor.cpp:651
Definition: particle_editor_menu.hpp:22
A 'Currenton' allows access to the currently active instance of a class via the static current() func...
Definition: currenton.hpp:30
virtual void update(float dt_sec, const Controller &controller) override
gets called for once (per logical) frame.
Definition: particle_editor.cpp:690
virtual IntegrationStatus get_status() const override
Gives details about what the user is doing right now.
Definition: particle_editor.cpp:887
Definition: compositor.hpp:29
Definition: integration.hpp:26
Definition: control_textbox_float.hpp:22
virtual void leave() override
gets called when the current screen is temporarily suspended
Definition: particle_editor.cpp:748
Definition: control_textbox_int.hpp:22
void reload()
Reloads the particle object from the filename in m_filename.
Definition: particle_editor.cpp:78
Definition: writer.cpp:23