Implement proper console color handling.
Don't draw over the screen title. Oddly the menu doesn't seem to clear the screen. Looks much better now: http://revolf.free.fr/beos/shots/shot_haiku_loader_amiga_m68k_003.png git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39076 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -29,9 +29,28 @@ class ConsoleHandle : public CharHandle {
|
|||||||
uint16 fPen;
|
uint16 fPen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const uint16 kPalette[] = {
|
||||||
|
0x000,
|
||||||
|
0x00a,
|
||||||
|
0x0a0,
|
||||||
|
0x0aa,
|
||||||
|
0xa00,
|
||||||
|
0xa0a,
|
||||||
|
0xa50,
|
||||||
|
0xaaa,
|
||||||
|
0x555,
|
||||||
|
0x55f,
|
||||||
|
0x5f5,
|
||||||
|
0x5ff,
|
||||||
|
0xf55,
|
||||||
|
0xf5f,
|
||||||
|
0xff5,
|
||||||
|
0xfff
|
||||||
|
};
|
||||||
|
|
||||||
static Screen *sScreen;
|
static Screen *sScreen;
|
||||||
static int16 sFontWidth, sFontHeight;
|
static int16 sFontWidth, sFontHeight;
|
||||||
|
static int sScreenTopOffset = 16;
|
||||||
int16 ConsoleHandle::fX = 0;
|
int16 ConsoleHandle::fX = 0;
|
||||||
int16 ConsoleHandle::fY = 0;
|
int16 ConsoleHandle::fY = 0;
|
||||||
|
|
||||||
@@ -102,10 +121,10 @@ console_init(void)
|
|||||||
static NewScreen newScreen = {
|
static NewScreen newScreen = {
|
||||||
0, 0,
|
0, 0,
|
||||||
640, -1,
|
640, -1,
|
||||||
2,
|
4,
|
||||||
0, 1,
|
BLACK, WHITE,
|
||||||
0x8000,
|
0x8000,
|
||||||
0x1,
|
0x11,
|
||||||
NULL,
|
NULL,
|
||||||
"Haiku Loader",
|
"Haiku Loader",
|
||||||
NULL,
|
NULL,
|
||||||
@@ -116,10 +135,10 @@ console_init(void)
|
|||||||
if (sScreen == NULL)
|
if (sScreen == NULL)
|
||||||
panic("OpenScreen()\n");
|
panic("OpenScreen()\n");
|
||||||
|
|
||||||
static const uint16 palette[] = {0xbb9, 0x0, 0xfff, 0x0f0};
|
LoadRGB4(&sScreen->ViewPort, kPalette, 16);
|
||||||
LoadRGB4(&sScreen->ViewPort, palette, 4);
|
|
||||||
|
SetDrMd(&sScreen->RastPort, JAM2);
|
||||||
|
|
||||||
SetDrMd(&sScreen->RastPort, 0);
|
|
||||||
// seems not necessary, there is a default font already set.
|
// seems not necessary, there is a default font already set.
|
||||||
/*
|
/*
|
||||||
TextAttr attrs = { "Topaz", 8, 0, 0};
|
TextAttr attrs = { "Topaz", 8, 0, 0};
|
||||||
@@ -131,10 +150,34 @@ console_init(void)
|
|||||||
sFontHeight = sScreen->Font->ta_YSize;
|
sFontHeight = sScreen->Font->ta_YSize;
|
||||||
sFontWidth = font->tf_XSize;
|
sFontWidth = font->tf_XSize;
|
||||||
|
|
||||||
ClearScreen(&sScreen->RastPort);
|
sScreenTopOffset = sScreen->BarHeight * 2; // ???
|
||||||
|
|
||||||
|
|
||||||
|
//ClearScreen(&sScreen->RastPort);
|
||||||
|
|
||||||
dbgerr = stdout = stderr = (FILE *)&sOutput;
|
dbgerr = stdout = stderr = (FILE *)&sOutput;
|
||||||
|
|
||||||
|
console_set_cursor(0, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
dprintf("LeftEdge %d\n", sScreen->LeftEdge);
|
||||||
|
dprintf("TopEdge %d\n", sScreen->TopEdge);
|
||||||
|
dprintf("Width %d\n", sScreen->Width);
|
||||||
|
dprintf("Height %d\n", sScreen->Height);
|
||||||
|
dprintf("MouseX %d\n", sScreen->MouseX);
|
||||||
|
dprintf("MouseY %d\n", sScreen->MouseY);
|
||||||
|
dprintf("Flags 0x%08x\n", sScreen->Flags);
|
||||||
|
dprintf("BarHeight %d\n", sScreen->BarHeight);
|
||||||
|
dprintf("BarVBorder %d\n", sScreen->BarVBorder);
|
||||||
|
dprintf("BarHBorder %d\n", sScreen->BarHBorder);
|
||||||
|
dprintf("MenuVBorder %d\n", sScreen->MenuVBorder);
|
||||||
|
dprintf("MenuHBorder %d\n", sScreen->MenuHBorder);
|
||||||
|
dprintf("WBorTop %d\n", sScreen->WBorTop);
|
||||||
|
dprintf("WBorLeft %d\n", sScreen->WBorLeft);
|
||||||
|
dprintf("WBorRight %d\n", sScreen->WBorRight);
|
||||||
|
dprintf("WBorBottom %d\n", sScreen->WBorBottom);
|
||||||
|
*/
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +195,7 @@ console_clear_screen(void)
|
|||||||
int32
|
int32
|
||||||
console_width(void)
|
console_width(void)
|
||||||
{
|
{
|
||||||
int columnCount = 80; //XXX: check video mode
|
int columnCount = sScreen->Width / sFontWidth;
|
||||||
return columnCount;
|
return columnCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +203,7 @@ console_width(void)
|
|||||||
int32
|
int32
|
||||||
console_height(void)
|
console_height(void)
|
||||||
{
|
{
|
||||||
int lineCount = 25; //XXX: check video mode
|
int lineCount = (sScreen->Height - sScreenTopOffset) / sFontHeight;
|
||||||
return lineCount;
|
return lineCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +211,9 @@ console_height(void)
|
|||||||
void
|
void
|
||||||
console_set_cursor(int32 x, int32 y)
|
console_set_cursor(int32 x, int32 y)
|
||||||
{
|
{
|
||||||
Move(&sScreen->RastPort, sFontWidth * x, sFontHeight * y);
|
Move(&sScreen->RastPort, sFontWidth * x,
|
||||||
|
sFontHeight * y + sScreenTopOffset);
|
||||||
|
// why do I have to add this to keep the title ?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +221,8 @@ console_set_cursor(int32 x, int32 y)
|
|||||||
void
|
void
|
||||||
console_set_color(int32 foreground, int32 background)
|
console_set_color(int32 foreground, int32 background)
|
||||||
{
|
{
|
||||||
//TODO
|
SetAPen(&sScreen->RastPort, foreground);
|
||||||
|
SetBPen(&sScreen->RastPort, background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1229,6 +1229,14 @@ extern struct GfxBase *GRAPHICS_BASE_NAME;
|
|||||||
LP3NR(0xf0, Move, struct RastPort *, par1, a1, long, par2, d0, long, last, d1, \
|
LP3NR(0xf0, Move, struct RastPort *, par1, a1, long, par2, d0, long, last, d1, \
|
||||||
, GRAPHICS_BASE_NAME)
|
, GRAPHICS_BASE_NAME)
|
||||||
|
|
||||||
|
#define SetAPen(par1, last) \
|
||||||
|
LP2NR(0x156, SetAPen, struct RastPort *, par1, a1, unsigned long, last, d0, \
|
||||||
|
, GRAPHICS_BASE_NAME)
|
||||||
|
|
||||||
|
#define SetBPen(par1, last) \
|
||||||
|
LP2NR(0x15c, SetBPen, struct RastPort *, par1, a1, unsigned long, last, d0, \
|
||||||
|
, GRAPHICS_BASE_NAME)
|
||||||
|
|
||||||
#define SetDrMd(par1, last) \
|
#define SetDrMd(par1, last) \
|
||||||
LP2NR(0x162, SetDrMd, struct RastPort *, par1, a1, unsigned long, last, d0, \
|
LP2NR(0x162, SetDrMd, struct RastPort *, par1, a1, unsigned long, last, d0, \
|
||||||
, GRAPHICS_BASE_NAME)
|
, GRAPHICS_BASE_NAME)
|
||||||
@@ -1236,6 +1244,10 @@ extern struct GfxBase *GRAPHICS_BASE_NAME;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* drawing modes */
|
||||||
|
#define JAM1 0 // only draw foreground
|
||||||
|
#define JAM2 1 // draw both fg & bg
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user