Skip to content

Commit

Permalink
WAGE: Stub for console rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 30, 2015
1 parent a712a1d commit 141bddb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
26 changes: 24 additions & 2 deletions engines/wage/gui.cpp
Expand Up @@ -56,7 +56,8 @@ namespace Wage {
enum {
kMenuHeight = 19,
kMenuPadding = 6,
kMenuItemHeight = 19
kMenuItemHeight = 19,
kBorderWidth = 17
};

byte checkers[8] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa };
Expand Down Expand Up @@ -99,6 +100,10 @@ void Gui::draw() {

// Render console
int sceneW = _scene->_design->getBounds()->width();
int consoleW = _screen.w - sceneW - 2 * kBorderWidth;
int consoleH = _scene->_design->getBounds()->height() - 2 * kBorderWidth;

renderConsole(&_screen, sceneW + kBorderWidth, kMenuHeight + kBorderWidth, consoleW, consoleH);
paintBorder(&_screen, sceneW, kMenuHeight, _screen.w - sceneW, _scene->_design->getBounds()->height(),
true, true, true, false);

Expand Down Expand Up @@ -132,7 +137,7 @@ const int arrowPixels[ARROW_H][ARROW_W] = {

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;
const int size = kBorderWidth;
drawBox(g, x, y, size, size);
drawBox(g, x+width-size-1, y, size, size);
drawBox(g, x+width-size-1, y+height-size-1, size, size);
Expand Down Expand Up @@ -200,5 +205,22 @@ void Gui::paintBorder(Graphics::Surface *g, int x, int y, int width, int height,
#endif
}

void Gui::renderConsole(Graphics::Surface *g, int x, int y, int width, int height) {
bool fullRedraw = false;
Common::Rect fullR(0, 0, width, height);

if (_console.w != width || _console.h != height) {
_console.free();

_console.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
fullRedraw = true;
}

if (fullRedraw)
_console.fillRect(fullR, kColorWhite);

g->copyRectToSurface(_console, x, y, fullR);
}


} // End of namespace Wage
2 changes: 2 additions & 0 deletions engines/wage/gui.h
Expand Up @@ -66,11 +66,13 @@ class Gui {
void paintBorder(Graphics::Surface *g, int x, int y, int width, int height,
bool active, bool scrollable, bool closeable, bool closeBoxPressed);

void renderConsole(Graphics::Surface *g, int x, int y, int width, int height);
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);

private:
Graphics::Surface _screen;
Graphics::Surface _console;
Scene *_scene;
bool _sceneDirty;

Expand Down

0 comments on commit 141bddb

Please sign in to comment.