WAGE: Started screen composing

This commit is contained in:
Eugene Sandulenko 2016-04-15 10:08:33 +02:00
parent 0e4c846a39
commit 6a415da6b9
3 changed files with 20 additions and 10 deletions

View File

@ -284,13 +284,19 @@ void Gui::drawScene() {
MacWindow *w = _wm.getWindow(_sceneWindowId);
w->setDimensions(*_scene->_designBounds);
_scene->paint(w->getSurface(), 0, 0);
w->draw(&_screen);
g_system->copyRectToScreen(_screen.getBasePtr(_scene->_designBounds->left, _scene->_designBounds->top),
_screen.pitch, _scene->_designBounds->left, _scene->_designBounds->top,
_scene->_designBounds->width(), _scene->_designBounds->height());
_sceneDirty = true;
_consoleDirty = true;
_menuDirty = true;
_consoleFullRedraw = true;
_scene->paint(&_screen, _scene->_designBounds->left, _scene->_designBounds->top);
//_scene->paint(&_screen, _scene->_designBounds->left, _scene->_designBounds->top);
_sceneArea.left = _scene->_designBounds->left + kBorderWidth - 2;
_sceneArea.top = _scene->_designBounds->top + kBorderWidth - 2;
@ -302,7 +308,7 @@ void Gui::drawScene() {
_consoleTextArea.setWidth(_scene->_textBounds->width() - 2 * kBorderWidth);
_consoleTextArea.setHeight(_scene->_textBounds->height() - 2 * kBorderWidth);
paintBorder(&_screen, _sceneArea, kWindowScene);
//paintBorder(&_screen, _sceneArea, kWindowScene);
}
// Render console

View File

@ -80,29 +80,32 @@ void MacWindow::resize(int w, int h) {
_surface.free();
_surface.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
_borderSurface.free();
_borderSurface.create(w + 2 * kBorderWidth, h + 2 * kBorderWidth, Graphics::PixelFormat::createFormatCLUT8());
_borderSurface.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
_composeSurface.free();
_composeSurface.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
_dims.setWidth(w);
_dims.setHeight(h);
_borderDims.setWidth(w + 2 * kBorderWidth);
_borderDims.setHeight(h + 2 * kBorderWidth);
move(_dims.left, _dims.top); // Update _borderDims position
}
void MacWindow::move(int x, int y) {
_dims.moveTo(x, y);
_borderDims.moveTo(x - kBorderWidth, y - kBorderWidth);
}
void MacWindow::setDimensions(const Common::Rect &r) {
resize(r.width(), r.height());
move(r.left, r.top);
_dims.moveTo(r.left, r.top);
}
void MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
if (_borderIsDirty || forceRedraw)
drawBorder();
// Compose
_composeSurface.blitFrom(_surface, _surface.getBounds(), Common::Point(0, 0));
_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left, _dims.top), kColorGreen2);
}
const Graphics::Font *MacWindow::getTitleFont() {
@ -145,6 +148,7 @@ void MacWindow::drawBorder() {
Graphics::ManagedSurface *g = &_borderSurface;
g->clear(kColorGreen2);
g->fillRect(Common::Rect(kBorderWidth, kBorderWidth, width - kBorderWidth, height - kBorderWidth), kColorGreen);
drawBox(g, x, y, size, size);
drawBox(g, x + width - size - 1, y, size, size);

View File

@ -92,6 +92,7 @@ private:
private:
Graphics::ManagedSurface _surface;
Graphics::ManagedSurface _borderSurface;
Graphics::ManagedSurface _composeSurface;
bool _scrollable;
bool _active;
bool _borderIsDirty;
@ -100,7 +101,6 @@ private:
float _scrollPos, _scrollSize;
Common::Rect _dims;
Common::Rect _borderDims;
Common::String _title;
};