2008-03-28 09:00:30 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* 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.
|
2014-02-18 01:34:21 +00:00
|
|
|
*
|
2008-03-28 09:00:30 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:21 +00:00
|
|
|
*
|
2008-03-28 09:00:30 +00:00
|
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KYRA_GUI_H
|
|
|
|
#define KYRA_GUI_H
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
#include "kyra/kyra_v1.h"
|
2008-12-26 11:04:45 +00:00
|
|
|
#include "kyra/screen.h"
|
2008-03-28 09:00:30 +00:00
|
|
|
|
|
|
|
#include "common/ptr.h"
|
2008-04-05 01:49:28 +00:00
|
|
|
#include "common/array.h"
|
2008-04-20 15:47:11 +00:00
|
|
|
#include "common/func.h"
|
2008-03-28 09:00:30 +00:00
|
|
|
|
2008-08-20 14:03:34 +00:00
|
|
|
#include "graphics/surface.h"
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
namespace Kyra {
|
|
|
|
|
2010-05-17 23:29:44 +00:00
|
|
|
#define BUTTON_FUNCTOR(type, x, y) Button::Callback(new Common::Functor1Mem<Button *, int, type>(x, y))
|
2008-03-28 09:00:30 +00:00
|
|
|
|
|
|
|
struct Button {
|
2010-05-17 23:29:44 +00:00
|
|
|
typedef Common::Functor1<Button *, int> CallbackFunctor;
|
2008-03-28 09:00:30 +00:00
|
|
|
typedef Common::SharedPtr<CallbackFunctor> Callback;
|
|
|
|
|
2011-12-11 00:57:03 +00:00
|
|
|
Button() : nextButton(0), index(0), keyCode(0), keyCode2(0), data0Val1(0), data1Val1(0), data2Val1(0), data3Val1(0), flags(0),
|
2009-10-04 17:54:08 +00:00
|
|
|
data0ShapePtr(0), data1ShapePtr(0), data2ShapePtr(0), data0Callback(), data1Callback(), data2Callback(),
|
|
|
|
dimTableIndex(0), x(0), y(0), width(0), height(0), data0Val2(0), data0Val3(0), data1Val2(0), data1Val3(0),
|
2011-09-29 20:51:36 +00:00
|
|
|
data2Val2(0), data2Val3(0), data3Val2(0), data3Val3(0), flags2(0), mouseWheel(0), buttonCallback(), extButtonDef(0), arg(0) {}
|
2009-05-22 23:22:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
Button *nextButton;
|
|
|
|
uint16 index;
|
|
|
|
|
2009-02-15 03:36:30 +00:00
|
|
|
uint16 keyCode;
|
|
|
|
uint16 keyCode2;
|
2008-03-28 09:00:30 +00:00
|
|
|
|
|
|
|
byte data0Val1;
|
|
|
|
byte data1Val1;
|
|
|
|
byte data2Val1;
|
2011-12-11 00:57:03 +00:00
|
|
|
byte data3Val1;
|
2008-03-28 09:00:30 +00:00
|
|
|
|
|
|
|
uint16 flags;
|
|
|
|
|
|
|
|
const uint8 *data0ShapePtr;
|
|
|
|
const uint8 *data1ShapePtr;
|
|
|
|
const uint8 *data2ShapePtr;
|
|
|
|
Callback data0Callback;
|
|
|
|
Callback data1Callback;
|
|
|
|
Callback data2Callback;
|
|
|
|
|
|
|
|
uint16 dimTableIndex;
|
|
|
|
|
|
|
|
int16 x, y;
|
|
|
|
uint16 width, height;
|
|
|
|
|
|
|
|
uint8 data0Val2;
|
|
|
|
uint8 data0Val3;
|
|
|
|
|
|
|
|
uint8 data1Val2;
|
|
|
|
uint8 data1Val3;
|
|
|
|
|
|
|
|
uint8 data2Val2;
|
|
|
|
uint8 data2Val3;
|
|
|
|
|
2011-12-11 00:57:03 +00:00
|
|
|
uint8 data3Val2;
|
|
|
|
uint8 data3Val3;
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
uint16 flags2;
|
|
|
|
|
2008-05-11 11:35:12 +00:00
|
|
|
int8 mouseWheel;
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
Callback buttonCallback;
|
2009-05-10 23:08:32 +00:00
|
|
|
|
2011-06-21 23:08:28 +00:00
|
|
|
const void *extButtonDef;
|
|
|
|
|
2009-05-10 23:08:32 +00:00
|
|
|
uint16 arg;
|
2008-03-28 09:00:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Screen;
|
|
|
|
class TextDisplayer;
|
|
|
|
|
2011-11-16 18:16:19 +00:00
|
|
|
class GUI {
|
2008-03-28 09:00:30 +00:00
|
|
|
public:
|
2011-11-16 18:16:19 +00:00
|
|
|
GUI(KyraEngine_v1 *vm);
|
|
|
|
virtual ~GUI();
|
2008-03-28 09:00:30 +00:00
|
|
|
|
|
|
|
// button specific
|
|
|
|
virtual void processButton(Button *button) = 0;
|
2008-05-11 11:35:12 +00:00
|
|
|
virtual int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) = 0;
|
2008-03-28 09:00:30 +00:00
|
|
|
|
2008-08-20 14:03:34 +00:00
|
|
|
// utilities for thumbnail creation
|
|
|
|
virtual void createScreenThumbnail(Graphics::Surface &dst) = 0;
|
2009-02-01 19:27:01 +00:00
|
|
|
|
2011-11-14 18:57:23 +00:00
|
|
|
void notifyUpdateSaveSlotsList() { _saveSlotsListUpdateNeeded = true; }
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
protected:
|
2008-05-11 23:16:50 +00:00
|
|
|
KyraEngine_v1 *_vm;
|
2008-03-28 09:00:30 +00:00
|
|
|
Screen *_screen;
|
2008-04-04 06:24:49 +00:00
|
|
|
|
2011-11-14 14:51:01 +00:00
|
|
|
// The engine expects a list of contiguous savegame indices.
|
|
|
|
// Since ScummVM's savegame indices aren't, we re-index them.
|
|
|
|
// The integers stored in _saveSlots are ScummVM savegame indices.
|
2008-04-05 01:49:28 +00:00
|
|
|
Common::Array<int> _saveSlots;
|
2011-12-13 21:04:06 +00:00
|
|
|
void updateSaveFileList(Common::String targetName, bool excludeQuickSaves = false);
|
2008-04-04 06:24:49 +00:00
|
|
|
int getNextSavegameSlot();
|
2011-12-13 21:04:06 +00:00
|
|
|
void updateSaveSlotsList(Common::String targetName, bool force = false);
|
2008-12-16 17:40:34 +00:00
|
|
|
|
2011-11-14 14:54:17 +00:00
|
|
|
virtual void sortSaveSlots();
|
|
|
|
|
2008-12-16 17:40:34 +00:00
|
|
|
uint32 _lastScreenUpdate;
|
2011-11-16 18:16:19 +00:00
|
|
|
char **_savegameList;
|
|
|
|
int _savegameListSize;
|
2011-11-14 18:57:23 +00:00
|
|
|
bool _saveSlotsListUpdateNeeded;
|
2008-04-12 23:17:21 +00:00
|
|
|
|
2011-11-16 18:16:19 +00:00
|
|
|
Common::KeyState _keyPressed;
|
2008-04-12 23:17:21 +00:00
|
|
|
};
|
|
|
|
|
2011-11-16 18:16:19 +00:00
|
|
|
} // End of namespace Kyra
|
2008-03-28 09:00:30 +00:00
|
|
|
|
|
|
|
#endif
|