Small changes, but in particular wcolor_set to handle > 256 color pairs.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
c198c24a22
commit
e7ddcd6b82
3 changed files with 12 additions and 12 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
enum Colors {
|
||||
enum Color {
|
||||
BLACK,
|
||||
DEEP_RED,
|
||||
DARK_BLUE,
|
||||
|
@ -31,9 +31,9 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
#define SETFRAMECOLOR(c, r, g, b) init_color(firstColor + Colors::c, scaleRGB(r), scaleRGB(g), scaleRGB(b));
|
||||
#define SETFRAMECOLOR(c, r, g, b) init_color(firstColor + Color::c, scaleRGB(r), scaleRGB(g), scaleRGB(b));
|
||||
|
||||
GRColors::GRColors(const int firstColor, const int firstPair)
|
||||
GraphicsColors::GraphicsColors(const int firstColor, const int firstPair)
|
||||
: myFirstPair(firstPair)
|
||||
{
|
||||
has_colors();
|
||||
|
@ -63,7 +63,7 @@ GRColors::GRColors(const int firstColor, const int firstPair)
|
|||
for (size_t i = 0; i < 16; ++i)
|
||||
{
|
||||
const int bg = firstColor + i;
|
||||
for (size_t j = BLACK; j < 16; ++j)
|
||||
for (size_t j = 0; j < 16; ++j)
|
||||
{
|
||||
const int fg = firstColor + j;
|
||||
const int pair = myFirstPair + i * 16 + j;
|
||||
|
@ -73,7 +73,7 @@ GRColors::GRColors(const int firstColor, const int firstPair)
|
|||
}
|
||||
}
|
||||
|
||||
int GRColors::getPair(int color) const
|
||||
int GraphicsColors::getPair(int color) const
|
||||
{
|
||||
const int bg = color & 0x0f;
|
||||
const int fg = color >> 4;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
class GRColors
|
||||
class GraphicsColors
|
||||
{
|
||||
public:
|
||||
GRColors(const int firstColor, const int firstPair);
|
||||
GraphicsColors(const int firstColor, const int firstPair);
|
||||
|
||||
int getPair(int color) const;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace
|
|||
{
|
||||
|
||||
std::shared_ptr<Frame> frame;
|
||||
std::shared_ptr<GRColors> grColors;
|
||||
std::shared_ptr<GraphicsColors> colors;
|
||||
|
||||
int g_nTrackDrive1 = -1;
|
||||
int g_nTrackDrive2 = -1;
|
||||
|
@ -191,11 +191,11 @@ bool UpdateLoResCell (int x, int y, int xpixel, int ypixel, int offset)
|
|||
{
|
||||
BYTE val = *(g_pTextBank0+offset);
|
||||
|
||||
const int pair = grColors->getPair(val);
|
||||
const int pair = colors->getPair(val);
|
||||
|
||||
WINDOW * win = frame->getWindow();
|
||||
|
||||
wattron(win, COLOR_PAIR(pair));
|
||||
wcolor_set(win, pair, NULL);
|
||||
if (frame->getColumns() == 40)
|
||||
{
|
||||
mvwaddstr(win, 1 + y, 1 + x, "\u2580");
|
||||
|
@ -204,7 +204,7 @@ bool UpdateLoResCell (int x, int y, int xpixel, int ypixel, int offset)
|
|||
{
|
||||
mvwaddstr(win, 1 + y, 1 + 2 * x, "\u2580\u2580");
|
||||
}
|
||||
wattroff(win, COLOR_PAIR(pair));
|
||||
wcolor_set(win, 0, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ void VideoInitialize()
|
|||
setlocale(LC_ALL, "");
|
||||
initscr();
|
||||
|
||||
grColors.reset(new GRColors(20, 20));
|
||||
colors.reset(new GraphicsColors(20, 20));
|
||||
|
||||
curs_set(0);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue