diff options
author | Max Horn | 2002-09-27 23:27:14 +0000 |
---|---|---|
committer | Max Horn | 2002-09-27 23:27:14 +0000 |
commit | 6024c80f147ce275413332323c2de8db6095c82b (patch) | |
tree | 86d42eb89c5866fd6418c867503521cc43643ddb | |
parent | e674b9e2e23ef1aa21b0be7c682dd77ceb591223 (diff) | |
download | scummvm-rg350-6024c80f147ce275413332323c2de8db6095c82b.tar.gz scummvm-rg350-6024c80f147ce275413332323c2de8db6095c82b.tar.bz2 scummvm-rg350-6024c80f147ce275413332323c2de8db6095c82b.zip |
added (currently completly useless) launcher dialog
svn-id: r5024
-rw-r--r-- | Makefile.common | 2 | ||||
-rw-r--r-- | backends/sdl/sdl-common.cpp | 4 | ||||
-rw-r--r-- | common/gameDetector.cpp | 9 | ||||
-rw-r--r-- | common/gameDetector.h | 10 | ||||
-rw-r--r-- | common/main.cpp | 7 | ||||
-rw-r--r-- | gui/launcher.cpp | 73 | ||||
-rw-r--r-- | gui/launcher.h | 37 | ||||
-rw-r--r-- | scumm/dialogs.cpp | 5 |
8 files changed, 133 insertions, 14 deletions
diff --git a/Makefile.common b/Makefile.common index 758bfce9e5..7149e90da6 100644 --- a/Makefile.common +++ b/Makefile.common @@ -14,7 +14,7 @@ COMMON_OBJS = common/config-file.o common/engine.o common/file.o \ common/timer.o common/util.o GUI_OBJS = gui/gui.o gui/newgui.o gui/widget.o gui/dialog.o gui/ListWidget.o \ - gui/ScrollBarWidget.o gui/message.o + gui/ScrollBarWidget.o gui/message.o gui/launcher.o SCUMM_OBJS = scumm/actor.o scumm/akos.o scumm/boxes.o scumm/bundle.o \ scumm/costume.o scumm/debug.o scumm/debugrl.o scumm/gfx.o scumm/imuse.o \ diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp index 4808515490..45c25acdd0 100644 --- a/backends/sdl/sdl-common.cpp +++ b/backends/sdl/sdl-common.cpp @@ -70,7 +70,7 @@ void OSystem_SDL_Common::set_timer(int timer, int (*callback)(int)) { } OSystem_SDL_Common::OSystem_SDL_Common() - : sdl_screen(0), SCREEN_WIDTH(0), SCREEN_HEIGHT(0), + : sdl_screen(0), cdrom(0), SCREEN_WIDTH(0), SCREEN_HEIGHT(0), _dirty_checksums(0), _current_shake_pos(0), _new_shake_pos(0) { // allocate palette storage @@ -91,7 +91,7 @@ OSystem_SDL_Common::~OSystem_SDL_Common() void OSystem_SDL_Common::init_size(uint w, uint h) { // Avoid redundant res changes - if (w == SCREEN_WIDTH && h == SCREEN_HEIGHT) + if ((int)w == SCREEN_WIDTH && (int)h == SCREEN_HEIGHT) return; SCREEN_WIDTH = w; diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp index 5e402eee7a..11bbb2e390 100644 --- a/common/gameDetector.cpp +++ b/common/gameDetector.cpp @@ -336,18 +336,11 @@ bool GameDetector::parseMusicDriver(const char *s) { } -struct VersionSettings { - const char *filename; - const char *gamename; - byte id, major, middle, minor; - uint32 features; -}; - /* This is a list of all known SCUMM games. Commented games are not supported at this time */ -static const VersionSettings version_settings[] = { +const VersionSettings version_settings[] = { /* Scumm Version 1 */ // {"maniac", "Maniac Mansion (C64)", GID_MANIAC64, 1, 0, 0,}, // {"zak", "Zak McKracken and the Alien Mindbenders (C64)", GID_ZAK64, 1, 0, 0,}, diff --git a/common/gameDetector.h b/common/gameDetector.h index 6393440863..d628b45500 100644 --- a/common/gameDetector.h +++ b/common/gameDetector.h @@ -26,6 +26,16 @@ class OSystem; class MidiDriver; +struct VersionSettings { + const char *filename; + const char *gamename; + byte id, major, middle, minor; + uint32 features; +}; + +extern const VersionSettings version_settings[]; + + class GameDetector { public: int detectMain(int argc, char **argv); diff --git a/common/main.cpp b/common/main.cpp index 54e24564c9..207269500a 100644 --- a/common/main.cpp +++ b/common/main.cpp @@ -25,6 +25,7 @@ #include "gameDetector.h" #include "config-file.h" #include "gui/newgui.h" +#include "gui/launcher.h" #include "gui/message.h" GameDetector detector; @@ -186,10 +187,16 @@ int main(int argc, char *argv[]) system->set_palette(dummy_palette, 0, 16); +#if 1 + extern OSystem *g_system; + g_system = system; + Dialog *dlg = new LauncherDialog(g_gui); +#else const char *message = "This dialog is shown before the\n" "Engine obejct is even created.\n" "Wow! Ain't we cool?\n"; Dialog *dlg = new MessageDialog(g_gui, message); +#endif dlg->open(); g_gui->runLoop(); delete dlg; diff --git a/gui/launcher.cpp b/gui/launcher.cpp new file mode 100644 index 0000000000..b25afd6292 --- /dev/null +++ b/gui/launcher.cpp @@ -0,0 +1,73 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#include "stdafx.h" +#include "launcher.h" +#include "newgui.h" +#include "ListWidget.h" + +#include "common/engine.h" +#include "common/gameDetector.h" +#include "common/list.h" + +enum { + kOptionsCmd = 'QUIT', + kQuitCmd = 'QUIT' +}; + +LauncherDialog::LauncherDialog(NewGui *gui) + : Dialog(gui, 0, 0, 320, 200) +{ + // Add three buttons at the bottom + addButton(1*(_w - 54)/4, _h - 24, 54, 16, "Quit", kQuitCmd, 'Q'); + addButton(2*(_w - 54)/4, _h - 24, 54, 16, "Options", kOptionsCmd, 'O'); + addButton(3*(_w - 54)/4, _h - 24, 54, 16, "Run", kCloseCmd, 'R'); + + // Add list with game titles + ListWidget *w = new ListWidget(this, 10, 10, 300, 112); + w->setNumberingMode(kListNumberingOff); + + const VersionSettings *v = version_settings; + ScummVM::StringList l; + + while (v->filename && v->gamename) { + l.push_back(v->gamename); + v++; + } + + w->setList(l); + + // TODO - add an edit field with the path information; or maybe even a "file selector" ? +} + +void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) +{ + switch (cmd) { + case kListItemChangedCmd: + break; + case kListItemDoubleClickedCmd: + break; + case kQuitCmd: + g_system->quit(); + break; + default: + Dialog::handleCommand(sender, cmd, data); + } +} diff --git a/gui/launcher.h b/gui/launcher.h new file mode 100644 index 0000000000..c0afb9a406 --- /dev/null +++ b/gui/launcher.h @@ -0,0 +1,37 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#ifndef LAUNCHER_DIALOG_H +#define LAUNCHER_DIALOG_H + +#include "dialog.h" +#include "common/str.h" + +class LauncherDialog : public Dialog { + typedef ScummVM::String String; +public: + LauncherDialog(NewGui *gui); + + void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + +protected: +}; + +#endif diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index d1b681f891..34e0d3e54a 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -273,9 +273,8 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat case kOptionsCmd: _scumm->optionsDialog(); break; - case kQuitCmd: { - _scumm->_system->quit(); - } + case kQuitCmd: + _scumm->_system->quit(); break; default: Dialog::handleCommand(sender, cmd, data); |