Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing a level by pressing Ctrl+T no longer messes up the autotile config #1941

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ Editor::get_level_directory() const
void
Editor::test_level(const boost::optional<std::pair<std::string, Vector>>& test_pos)
{
m_overlay_widget->reset_action_press();

Tile::draw_editor_images = false;
Compositor::s_render_lighting = true;
Expand Down
17 changes: 15 additions & 2 deletions src/editor/overlay_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,16 @@ EditorOverlayWidget::edit_path(Path* path, GameObject* new_marked_object)
}
}

void
EditorOverlayWidget::reset_action_press()
{
if (action_pressed)
{
g_config->editor_autotile_mode = !g_config->editor_autotile_mode;
action_pressed = false;
}
}

void
EditorOverlayWidget::select_object()
{
Expand Down Expand Up @@ -974,8 +984,11 @@ EditorOverlayWidget::on_key_up(const SDL_KeyboardEvent& key)
g_config->editor_snap_to_grid = !g_config->editor_snap_to_grid;
}
if (sym == SDLK_LCTRL || sym == SDLK_RCTRL) {
g_config->editor_autotile_mode = !g_config->editor_autotile_mode;
action_pressed = false;
if (action_pressed)
{
g_config->editor_autotile_mode = !g_config->editor_autotile_mode;
action_pressed = false;
}
// Hovered objects depend on which keys are pressed
hover_object();
}
Expand Down
1 change: 1 addition & 0 deletions src/editor/overlay_widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class EditorOverlayWidget final : public Widget
void on_level_change();

void edit_path(Path* path, GameObject* new_marked_object = nullptr);
void reset_action_press();

private:
static bool action_pressed;
Expand Down