mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 19:32:11 +00:00
WAGE: Further work on border drawing
This commit is contained in:
parent
069735d0b7
commit
cd063ec0e8
@ -63,7 +63,25 @@ void Gui::drawBox(Graphics::Surface *g, int x, int y, int w, int h) {
|
|||||||
g->frameRect(r, kColorBlack);
|
g->frameRect(r, kColorBlack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::paintBorder(Graphics::Surface *g, int x, int y, int width, int height) {
|
void Gui::fillRect(Graphics::Surface *g, int x, int y, int w, int h) {
|
||||||
|
Common::Rect r(x, y, x + w + 1, y + h + 1);
|
||||||
|
|
||||||
|
g->fillRect(r, kColorBlack);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ARROW_W 12
|
||||||
|
#define ARROW_H 6
|
||||||
|
const int arrowPixels[ARROW_H][ARROW_W] = {
|
||||||
|
{0,0,0,0,0,1,1,0,0,0,0,0},
|
||||||
|
{0,0,0,0,1,1,1,1,0,0,0,0},
|
||||||
|
{0,0,0,1,1,1,1,1,1,0,0,0},
|
||||||
|
{0,0,1,1,1,1,1,1,1,1,0,0},
|
||||||
|
{0,1,1,1,1,1,1,1,1,1,1,0},
|
||||||
|
{1,1,1,1,1,1,1,1,1,1,1,1}};
|
||||||
|
|
||||||
|
|
||||||
|
void Gui::paintBorder(Graphics::Surface *g, int x, int y, int width, int height,
|
||||||
|
bool active, bool scrollable, bool closeable, bool closeBoxPressed) {
|
||||||
int size = 17;
|
int size = 17;
|
||||||
drawBox(g, x, y, size, size);
|
drawBox(g, x, y, size, size);
|
||||||
drawBox(g, x+width-size-1, y, size, size);
|
drawBox(g, x+width-size-1, y, size, size);
|
||||||
@ -74,52 +92,42 @@ void Gui::paintBorder(Graphics::Surface *g, int x, int y, int width, int height)
|
|||||||
drawBox(g, x + 2, y + size, size - 4, height - 2*size - 1);
|
drawBox(g, x + 2, y + size, size - 4, height - 2*size - 1);
|
||||||
drawBox(g, x + width - size + 1, y + size, size - 4, height - 2*size-1);
|
drawBox(g, x + width - size + 1, y + size, size - 4, height - 2*size-1);
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (active) {
|
if (active) {
|
||||||
g.setColor(Color.BLACK);
|
fillRect(g, x + size, y + 5, width - 2*size - 1, 8);
|
||||||
g.fillRect(x + size, y + 5, width - 2*size - 1, 8);
|
fillRect(g, x + size, y + height - 13, width - 2*size - 1, 8);
|
||||||
g.fillRect(x + size, y + height - 13, width - 2*size - 1, 8);
|
fillRect(g, x + 5, y + size, 8, height - 2*size - 1);
|
||||||
g.fillRect(x + 5, y + size, 8, height - 2*size - 1);
|
|
||||||
if (!scrollable) {
|
if (!scrollable) {
|
||||||
g.fillRect(x + width - 13, y + size, 8, height - 2*size - 1);
|
fillRect(g, x + width - 13, y + size, 8, height - 2*size - 1);
|
||||||
} else {
|
} else {
|
||||||
int pixels[][] = new int[][] {
|
|
||||||
{0,0,0,0,0,1,1,0,0,0,0,0},
|
|
||||||
{0,0,0,0,1,1,1,1,0,0,0,0},
|
|
||||||
{0,0,0,1,1,1,1,1,1,0,0,0},
|
|
||||||
{0,0,1,1,1,1,1,1,1,1,0,0},
|
|
||||||
{0,1,1,1,1,1,1,1,1,1,1,0},
|
|
||||||
{1,1,1,1,1,1,1,1,1,1,1,1}};
|
|
||||||
final int h = pixels.length;
|
|
||||||
final int w = pixels[0].length;
|
|
||||||
int x1 = x + width - 15;
|
int x1 = x + width - 15;
|
||||||
int y1 = y + size + 1;
|
int y1 = y + size + 1;
|
||||||
for (int yy = 0; yy < h; yy++) {
|
for (int yy = 0; yy < ARROW_H; yy++) {
|
||||||
for (int xx = 0; xx < w; xx++) {
|
for (int xx = 0; xx < ARROW_W; xx++) {
|
||||||
if (pixels[yy][xx] != 0) {
|
if (arrowPixels[yy][xx] != 0) {
|
||||||
g.drawRect(x1+xx, y1+yy, 0, 0);
|
g->hLine(x1+xx, y1+yy, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g.fillRect(x + width - 13, y + size + h, 8, height - 2*size - 1 - h*2);
|
fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2*size - 1 - ARROW_H*2);
|
||||||
y1 += height - 2*size - h - 2;
|
y1 += height - 2*size - ARROW_H - 2;
|
||||||
for (int yy = 0; yy < h; yy++) {
|
for (int yy = 0; yy < ARROW_H; yy++) {
|
||||||
for (int xx = 0; xx < w; xx++) {
|
for (int xx = 0; xx < ARROW_W; xx++) {
|
||||||
if (pixels[h-yy-1][xx] != 0) {
|
if (arrowPixels[ARROW_H-yy-1][xx] != 0) {
|
||||||
g.drawRect(x1+xx, y1+yy, 0, 0);
|
g->hLine(x1+xx, y1+yy, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (closeable) {
|
if (closeable) {
|
||||||
if (closeBoxPressed) {
|
if (closeBoxPressed) {
|
||||||
g.fillRect(x + 6, y + 6, 6, 6);
|
fillRect(g, x + 6, y + 6, 6, 6);
|
||||||
} else {
|
} else {
|
||||||
drawBox(g, x + 5, y + 5, 7, 7);
|
drawBox(g, x + 5, y + 5, 7, 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
// TODO: This "Chicago" is not faithful to the original one on the Mac.
|
// TODO: This "Chicago" is not faithful to the original one on the Mac.
|
||||||
Font f = new Font("Chicago", Font.BOLD, 12);
|
Font f = new Font("Chicago", Font.BOLD, 12);
|
||||||
|
@ -58,10 +58,12 @@ public:
|
|||||||
Gui();
|
Gui();
|
||||||
~Gui();
|
~Gui();
|
||||||
|
|
||||||
void paintBorder(Graphics::Surface *g, int x, int y, int width, int height);
|
void paintBorder(Graphics::Surface *g, int x, int y, int width, int height,
|
||||||
|
bool active, bool scrollable, bool closeable, bool closeBoxPressed);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawBox(Graphics::Surface *g, int x, int y, int w, int h);
|
void drawBox(Graphics::Surface *g, int x, int y, int w, int h);
|
||||||
|
void fillRect(Graphics::Surface *g, int x, int y, int w, int h);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +128,8 @@ Common::Error WageEngine::run() {
|
|||||||
Scene *scene = _world->_orderedScenes[1];
|
Scene *scene = _world->_orderedScenes[1];
|
||||||
|
|
||||||
scene->paint(&screen);
|
scene->paint(&screen);
|
||||||
_gui->paintBorder(&screen, 0, 0, scene->_design->getBounds()->width(), scene->_design->getBounds()->height());
|
_gui->paintBorder(&screen, 0, 0, scene->_design->getBounds()->width(), scene->_design->getBounds()->height(),
|
||||||
|
true, false, true, false);
|
||||||
|
|
||||||
g_system->copyRectToScreen(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h);
|
g_system->copyRectToScreen(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user