summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libunix.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-27 15:59:10 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-27 15:59:10 +0000
commiteb7baf83704e5ffa3d0059e8db34b3c3508b2428 (patch)
treebf46bfe4012e9d369c1a4f915e4037c417598ba1 /crawl-ref/source/libunix.cc
parent64c0b7fe918fdc3bc41483b17f6796d3273ac05a (diff)
downloadcrawl-ref-eb7baf83704e5ffa3d0059e8db34b3c3508b2428.tar.gz
crawl-ref-eb7baf83704e5ffa3d0059e8db34b3c3508b2428.zip
Minor view code cleanup; this ought to fix the DOS redraw issues as well.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2629 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libunix.cc')
-rw-r--r--crawl-ref/source/libunix.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc
index 1f8f1d67f9..c4a64a779e 100644
--- a/crawl-ref/source/libunix.cc
+++ b/crawl-ref/source/libunix.cc
@@ -593,6 +593,44 @@ int window(int x1, int y1, int x2, int y2)
return (refresh());
}
+// NOTE: This affects libunix.cc draw state; use this just before setting
+// textcolour and drawing a character and call set_altcharset(false)
+// after you're done drawing.
+//
+int cset_adjust(int raw)
+{
+ if (Options.char_set != CSET_ASCII && Options.char_set != CSET_UNICODE)
+ {
+ // switch to alternate char set for 8-bit characters:
+ set_altcharset( raw > 127 );
+
+ // shift the DEC line drawing set:
+ if (Options.char_set == CSET_DEC
+ && raw >= 0xE0)
+ {
+ raw &= 0x7F;
+ }
+ }
+ return (raw);
+}
+
+void puttext(int x1, int y1, int x2, int y2, const screen_buffer_t *buf)
+{
+ for (int y = y1; y <= y2; ++y)
+ {
+ gotoxy(x1, y);
+ for (int x = x1; x <= x2; ++x)
+ {
+ const screen_buffer_t ch = cset_adjust( *buf );
+ textattr( buf[1] );
+ putwch( ch );
+ buf += 2;
+ }
+ }
+ set_altcharset(false);
+ update_screen();
+}
+
// These next four are front functions so that we can reduce
// the amount of curses special code that occurs outside this
// this file. This is good, since there are some issues with