Improving UI
This commit is contained in:
parent
b156a9c1ef
commit
96aae4e50d
3 changed files with 15 additions and 8 deletions
|
@ -41,14 +41,14 @@ void Sortiva::draw()
|
||||||
{
|
{
|
||||||
Vector2 margin = {
|
Vector2 margin = {
|
||||||
.x = m_Width * 0.01f,
|
.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 });
|
DrawRectangleV(margin, { m_Width - 2 * margin.x, m_Height - 2 * margin.y }, { 60, 60, 60, 255 });
|
||||||
|
|
||||||
|
|
||||||
margin = {
|
margin = {
|
||||||
.x = m_Width * 0.02f,
|
.x = m_Width * 0.02f,
|
||||||
.y = m_Height * 0.02f
|
.y = 80
|
||||||
};
|
};
|
||||||
|
|
||||||
Rectangle plane = {
|
Rectangle plane = {
|
||||||
|
@ -60,7 +60,7 @@ void Sortiva::draw()
|
||||||
|
|
||||||
if (m_Steps->empty())
|
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);
|
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 });
|
DrawText(msg, plane.x + plane.width / 2 - width / 2, plane.y + plane.height / 2 - 10, 20, { 245, 245, 245, 255 });
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -14,15 +14,20 @@ void Sortiva::draw_overlay()
|
||||||
//
|
//
|
||||||
//if (edit_mode) GuiLock();
|
//if (edit_mode) GuiLock();
|
||||||
|
|
||||||
if (GuiButton({ 450, 20, 100, 40 }, "Run"))
|
if (GuiButton({ 20, 15, 100, 40 }, "Run"))
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
m_SortingFinished = false;
|
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;
|
if (!m_SortingFinished || !m_Steps->empty()) {
|
||||||
m_SortingFinished = !m_SortingFinished;
|
m_SortingFinished = !m_SortingFinished;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GuiButton({ 20, static_cast<float>(GetScreenHeight()) - 15 - 40, 100, 40 }, "Reset"))
|
||||||
|
{
|
||||||
|
m_Steps->clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ Sortiva::Sortiva() : m_Ticker(std::chrono::seconds(1))
|
||||||
SetWindowState(ConfigFlags::FLAG_WINDOW_RESIZABLE | ConfigFlags::FLAG_VSYNC_HINT);
|
SetWindowState(ConfigFlags::FLAG_WINDOW_RESIZABLE | ConfigFlags::FLAG_VSYNC_HINT);
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
|
|
||||||
|
MaximizeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
Sortiva::~Sortiva()
|
Sortiva::~Sortiva()
|
||||||
|
@ -74,6 +76,6 @@ void Sortiva::setup()
|
||||||
|
|
||||||
for (int i = 1; i <= count; ++i)
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue