- adds the new gui renderer also a new implementation for the classic gui

- adds a ImageMan and ImageDec class for loading and managing image files
 - adds a loader for zip files which is used by the new theme and the image manager
 - changes the widgets to use the new gui code
 - changes the scumm dialogs to use the new gui code
 - fixes a #include problem in the sky debugger with the new gui code

 To use the new gui copy gui/themes/default-theme.zip to your extrapath.
If the theme zip can not be found the gui will fallback to the classic theme.
If you want to change the gui styles use "gui_theme=classic" for the classic theme
and "gui_theme=default-theme" for the new theme.

Thanks to eriktorbjorn for testing and help with the new theme and to sev for
reviewing this patch.

svn-id: r20227
This commit is contained in:
Johannes Schickel 2006-01-27 15:43:23 +00:00
parent 901645cb0f
commit 5051b080a2
32 changed files with 3868 additions and 627 deletions

View file

@ -114,10 +114,7 @@ void ConsoleDialog::slideUpAndClose() {
}
void ConsoleDialog::open() {
// This dialog will be redrawn a lot, so we store a copy of the blended
// background in a separate "canvas", just like in the About dialog.
_canvas.pixels = NULL;
// TODO: find a new way to do this
// Initiate sliding the console down. We do a very simple trick to achieve
// this effect: we simply move the console dialog just above (outside) the
// visible screen area, then shift it down in handleTickle() over a
@ -135,36 +132,16 @@ void ConsoleDialog::open() {
}
void ConsoleDialog::close() {
free(_canvas.pixels);
Dialog::close();
}
void ConsoleDialog::drawDialog() {
if (!_canvas.pixels) {
// Blend over the background. Don't count the time used for
// this when timing the slide action.
uint32 now = g_system->getMillis();
uint32 delta;
g_gui.blendRect(0, 0, _w, _h, g_gui._bgcolor, 2);
g_gui.copyToSurface(&_canvas, 0, 0, _w, _h);
delta = g_system->getMillis() - now;
if (_slideTime)
_slideTime += delta;
}
g_gui.drawSurface(_canvas, 0, 0);
// Draw a border
g_gui.hLine(_x, _y + _h - 1, _x + _w - 1, g_gui._color);
// Draw text
int start = _scrollLine - _linesPerPage + 1;
int y = _y + 2;
g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x+_w, _y+_h));
for (int line = 0; line < _linesPerPage; line++) {
int x = _x + 1;
for (int column = 0; column < _lineWidth; column++) {
@ -174,7 +151,7 @@ void ConsoleDialog::drawDialog() {
#else
byte c = buffer((start + line) * _lineWidth + column);
#endif
g_gui.drawChar(c, x, y, g_gui._textcolor, _font);
g_gui.theme()->drawChar(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), c, _font);
x += kConsoleCharWidth;
}
y += kConsoleLineHeight;
@ -182,21 +159,14 @@ void ConsoleDialog::drawDialog() {
// Draw the scrollbar
_scrollBar->draw();
// Finally blit it all to the screen
g_gui.addDirtyRect(_x, _y, _w, _h);
}
void ConsoleDialog::handleScreenChanged() {
free(_canvas.pixels);
_canvas.pixels = NULL;
Dialog::handleScreenChanged();
draw();
}
void ConsoleDialog::handleTickle() {
if (!_canvas.pixels)
return;
uint32 time = g_system->getMillis();
if (_caretTime < time) {
_caretTime = time + kCaretBlinkTime;
@ -219,7 +189,7 @@ void ConsoleDialog::handleTickle() {
draw();
} else if (_slideMode == kUpSlideMode && _y <= -_h) {
// End the slide
_slideMode = kNoSlideMode;
//_slideMode = kNoSlideMode;
close();
} else
draw();
@ -614,6 +584,7 @@ void ConsoleDialog::print(const char *str) {
}
void ConsoleDialog::drawCaret(bool erase) {
// TODO: use code from EditableWidget::drawCaret here
int line = _currentPos / _lineWidth;
int displayLine = line - _scrollLine + _linesPerPage - 1;
@ -626,17 +597,8 @@ void ConsoleDialog::drawCaret(bool erase) {
int x = _x + 1 + (_currentPos % _lineWidth) * kConsoleCharWidth;
int y = _y + displayLine * kConsoleLineHeight;
char c = buffer(_currentPos);
if (erase) {
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._bgcolor);
g_gui.drawChar(c, x, y + 2, g_gui._textcolor, _font);
} else {
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._textcolor);
g_gui.drawChar(c, x, y + 2, g_gui._bgcolor, _font);
}
g_gui.addDirtyRect(x, y, kConsoleCharWidth, kConsoleLineHeight);
_caretVisible = !erase;
g_gui.theme()->drawCaret(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), erase);
}
void ConsoleDialog::scrollToCurrent() {