From bc1e884988fa1b3ee802f607511ddf16f6a7a562 Mon Sep 17 00:00:00 2001 From: Greg King Date: Mon, 8 Jun 2020 16:39:11 -0400 Subject: [PATCH] Documented how the TGI API shows when a palette has 256 colors. --- doc/tgi.sgml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/tgi.sgml b/doc/tgi.sgml index c5878622e..73a0f3bbd 100644 --- a/doc/tgi.sgml +++ b/doc/tgi.sgml @@ -241,14 +241,34 @@ color = tgi_getcolor(); / + if (tgi_getcolorcount() == 2) { printf("Only monochrome graphics is supported\n"); } + +static unsigned char num_colors; +static unsigned char color; +... +num_colors = tgi_getcolorcount(); +... +++color; +if (num_colors == 0) { + tgi_setcolor(color); +} else { + tgi_setcolor(color % num_colors); +}