diff options
-rw-r--r-- | crawl-ref/source/tilereg.cc | 38 | ||||
-rw-r--r-- | crawl-ref/source/tilereg.h | 5 |
2 files changed, 24 insertions, 19 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 6d241280c5..95f99f1f7d 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -2097,13 +2097,13 @@ void TextRegion::cgotoxy(int x, int y) if (cursor_region != NULL && cursor_flag) { - cursor_region ->erase_cursor(); + cursor_x = -1; + cursor_y = -1; cursor_region = NULL; } if (cursor_flag) { - text_mode->draw_cursor(print_x, print_y); cursor_x = print_x; cursor_y = print_y; cursor_region = text_mode; @@ -2124,30 +2124,40 @@ void TextRegion::_setcursortype(int curstype) { cursor_flag = curstype; if (cursor_region != NULL) - cursor_region->erase_cursor(); + { + cursor_x = -1; + cursor_y = -1; + } if (curstype) { - text_mode->draw_cursor(print_x, print_y); cursor_x = print_x; cursor_y = print_y; cursor_region = text_mode; } } -void TextRegion::draw_cursor(int x, int y) +void TextRegion::render() { - // TODO enne -} + if (cursor_x > 0 && cursor_y > 0) + { + int idx = cursor_x + mx * cursor_y; -void TextRegion::erase_cursor() -{ - // TODO enne -} + unsigned char char_back = cbuf[idx]; + unsigned char col_back = abuf[idx]; -void TextRegion::render() -{ - m_font->render_textblock(sx + ox, sy + oy, cbuf, abuf, mx, my); + cbuf[idx] = '_'; + abuf[idx] = WHITE; + + m_font->render_textblock(sx + ox, sy + oy, cbuf, abuf, mx, my); + + cbuf[idx] = char_back; + abuf[idx] = col_back; + } + else + { + m_font->render_textblock(sx + ox, sy + oy, cbuf, abuf, mx, my); + } } void TextRegion::clear() diff --git a/crawl-ref/source/tilereg.h b/crawl-ref/source/tilereg.h index fbfe411318..e427877672 100644 --- a/crawl-ref/source/tilereg.h +++ b/crawl-ref/source/tilereg.h @@ -138,11 +138,6 @@ public: void adjust_region(int *x1, int *x2, int y); void scroll(); - //Sys dep - void draw_cursor(int x, int y, int width); - void draw_cursor(int x, int y); - void erase_cursor(); - protected: virtual void on_resize(); FTFont *m_font; |