Improvements to simulate UI

- Improved Help overlay text, mention shortcuts for UI toggle.
- Removed buttons for UI toggle.
- Moved Spacing / Color / Font to the end of the Option section.

PiperOrigin-RevId: 576480554
Change-Id: Ie1427b97cb784421490c276a8544d570a6042188
This commit is contained in:
Yuval Tassa
2023-10-25 04:02:51 -07:00
committed by Copybara-Service
parent 843360b732
commit 8eb36d9a7c
2 changed files with 27 additions and 17 deletions
+23 -11
View File
@@ -130,8 +130,8 @@ const mjuiDef defFile[] = {
const char help_content[] =
"Space\n"
"+ -\n"
"Right arrow\n"
"Left arrow\n"
"Left / Right arrow\n"
"Tab / Shift-Tab\n"
"[ ]\n"
"Esc\n"
"Double-click\n"
@@ -148,25 +148,25 @@ const char help_content[] =
"F3\n"
"F4\n"
"F5\n"
"UI right hold\n"
"UI right-button hold\n"
"UI title double-click";
const char help_title[] =
"Play / Pause\n"
"Speed up / down\n"
"Step forward\n"
"Step back\n"
"Speed Up / Down\n"
"Step Back / Forward\n"
"Toggle Left / Right UI\n"
"Cycle cameras\n"
"Free camera\n"
"Select\n"
"Select parent\n"
"Center\n"
"Center camera\n"
"Tracking camera\n"
"Zoom\n"
"View rotate\n"
"View translate\n"
"Object rotate\n"
"Object translate\n"
"View Orbit\n"
"View Pan\n"
"Object Rotate\n"
"Object Translate\n"
"Help\n"
"Info\n"
"Profiler\n"
@@ -1625,6 +1625,18 @@ void UiEvent(mjuiState* state) {
sim->speed_changed = true;
}
break;
case mjKEY_TAB: // toggle left/right UI
if (!state->shift) {
// toggle left UI
sim->ui0_enable = !sim->ui0_enable;
UiModify(&sim->ui0, state, &sim->platform_ui->mjr_context());
} else {
// toggle right UI
sim->ui1_enable = !sim->ui1_enable;
UiModify(&sim->ui1, state, &sim->platform_ui->mjr_context());
}
break;
}
return;
+4 -6
View File
@@ -257,13 +257,8 @@ class Simulate {
// Constant arrays needed for the option section of UI and the UI interface
// TODO setting the size here is not ideal
const mjuiDef def_option[15] = {
const mjuiDef def_option[13] = {
{mjITEM_SECTION, "Option", 1, nullptr, "AO"},
{mjITEM_SELECT, "Spacing", 1, &this->spacing, "Tight\nWide"},
{mjITEM_SELECT, "Color", 1, &this->color, "Default\nOrange\nWhite\nBlack"},
{mjITEM_SELECT, "Font", 1, &this->font, "50 %\n100 %\n150 %\n200 %\n250 %\n300 %"},
{mjITEM_CHECKINT, "Left UI (Tab)", 1, &this->ui0_enable, " #258"},
{mjITEM_CHECKINT, "Right UI", 1, &this->ui1_enable, "S#258"},
{mjITEM_CHECKINT, "Help", 2, &this->help, " #290"},
{mjITEM_CHECKINT, "Info", 2, &this->info, " #291"},
{mjITEM_CHECKINT, "Profiler", 2, &this->profiler, " #292"},
@@ -276,6 +271,9 @@ class Simulate {
#endif
{mjITEM_CHECKINT, "Vertical Sync", 1, &this->vsync, ""},
{mjITEM_CHECKINT, "Busy Wait", 1, &this->busywait, ""},
{mjITEM_SELECT, "Spacing", 1, &this->spacing, "Tight\nWide"},
{mjITEM_SELECT, "Color", 1, &this->color, "Default\nOrange\nWhite\nBlack"},
{mjITEM_SELECT, "Font", 1, &this->font, "50 %\n100 %\n150 %\n200 %\n250 %\n300 %"},
{mjITEM_END}
};