Fixed VGA color order, and clarified docs.

This commit is contained in:
Branimir Karadžić 2018-01-25 20:34:17 -08:00
parent 36b2ca1504
commit d04301dfda
6 changed files with 26 additions and 22 deletions

View File

@ -93,6 +93,9 @@ public:
);
bgfx::dbgTextPrintf(0, 1, 0x0f, "Color can be changed with ANSI \x1b[9;me\x1b[10;ms\x1b[11;mc\x1b[12;ma\x1b[13;mp\x1b[14;me\x1b[0m code too.");
bgfx::dbgTextPrintf(80, 1, 0x0f, "\x1b[;0m \x1b[;1m \x1b[; 2m \x1b[; 3m \x1b[; 4m \x1b[; 5m \x1b[; 6m \x1b[; 7m \x1b[0m");
bgfx::dbgTextPrintf(80, 2, 0x0f, "\x1b[;8m \x1b[;9m \x1b[;10m \x1b[;11m \x1b[;12m \x1b[;13m \x1b[;14m \x1b[;15m \x1b[0m");
const bgfx::Stats* stats = bgfx::getStats();
bgfx::dbgTextPrintf(0, 2, 0x0f, "Backbuffer %dW x %dH in pixels, debug text %dW x %dH in characters."
, stats->width

View File

@ -163,7 +163,7 @@ public:
// When instancing is not supported by GPU, implement alternative
// code path that doesn't use instancing.
bool blink = uint32_t(time*3.0f)&1;
bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " Instancing is not supported by GPU. ");
bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " Instancing is not supported by GPU. ");
}
else
{

View File

@ -387,7 +387,7 @@ public:
// When multiple render targets (MRT) is not supported by GPU,
// implement alternative code path that doesn't use MRT.
bool blink = uint32_t(time*3.0f)&1;
bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " MRT not supported by GPU. ");
bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " MRT not supported by GPU. ");
// Set view 0 default viewport.
bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) );

View File

@ -274,7 +274,7 @@ public:
else
{
bool blink = uint32_t(time*3.0f)&1;
bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " Multiple windows is not supported by `%s` renderer. ", bgfx::getRendererName(bgfx::getCaps()->rendererType) );
bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " Multiple windows is not supported by `%s` renderer. ", bgfx::getRendererName(bgfx::getCaps()->rendererType) );
}
uint32_t count = 0;

View File

@ -1941,7 +1941,7 @@ namespace bgfx
///
/// @param[in] _x, _y 2D position from top-left.
/// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom
/// 4-bits represent foreground color from standard VGA text palette.
/// 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
/// @param[in] _format `printf` style format.
///
/// @attention C99 equivalent is `bgfx_dbg_text_printf`.
@ -1958,7 +1958,7 @@ namespace bgfx
///
/// @param[in] _x, _y 2D position from top-left.
/// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom
/// 4-bits represent foreground color from standard VGA text palette.
/// 4-bits represent foreground color from standard VGA text palette (ANSI escape codes).
/// @param[in] _format `printf` style format.
/// @param[in] _argList additional arguments for format string
///

View File

@ -653,25 +653,26 @@ namespace bgfx
float m_v;
};
static uint32_t palette[16] =
static uint32_t palette[] =
{
0x0,
0xff0000cc,
0xff069a4e,
0xff00a0c4,
0xffa46534,
0xff7b5075,
0xff9a9806,
0xffcfd7d3,
0xff535755,
0xff2929ef,
0xff34e28a,
0xff4fe9fc,
0xffcf9f72,
0xffa87fad,
0xffe2e234,
0xffeceeee,
0x0, // Black
0xffa46534, // Blue
0xff069a4e, // Green
0xff9a9806, // Cyan
0xff0000cc, // Red
0xff7b5075, // Magenta
0xff00a0c4, // Brown
0xffcfd7d3, // Light Gray
0xff535755, // Dark Gray
0xffcf9f72, // Light Blue
0xff34e28a, // Light Green
0xffe2e234, // Light Cyan
0xff2929ef, // Light Red
0xffa87fad, // Light Magenta
0xff4fe9fc, // Yellow
0xffeceeee, // White
};
BX_STATIC_ASSERT(BX_COUNTOF(palette) == 16);
uint32_t yy = 0;
uint32_t xx = 0;