Show status errors in red
This commit is contained in:
parent
14fd4b96f7
commit
68b2c7e0e7
@ -495,7 +495,17 @@ void Window::draw_status_message()
|
|||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
uint64_t current_time = Jtk_UsTime();
|
uint64_t current_time = Jtk_UsTime();
|
||||||
float alpha;
|
float alpha, g, b;
|
||||||
|
if (m_status_error)
|
||||||
|
{
|
||||||
|
g = 0.0;
|
||||||
|
b = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g = 1.0;
|
||||||
|
b = 1.0;
|
||||||
|
}
|
||||||
if (((current_time - m_status_message_basetime) / 1000) < (STATUS_TIME / 2))
|
if (((current_time - m_status_message_basetime) / 1000) < (STATUS_TIME / 2))
|
||||||
{
|
{
|
||||||
alpha = 1.0;
|
alpha = 1.0;
|
||||||
@ -510,7 +520,7 @@ void Window::draw_status_message()
|
|||||||
}
|
}
|
||||||
for (size_t i = 0u, length = m_status_message.size(); i < length; i++)
|
for (size_t i = 0u, length = m_status_message.size(); i < length; i++)
|
||||||
{
|
{
|
||||||
m_gl->draw_character(x, 0, m_status_message[i], *m_font, 1.0, 1.0, 1.0, alpha);
|
m_gl->draw_character(x, 0, m_status_message[i], *m_font, 1.0, g, b, alpha);
|
||||||
x += m_font->get_advance();
|
x += m_font->get_advance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,9 +577,10 @@ static bool is_number(const EncodedString & s)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::set_status(const std::string & status)
|
void Window::set_status(const std::string & status, bool error)
|
||||||
{
|
{
|
||||||
clear_status();
|
clear_status();
|
||||||
|
m_status_error = error;
|
||||||
m_status_message = status;
|
m_status_message = status;
|
||||||
m_status_message_basetime = Jtk_UsTime();
|
m_status_message_basetime = Jtk_UsTime();
|
||||||
m_status_message_timer = Jtk_AddTimer(STATUS_TIME / 2, 50u, nullptr, nullptr);
|
m_status_message_timer = Jtk_AddTimer(STATUS_TIME / 2, 50u, nullptr, nullptr);
|
||||||
@ -644,7 +655,7 @@ void Window::command_write_file(const CommandParser & cp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_status("Error writing file");
|
set_status("Error writing file", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_redraw_requested = true;
|
m_redraw_requested = true;
|
||||||
|
@ -58,7 +58,7 @@ protected:
|
|||||||
|
|
||||||
void command_write_file(const CommandParser & cp);
|
void command_write_file(const CommandParser & cp);
|
||||||
void command_quit(const CommandParser & cp);
|
void command_quit(const CommandParser & cp);
|
||||||
void set_status(const std::string & status);
|
void set_status(const std::string & status, bool error = false);
|
||||||
void clear_status();
|
void clear_status();
|
||||||
|
|
||||||
void * m_window;
|
void * m_window;
|
||||||
@ -81,6 +81,7 @@ protected:
|
|||||||
std::string m_status_message;
|
std::string m_status_message;
|
||||||
size_t m_status_message_timer;
|
size_t m_status_message_timer;
|
||||||
uint64_t m_status_message_basetime;
|
uint64_t m_status_message_basetime;
|
||||||
|
bool m_status_error;
|
||||||
bool m_command_invalid;
|
bool m_command_invalid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user