added (currently completly useless) launcher dialog

svn-id: r5024
This commit is contained in:
Max Horn 2002-09-27 23:27:14 +00:00
parent e674b9e2e2
commit 6024c80f14
8 changed files with 133 additions and 14 deletions

View File

@ -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 \

View File

@ -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;

View File

@ -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,},

View File

@ -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);

View File

@ -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;

73
gui/launcher.cpp Normal file
View File

@ -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);
}
}

37
gui/launcher.h Normal file
View File

@ -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

View File

@ -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);