From f9fd1dc754a269579f69be4660913f65db08de12 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 13 Sep 2016 22:26:56 -0400 Subject: [PATCH] Add a status bar (empty for now) --- src/gui/Window.cc | 9 ++++++++- src/gui/Window.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/Window.cc b/src/gui/Window.cc index afdf0e7..4dc6672 100644 --- a/src/gui/Window.cc +++ b/src/gui/Window.cc @@ -450,7 +450,7 @@ void Window::resize() m_columns = m_width / m_font.get_advance(); if (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); } @@ -459,6 +459,7 @@ void Window::redraw() glClear(GL_COLOR_BUFFER_BIT); draw_text(); + draw_status_bar(); 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); 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); +} diff --git a/src/gui/Window.h b/src/gui/Window.h index 942bfc6..974de0f 100644 --- a/src/gui/Window.h +++ b/src/gui/Window.h @@ -40,6 +40,7 @@ protected: void draw_character(int screen_column, int screen_row, uint32_t character); 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_status_bar(); SDL_Window * m_window; bool m_exit_requested;