forked from mirrors/principia
Fixes to keybinds and add keybinds to tooltips
This commit is contained in:
parent
ea2bdb6efd
commit
e47a80f1fa
3 changed files with 43 additions and 40 deletions
|
|
@ -1746,7 +1746,11 @@ game::init_gui(void)
|
|||
GW_REMOVE, AREA_BOTTOM_LEFT,
|
||||
gui_spritesheet::get_sprite(S_CLOSE), 0);
|
||||
this->wdg_remove->priority = 900;
|
||||
#ifdef TMS_BACKEND_PC
|
||||
this->wdg_remove->set_tooltip("Remove object (key binding: Delete)");
|
||||
#else
|
||||
this->wdg_remove->set_tooltip("Remove object");
|
||||
#endif
|
||||
this->wdg_remove->marker = true;
|
||||
this->wdg_remove->marker_color.r = 1.5f;
|
||||
|
||||
|
|
@ -1841,28 +1845,44 @@ game::init_gui(void)
|
|||
GW_LAYER_DOWN_CYCLE, AREA_BOTTOM_LEFT,
|
||||
gui_spritesheet::get_sprite(S_LAYER0), 0);
|
||||
this->wdg_layer->priority = 1800;
|
||||
#ifdef TMS_BACKEND_PC
|
||||
this->wdg_layer->set_tooltip("Change object layer (key binding: Z/X)");
|
||||
#else
|
||||
this->wdg_layer->set_tooltip("Change object layer");
|
||||
#endif
|
||||
|
||||
this->wdg_layer_down = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_BUTTON,
|
||||
GW_LAYER_DOWN, AREA_TOP_CENTER,
|
||||
gui_spritesheet::get_sprite(S_MINUS), 0);
|
||||
this->wdg_layer_down->priority = 1800;
|
||||
#ifdef TMS_BACKEND_PC
|
||||
this->wdg_layer_down->set_tooltip("Layer down (key binding: Z)");
|
||||
#else
|
||||
this->wdg_layer_down->set_tooltip("Layer down");
|
||||
#endif
|
||||
|
||||
this->wdg_layer_up = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_BUTTON,
|
||||
GW_LAYER_UP, AREA_TOP_CENTER,
|
||||
gui_spritesheet::get_sprite(S_PLUS), 0);
|
||||
this->wdg_layer_up->priority = 1700;
|
||||
#ifdef TMS_BACKEND_PC
|
||||
this->wdg_layer_up->set_tooltip("Layer up (key binding: X)");
|
||||
#else
|
||||
this->wdg_layer_up->set_tooltip("Layer up");
|
||||
#endif
|
||||
|
||||
this->wdg_lock = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_BUTTON,
|
||||
GW_TOGGLE_LOCK, AREA_BOTTOM_LEFT,
|
||||
gui_spritesheet::get_sprite(S_BTN_LOCK), 0);
|
||||
this->wdg_lock->priority = 1700;
|
||||
#ifdef TMS_BACKEND_PC
|
||||
this->wdg_lock->set_tooltip("Toggle lock (key binding: N)");
|
||||
#else
|
||||
this->wdg_lock->set_tooltip("Toggle lock");
|
||||
#endif
|
||||
|
||||
this->wdg_detach = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_BUTTON,
|
||||
|
|
@ -1903,7 +1923,11 @@ game::init_gui(void)
|
|||
GW_CONFIG, AREA_BOTTOM_LEFT,
|
||||
gui_spritesheet::get_sprite(S_CONFIG), 0);
|
||||
this->wdg_config->priority = 1200;
|
||||
#ifdef TMS_BACKEND_PC
|
||||
this->wdg_config->set_tooltip("Configure object (key binding: Y)");
|
||||
#else
|
||||
this->wdg_config->set_tooltip("Configure object");
|
||||
#endif
|
||||
|
||||
this->wdg_tracker = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_BUTTON,
|
||||
|
|
|
|||
|
|
@ -6189,6 +6189,7 @@ game::handle_input_playing(tms::event *ev, int action)
|
|||
e->disconnect_all();
|
||||
|
||||
this->post_interact_select(e);
|
||||
this->refresh_widgets();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -7765,7 +7766,12 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
this->cam->_position.y += (this->shift_down() ? CAM_BIG_JUMP : CAM_NORMAL_JUMP);
|
||||
break;
|
||||
case TMS_KEY_S:
|
||||
this->cam->_position.y -= (this->shift_down() ? CAM_BIG_JUMP : CAM_NORMAL_JUMP);
|
||||
if (ev->data.key.mod & TMS_MOD_CTRL) {
|
||||
// Prevent camera from moving when saving with Ctrl+S
|
||||
} else {
|
||||
this->cam->_position.y -= (this->shift_down() ? CAM_BIG_JUMP : CAM_NORMAL_JUMP);
|
||||
}
|
||||
|
||||
break;
|
||||
case TMS_KEY_V:
|
||||
#if defined DEBUG
|
||||
|
|
@ -7778,6 +7784,7 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
|
||||
case TMS_KEY_MINUS: this->cam->_position.z += 1.f; break;
|
||||
case TMS_KEY_EQUALS:this->cam->_position.z -= 1.f; break;
|
||||
|
||||
case TMS_KEY_DELETE:
|
||||
if (this->get_mode() == GAME_MODE_DEFAULT) {
|
||||
if (this->selection.e && !this->selection.e->requires_delete_confirmation()) {
|
||||
|
|
@ -7785,13 +7792,6 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TMS_KEY_F7:
|
||||
if (ev->data.key.mod & TMS_MOD_CTRL) {
|
||||
disable_menu = true;
|
||||
this->select_random_entity();
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (ev->type == TMS_EV_KEY_PRESS) {
|
||||
if (this->menu_handle_event(ev) == EVENT_DONE) {
|
||||
|
|
@ -7888,12 +7888,6 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
break;
|
||||
#endif
|
||||
|
||||
/* F5: Restore camera postion? */
|
||||
case TMS_KEY_F5:
|
||||
this->cam_rel_pos.x = 0.f;
|
||||
this->cam_rel_pos.y = 0.f;
|
||||
break;
|
||||
|
||||
/* I: Show help about selected object */
|
||||
case TMS_KEY_I:
|
||||
if (this->selection.e) {
|
||||
|
|
@ -7947,6 +7941,7 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
this->selection.e->set_position(old_pos.x, old_pos.y);
|
||||
}
|
||||
break;
|
||||
|
||||
case TMS_KEY_RIGHT:
|
||||
if (this->selection.e) {
|
||||
b2Vec2 old_pos = this->selection.e->get_position();
|
||||
|
|
@ -7996,15 +7991,6 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
}
|
||||
break;
|
||||
|
||||
/* WASD: Move camera */
|
||||
/* CTRL+S: Save level */
|
||||
/* CTRL+N: Open New Level-dialog */
|
||||
case TMS_KEY_A: this->cam->_position.x -= 1.f; break;
|
||||
case TMS_KEY_D: this->cam->_position.x += 1.f; break;
|
||||
case TMS_KEY_W: this->cam->_position.y += 1.f; break;
|
||||
case TMS_KEY_MINUS: this->cam->_position.z += 1.f; break;
|
||||
case TMS_KEY_EQUALS:this->cam->_position.z -= 1.f; break;
|
||||
|
||||
/* Toggle multiselect */
|
||||
case TMS_KEY_M:
|
||||
if (this->get_mode() == GAME_MODE_MULTISEL) {
|
||||
|
|
@ -8018,6 +8004,7 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
case TMS_KEY_T:
|
||||
if (this->selection.e) {
|
||||
this->selection.e->disconnect_all();
|
||||
this->refresh_widgets();
|
||||
}
|
||||
#if 0
|
||||
if (this->state.sandbox && this->selection.e && this->selection.e->flag_active(ENTITY_IS_EDEVICE)) {
|
||||
|
|
@ -8037,19 +8024,12 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
if (ev->data.key.mod & TMS_MOD_CTRL) {
|
||||
disable_menu = true;
|
||||
|
||||
bool ask_for_new_name = false;
|
||||
bool ask_for_new_name = (W->level.name_len == 0);
|
||||
|
||||
if (W->level.name_len == 0) {
|
||||
ask_for_new_name = true;
|
||||
}
|
||||
|
||||
if (ask_for_new_name) {
|
||||
if (ask_for_new_name)
|
||||
ui::open_dialog(DIALOG_SAVE);
|
||||
} else {
|
||||
else
|
||||
P.add_action(ACTION_SAVE, 0);
|
||||
}
|
||||
} else {
|
||||
this->cam->_position.y -= 1.f;
|
||||
}
|
||||
break;
|
||||
case TMS_KEY_N:
|
||||
|
|
@ -8059,6 +8039,7 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
ui::open_dialog(DIALOG_NEW_LEVEL);
|
||||
} else {
|
||||
G->toggle_entity_lock(G->selection.e);
|
||||
this->refresh_widgets();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -8079,9 +8060,8 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
ui::confirm("Are you sure you want to delete this object?",
|
||||
"Yes", ACTION_DELETE_SELECTION,
|
||||
"No", ACTION_IGNORE);
|
||||
} else {
|
||||
} else
|
||||
this->delete_selected_entity();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -8128,7 +8108,6 @@ game::handle_input_paused(tms::event *ev, int action)
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case TMS_KEY_PAGEDOWN:
|
||||
case TMS_KEY_X:
|
||||
if (this->selection.e && this->state.sandbox) {
|
||||
|
|
|
|||
|
|
@ -220,15 +220,15 @@ menu_main::handle_input(tms::event *ev, int action)
|
|||
this->refresh_widgets();
|
||||
return T_OK;
|
||||
|
||||
case TMS_KEY_V:
|
||||
ui::messagef("Community host: %s", P.community_host);
|
||||
return T_OK;
|
||||
|
||||
#ifdef DEBUG
|
||||
case TMS_KEY_S:
|
||||
G->create_sandbox_menu();
|
||||
return T_OK;
|
||||
|
||||
case TMS_KEY_V:
|
||||
tms_debugf("Community host: %s. Update URL: %s", P.community_host, UPDATE_URL);
|
||||
return T_OK;
|
||||
|
||||
case TMS_KEY_O:
|
||||
{
|
||||
/* Open autosave if it exists, otherwise open latest modified level. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue