diff options
author | Enne Walker <enne.walker@gmail.com> | 2010-05-29 11:09:17 -0400 |
---|---|---|
committer | Enne Walker <enne.walker@gmail.com> | 2010-05-30 08:50:37 -0400 |
commit | 575cfb8db1e87084ae13b9799f74a3b6be75c0c8 (patch) | |
tree | 1274dea0786f6d943de3a7ec360fc6ec1193e25f /crawl-ref/source/libw32c.cc | |
parent | 7e9196891f4283c40a8db3947f6db8a853724c44 (diff) | |
download | crawl-ref-575cfb8db1e87084ae13b9799f74a3b6be75c0c8.tar.gz crawl-ref-575cfb8db1e87084ae13b9799f74a3b6be75c0c8.zip |
Refactor crawl view buffer.
Rather than using explicit offsets (e.g. buffy[0] and buffy[1]), store
colour, glyph, and tiles for each cell in the view buffer in a struct
with named members. This refactoring will also theoretically allow for
the tiles version to display glyphs instead of tiles.
Diffstat (limited to 'crawl-ref/source/libw32c.cc')
-rw-r--r-- | crawl-ref/source/libw32c.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc index 1431ea7bb7..5bdc5b4fc9 100644 --- a/crawl-ref/source/libw32c.cc +++ b/crawl-ref/source/libw32c.cc @@ -916,16 +916,18 @@ int get_console_string(char *buf, int maxlen) return (int)nread; } -void puttext(int x1, int y1, int x2, int y2, const screen_buffer_t *buf) +void puttext(int x1, int y1, const crawl_view_buffer &vbuf) { - for (int y = y1; y <= y2; ++y) + const screen_cell_t *cell = vbuf; + const coord_def size = vbuf.size(); + for (int y = 1; y <= size.y; ++y) { cgotoxy(x1, y); - for (int x = x1; x <= x2; x++) + for (int x = 1; x <= size.x; ++x) { - textattr( buf[1] ); - putwch( *buf ); - buf += 2; + textattr(cell->colour); + putwch(cell->glyph); + cell++; } } update_screen(); |