draw cursor skinner in insert mode
This commit is contained in:
parent
16029506c7
commit
65dea7f84f
@ -436,7 +436,7 @@ void Window::draw_buffer()
|
|||||||
if (cursor.line == m_cursor->line)
|
if (cursor.line == m_cursor->line)
|
||||||
draw_crosshair(screen_column, screen_row);
|
draw_crosshair(screen_column, screen_row);
|
||||||
if (cursor == *m_cursor)
|
if (cursor == *m_cursor)
|
||||||
draw_cursor(screen_column, screen_row);
|
draw_cursor(screen_column, screen_row, m_buffer->piece_table->in_insert_mode());
|
||||||
uint32_t character = *cursor;
|
uint32_t character = *cursor;
|
||||||
if ((character != 0xFFFFFFFFu) &&
|
if ((character != 0xFFFFFFFFu) &&
|
||||||
(character != ' ') &&
|
(character != ' ') &&
|
||||||
@ -505,15 +505,13 @@ void Window::redraw()
|
|||||||
SDL_GL_SwapWindow(m_window);
|
SDL_GL_SwapWindow(m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::draw_cursor(int screen_column, int screen_row)
|
void Window::draw_cursor(int screen_column, int screen_row, bool insert_mode)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
colrow_to_xy(screen_column, screen_row, &x, &y);
|
colrow_to_xy(screen_column, screen_row, &x, &y);
|
||||||
m_cursor_array->bind();
|
int width = insert_mode ? 1 : m_font.get_advance();
|
||||||
m_shaders.flat->use();
|
int height = m_font.get_line_height();
|
||||||
m_shaders.flat->set_color(1.0, 0.2, 1.0, 1.0);
|
draw_rect(x, y, width, height, 1.0, 0.2, 1.0, 1.0);
|
||||||
m_shaders.flat->set_position(x, y);
|
|
||||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::draw_crosshair(int screen_column, int screen_row)
|
void Window::draw_crosshair(int screen_column, int screen_row)
|
||||||
|
@ -37,7 +37,7 @@ protected:
|
|||||||
|
|
||||||
void resize();
|
void resize();
|
||||||
void redraw();
|
void redraw();
|
||||||
void draw_cursor(int screen_column, int screen_row);
|
void draw_cursor(int screen_column, int screen_row, bool insert_mode);
|
||||||
void draw_crosshair(int screen_column, int screen_row);
|
void draw_crosshair(int screen_column, int screen_row);
|
||||||
void colrow_to_xy(int col, int row, int * x, int * y);
|
void colrow_to_xy(int col, int row, int * x, int * y);
|
||||||
void handle_event(SDL_Event & event);
|
void handle_event(SDL_Event & event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user