[qwaq] Set up an application color palette

Nothing special, just all the combinations of the 8 colors
This commit is contained in:
Bill Currie 2020-03-26 09:01:39 +09:00
parent 3ea16c2764
commit 115541877a
3 changed files with 12 additions and 7 deletions

View file

@ -11,6 +11,8 @@
@class TextContext;
@class View;
extern int color_palette[64];
@interface QwaqApplication: Object
{
qwaq_event_t event;

View file

@ -10,6 +10,8 @@ int fence;
#include "qwaq-group.h"
#include "qwaq-view.h"
int color_palette[64];
static AutoreleasePool *autorelease_pool;
static void
arp_start (void)
@ -37,16 +39,16 @@ arp_end (void)
}
initialize ();
init_pair (1, COLOR_WHITE, COLOR_BLUE);
init_pair (2, COLOR_WHITE, COLOR_BLACK);
init_pair (3, COLOR_BLACK, COLOR_GREEN);
init_pair (4, COLOR_YELLOW, COLOR_RED);
for (int i = 1; i < 64; i++) {
init_pair (i, i & 0x7, i >> 3);
color_palette[i] = COLOR_PAIR (i);
}
screen = [TextContext screen];
screenSize = [screen size];
objects = [[Group alloc] initWithContext: screen owner: nil];
[screen bkgd: COLOR_PAIR (1)];
[screen bkgd: color_palette[047]];
[screen scrollok: 1];
[screen clear];
wrefresh (stdscr);//FIXME

View file

@ -1,5 +1,5 @@
#include <QF/keys.h>
#include "color.h"
#include "qwaq-app.h"
#include "qwaq-editor.h"
#include "qwaq-listener.h"
@ -37,7 +37,8 @@
int *lbuf = [linebuffer buffer];
for (int y = 0; y < ylen; y++) {
lind = [buffer formatLine:lind from:scroll.x into:lbuf width:xlen
highlight:selection colors: {COLOR_PAIR (1), COLOR_PAIR(2)}];
highlight:selection colors: {color_palette[047],
color_palette[007]}];
[textContext blitFromBuffer: linebuffer to: {xpos, ypos + y}
from: [linebuffer rect]];
}