Add a status bar (empty for now)

This commit is contained in:
Josh Holtrop 2016-09-13 22:26:56 -04:00
parent 2289fe123e
commit f9fd1dc754
2 changed files with 9 additions and 1 deletions

View File

@ -450,7 +450,7 @@ void Window::resize()
m_columns = m_width / m_font.get_advance(); m_columns = m_width / m_font.get_advance();
if (m_columns < 1) if (m_columns < 1)
m_columns = 1; m_columns = 1;
m_rows = (m_height + m_font.get_line_height() - 1) / m_font.get_line_height(); m_rows = (m_height - 2) / m_font.get_line_height();
update_cursor_row(m_cursor_row); update_cursor_row(m_cursor_row);
} }
@ -459,6 +459,7 @@ void Window::redraw()
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
draw_text(); draw_text();
draw_status_bar();
SDL_GL_SwapWindow(m_window); SDL_GL_SwapWindow(m_window);
} }
@ -500,3 +501,9 @@ void Window::draw_rect(int x, int y, int width, int height, float r, float g, fl
m_shaders.rect->set_size(width, height); m_shaders.rect->set_size(width, height);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
} }
void Window::draw_status_bar()
{
draw_rect(0, m_font.get_line_height(), m_width, 1, 0.5, 0.5, 0.5, 1.0);
draw_rect(0, 0, m_width, m_font.get_line_height(), 0.0, 0.0, 0.0, 1.0);
}

View File

@ -40,6 +40,7 @@ protected:
void draw_character(int screen_column, int screen_row, uint32_t character); void draw_character(int screen_column, int screen_row, uint32_t character);
void update_cursor_row(int cursor_row); void update_cursor_row(int cursor_row);
void draw_rect(int x, int y, int width, int height, float r, float g, float b, float a); void draw_rect(int x, int y, int width, int height, float r, float g, float b, float a);
void draw_status_bar();
SDL_Window * m_window; SDL_Window * m_window;
bool m_exit_requested; bool m_exit_requested;