Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tritonas00 committed Aug 28, 2021
1 parent 1c292cb commit ceee2ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions source/main/gui/panels/GUI_ConsoleWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ void ConsoleWindow::Draw()
this->DrawRowText("int getNodeCount()", "game.log(' ' + game.getCurrentTruck().getNodeCount())", "Gets the total amount of nodes of the truck");
this->DrawRowCheckbox("float getTotalMass()", "game.log(' ' + game.getCurrentTruck().getTotalMass({}))", "Gets the total mass of the truck", locked, "With locked");
this->DrawRowText("int getWheelNodeCount()", "game.log(' ' + game.getCurrentTruck().getWheelNodeCount())", "Gets the total amount of nodes of the wheels of the truck");
ImGui::NextColumn();
this->DrawRowSlider("void setMass()", "game.getCurrentTruck().setMass({})", "Sets the mass of the truck", 1000.f, 10000.f, mass);
this->DrawRowText("bool getBrakeLightVisible()", "game.log(' ' + game.getCurrentTruck().getBrakeLightVisible())", "Returns true if the brake light is enabled");
this->DrawRowInt("bool getCustomLightVisible()", "game.log(' ' + game.getCurrentTruck().getCustomLightVisible({}))", "Returns true if the custom light with the number is enabled", light);
Expand Down Expand Up @@ -225,11 +224,11 @@ void ConsoleWindow::DrawRowSlider(const char* nameStr, std::string codeStr, cons
ImGui::AlignFirstTextHeightToWidgets();
ImGui::Text(descStr);
ImGui::PopID();
ImGui::NextColumn();
}

void ConsoleWindow::DrawRowText(const char* nameStr, std::string codeStr, const char* descStr)
{
ImGui::NextColumn();
ImGui::AlignFirstTextHeightToWidgets();
if (ImGui::Selectable(nameStr)) { App::GetScriptEngine()->executeString(codeStr); }
ImGui::NextColumn();
Expand All @@ -238,11 +237,11 @@ void ConsoleWindow::DrawRowText(const char* nameStr, std::string codeStr, const
ImGui::NextColumn();
ImGui::AlignFirstTextHeightToWidgets();
ImGui::Text(descStr);
ImGui::NextColumn();
}

void ConsoleWindow::DrawRowCheckbox(const char* nameStr, std::string codeStr, const char* descStr, bool &var_ref, const char* label)
{
ImGui::NextColumn();
ImGui::AlignFirstTextHeightToWidgets();
if (ImGui::Selectable(nameStr)) { App::GetScriptEngine()->executeString(fmt::format(codeStr, var_ref)); }
ImGui::NextColumn();
Expand All @@ -251,12 +250,12 @@ void ConsoleWindow::DrawRowCheckbox(const char* nameStr, std::string codeStr, co
ImGui::NextColumn();
ImGui::AlignFirstTextHeightToWidgets();
ImGui::Text(descStr);
ImGui::NextColumn();
}

void ConsoleWindow::DrawRowInt(const char* nameStr, std::string codeStr, const char* descStr, int &var_ref)
{
ImGui::PushID(nameStr);
ImGui::NextColumn();
ImGui::AlignFirstTextHeightToWidgets();
if (ImGui::Selectable(nameStr)) { App::GetScriptEngine()->executeString(fmt::format(codeStr, var_ref)); }
ImGui::NextColumn();
Expand All @@ -268,12 +267,12 @@ void ConsoleWindow::DrawRowInt(const char* nameStr, std::string codeStr, const c
ImGui::AlignFirstTextHeightToWidgets();
ImGui::Text(descStr);
ImGui::PopID();
ImGui::NextColumn();
}

void ConsoleWindow::DrawRowIntNode(const char* nameStr, std::string codeStr, const char* descStr, int &var_ref, int &node_x, int &node_y, int &node_z)
{
ImGui::PushID(nameStr);
ImGui::NextColumn();
ImGui::AlignFirstTextHeightToWidgets();
if (ImGui::Selectable(nameStr)) { App::GetScriptEngine()->executeString(fmt::format(codeStr, node_x, node_y, node_z)); }
ImGui::NextColumn();
Expand All @@ -285,12 +284,12 @@ void ConsoleWindow::DrawRowIntNode(const char* nameStr, std::string codeStr, con
ImGui::AlignFirstTextHeightToWidgets();
ImGui::Text(descStr);
ImGui::PopID();
ImGui::NextColumn();
}

void ConsoleWindow::DrawRowIntCheckbox(const char* nameStr, std::string codeStr, const char* descStr, int &var_ref, bool &on, const char* label)
{
ImGui::PushID(nameStr);
ImGui::NextColumn();
ImGui::AlignFirstTextHeightToWidgets();
if (ImGui::Selectable(nameStr)) { App::GetScriptEngine()->executeString(fmt::format(codeStr, var_ref, on)); }
ImGui::NextColumn();
Expand All @@ -304,4 +303,5 @@ void ConsoleWindow::DrawRowIntCheckbox(const char* nameStr, std::string codeStr,
ImGui::AlignFirstTextHeightToWidgets();
ImGui::Text(descStr);
ImGui::PopID();
ImGui::NextColumn();
}

0 comments on commit ceee2ac

Please # to comment.