GRAPHICS: Include border loading code
This commit is contained in:
parent
98d0838df3
commit
6c89eaa1b8
2 changed files with 24 additions and 24 deletions
|
@ -64,7 +64,7 @@ BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
|
|||
}
|
||||
|
||||
MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) :
|
||||
BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) {
|
||||
BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable), _bmp(new TransparentSurface(), false) {
|
||||
_active = false;
|
||||
_borderIsDirty = true;
|
||||
|
||||
|
@ -78,6 +78,9 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac
|
|||
_draggedX = _draggedY = 0;
|
||||
|
||||
_type = kWindowWindow;
|
||||
|
||||
TransparentSurface *srf = new TransparentSurface;
|
||||
_bmp = NinePatchBitmap(srf, false);
|
||||
}
|
||||
|
||||
MacWindow::~MacWindow() {
|
||||
|
@ -142,18 +145,23 @@ bool MacWindow::draw(ManagedSurface *g, bool forceRedraw) {
|
|||
|
||||
_contentIsDirty = false;
|
||||
|
||||
TransparentSurface tr;
|
||||
_bmp->blit(tr, 0, 0, _borderSurface.w, _borderSurface.h);
|
||||
|
||||
|
||||
// Compose
|
||||
_composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
|
||||
_composeSurface.transBlitFrom(tr, kColorGreen);
|
||||
_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
|
||||
|
||||
g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MacWindow::drawTR(Surface &g, int x, int y, int w, int h, bool forceRedraw) {
|
||||
|
||||
_bmp.blit(g, x, y, w, h);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#define ARROW_W 12
|
||||
#define ARROW_H 6
|
||||
const int arrowPixels[ARROW_H][ARROW_W] = {
|
||||
|
@ -259,21 +267,7 @@ void MacWindow::drawBorder() {
|
|||
w = maxWidth;
|
||||
drawBox(g, x + (width - w) / 2, y, w, size);
|
||||
font->drawString(g, _title, x + (width - w) / 2 + 5, y + yOff, w, kColorBlack);
|
||||
}
|
||||
|
||||
initBorders(g);
|
||||
}
|
||||
|
||||
void MacWindow::initBorders(ManagedSurface *source) {
|
||||
TransparentSurface *tr = new TransparentSurface();
|
||||
tr->create(source->w, source->h, PixelFormat::createFormatCLUT8());
|
||||
|
||||
// Fill with alpha so that _check_pixel will go through
|
||||
tr->drawThickLine(0, tr->h / 2, tr->w, tr->h/2, 1, tr->h/2, Graphics::ALPHA_FULL);
|
||||
// Show that something can be drawn
|
||||
tr->drawLine(1, 1, tr->w - 2, tr->h - 2, kColorBlack);
|
||||
|
||||
_bmp = new NinePatchBitmap(tr, false);
|
||||
}
|
||||
}
|
||||
|
||||
void MacWindow::setHighlight(WindowClick highlightedPart) {
|
||||
|
@ -293,6 +287,10 @@ void MacWindow::setHighlight(WindowClick highlightedPart) {
|
|||
_borderIsDirty = true;
|
||||
}
|
||||
|
||||
void MacWindow::setBorders(TransparentSurface *source) {
|
||||
_bmp = NinePatchBitmap(source, true);
|
||||
}
|
||||
|
||||
|
||||
void MacWindow::drawBox(ManagedSurface *g, int x, int y, int w, int h) {
|
||||
Common::Rect r(x, y, x + w + 1, y + h + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue