diff --git a/src/sortiva/sortiva-draw.cpp b/src/sortiva/sortiva-draw.cpp index f8c6ba4..28d621b 100644 --- a/src/sortiva/sortiva-draw.cpp +++ b/src/sortiva/sortiva-draw.cpp @@ -41,14 +41,14 @@ void Sortiva::draw() { Vector2 margin = { .x = m_Width * 0.01f, - .y = m_Height * 0.01f + .y = 70 }; DrawRectangleV(margin, { m_Width - 2 * margin.x, m_Height - 2 * margin.y }, { 60, 60, 60, 255 }); margin = { .x = m_Width * 0.02f, - .y = m_Height * 0.02f + .y = 80 }; Rectangle plane = { @@ -60,7 +60,7 @@ void Sortiva::draw() if (m_Steps->empty()) { - static const char* msg = "Select and run a Sorting algorithm"; + static const char* msg = "Press \"Run\" to start a sorting"; static int width = MeasureText(msg, 20); DrawText(msg, plane.x + plane.width / 2 - width / 2, plane.y + plane.height / 2 - 10, 20, { 245, 245, 245, 255 }); return; diff --git a/src/sortiva/sortiva-draw_overlay.cpp b/src/sortiva/sortiva-draw_overlay.cpp index 1ac86ce..345a529 100644 --- a/src/sortiva/sortiva-draw_overlay.cpp +++ b/src/sortiva/sortiva-draw_overlay.cpp @@ -14,15 +14,20 @@ void Sortiva::draw_overlay() // //if (edit_mode) GuiLock(); - if (GuiButton({ 450, 20, 100, 40 }, "Run")) + if (GuiButton({ 20, 15, 100, 40 }, "Run")) { setup(); m_SortingFinished = false; } - if (GuiButton({ 200, 20, 100, 40 }, "Pause")) + if (GuiButton({ 140, 15, 100, 40 }, m_SortingFinished ? "Continue" : "Pause")) { - if (m_SortingFinished && m_Steps->empty()) return; - m_SortingFinished = !m_SortingFinished; + if (!m_SortingFinished || !m_Steps->empty()) { + m_SortingFinished = !m_SortingFinished; + } } + if (GuiButton({ 20, static_cast(GetScreenHeight()) - 15 - 40, 100, 40 }, "Reset")) + { + m_Steps->clear(); + } } diff --git a/src/sortiva/sortiva.cpp b/src/sortiva/sortiva.cpp index b0cc0eb..98abe72 100644 --- a/src/sortiva/sortiva.cpp +++ b/src/sortiva/sortiva.cpp @@ -24,6 +24,8 @@ Sortiva::Sortiva() : m_Ticker(std::chrono::seconds(1)) SetWindowState(ConfigFlags::FLAG_WINDOW_RESIZABLE | ConfigFlags::FLAG_VSYNC_HINT); SetTargetFPS(60); + + MaximizeWindow(); } Sortiva::~Sortiva() @@ -74,6 +76,6 @@ void Sortiva::setup() for (int i = 1; i <= count; ++i) { - m_Steps->at(m_List.at(i-1) - 1).value = i; + m_Steps->at(m_List.at(i - 1) - 1).value = i; } }