mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-05 03:48:34 -06:00
Add display for current time and ability to return to today to the space/time component
This commit is contained in:
@@ -139,10 +139,12 @@ void GuiSpaceTimeComponent::render() {
|
||||
CaptionText("Time Controls");
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f);
|
||||
|
||||
ImGui::Text("Current Date: %s", OsEng.timeManager().time().UTC().c_str());
|
||||
|
||||
constexpr int BufferSize = 256;
|
||||
static char Buffer[BufferSize];
|
||||
bool dateChanged = ImGui::InputText(
|
||||
"Date",
|
||||
"Change Date",
|
||||
Buffer,
|
||||
BufferSize,
|
||||
ImGuiInputTextFlags_EnterReturnsTrue
|
||||
@@ -207,8 +209,26 @@ void GuiSpaceTimeComponent::render() {
|
||||
incrementTime(-1);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 55.f);
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15.f);
|
||||
|
||||
bool nowDay = ImGui::Button("Now");
|
||||
if (nowDay) {
|
||||
std::string nowTime = Time::now().UTC();
|
||||
// UTC returns a string of the type YYYY MMM DDTHH:mm:ss.xxx
|
||||
// setTime doesn't like the T in it and wants a space instead
|
||||
nowTime[11] = ' ';
|
||||
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.time.setTime(\"" + nowTime + "\")",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15.f);
|
||||
|
||||
|
||||
bool plusDay = ImGui::Button("+Day");
|
||||
if (plusDay) {
|
||||
|
||||
Reference in New Issue
Block a user