change GL::draw_character() to accept a color
This commit is contained in:
parent
53d8df95f8
commit
8a8e329959
@ -236,12 +236,12 @@ int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_
|
|||||||
{
|
{
|
||||||
if (code_point < 0x20u)
|
if (code_point < 0x20u)
|
||||||
{
|
{
|
||||||
m_window->gl()->draw_character(win_x(x), win_y(y), '^', *m_window->font());
|
m_window->gl()->draw_character(win_x(x), win_y(y), '^', *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
m_window->gl()->draw_character(win_x(col_x(screen_column + 1)), win_y(y), code_point | 0x40u, *m_window->font());
|
m_window->gl()->draw_character(win_x(col_x(screen_column + 1)), win_y(y), code_point | 0x40u, *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_window->gl()->draw_character(win_x(x), win_y(y), code_point, *m_window->font());
|
m_window->gl()->draw_character(win_x(x), win_y(y), code_point, *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,14 +271,14 @@ void BufferPane::draw_buffer_character(int screen_column, int screen_row, uint32
|
|||||||
if (character < 0x20u)
|
if (character < 0x20u)
|
||||||
{
|
{
|
||||||
m_window->gl()->draw_character(win_x(col_x(screen_column)), win_y(row_y(screen_row)),
|
m_window->gl()->draw_character(win_x(col_x(screen_column)), win_y(row_y(screen_row)),
|
||||||
'^', *m_window->font());
|
'^', *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
m_window->gl()->draw_character(win_x(col_x(screen_column + 1)), win_y(row_y(screen_row)),
|
m_window->gl()->draw_character(win_x(col_x(screen_column + 1)), win_y(row_y(screen_row)),
|
||||||
(character - 0x20u + 'A'), *m_window->font());
|
(character - 0x20u + 'A'), *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_window->gl()->draw_character(win_x(col_x(screen_column)), win_y(row_y(screen_row)),
|
m_window->gl()->draw_character(win_x(col_x(screen_column)), win_y(row_y(screen_row)),
|
||||||
character, *m_window->font());
|
character, *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,12 +536,12 @@ void BufferPane::draw_status_bar()
|
|||||||
int filename_x = std::min(0, x - 3 - (int)filename.size() * m_window->font()->get_advance());
|
int filename_x = std::min(0, x - 3 - (int)filename.size() * m_window->font()->get_advance());
|
||||||
for (int i = 0; i < cursor_position_length; i++)
|
for (int i = 0; i < cursor_position_length; i++)
|
||||||
{
|
{
|
||||||
m_window->gl()->draw_character(win_x(x), win_y(0), cursor_position[i], *m_window->font());
|
m_window->gl()->draw_character(win_x(x), win_y(0), cursor_position[i], *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
x += m_window->font()->get_advance();
|
x += m_window->font()->get_advance();
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < filename.size(); i++)
|
for (size_t i = 0; i < filename.size(); i++)
|
||||||
{
|
{
|
||||||
m_window->gl()->draw_character(win_x(filename_x), win_y(0), filename[i], *m_window->font());
|
m_window->gl()->draw_character(win_x(filename_x), win_y(0), filename[i], *m_window->font(), 1.0, 1.0, 1.0, 1.0);
|
||||||
filename_x += m_window->font()->get_advance();
|
filename_x += m_window->font()->get_advance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,11 @@ void GL::draw_rect(int x, int y, int width, int height,
|
|||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL::draw_character(int x, int y, uint32_t character, Font & font)
|
void GL::draw_character(int x, int y, uint32_t character, Font & font,
|
||||||
|
float r, float g, float b, float a)
|
||||||
{
|
{
|
||||||
m_shaders.text->use();
|
m_shaders.text->use();
|
||||||
|
m_shaders.text->set_color(r, g, b, a);
|
||||||
m_shaders.text->set_position(x, y + font.get_baseline_offset());
|
m_shaders.text->set_position(x, y + font.get_baseline_offset());
|
||||||
font.get_glyph(character)->render();
|
font.get_glyph(character)->render();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ public:
|
|||||||
|
|
||||||
void draw_rect(int x, int y, int width, int height,
|
void draw_rect(int x, int y, int width, int height,
|
||||||
float r, float g, float b, float a);
|
float r, float g, float b, float a);
|
||||||
void draw_character(int x, int y, uint32_t character, Font & font);
|
void draw_character(int x, int y, uint32_t character, Font & font,
|
||||||
|
float r, float g, float b, float a);
|
||||||
void resize(int width, int height);
|
void resize(int width, int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user