2003-10-23 06:44:35 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2003-2006 The ScummVM project
|
2003-10-23 06:44:35 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-10-23 06:44:35 +00:00
|
|
|
*
|
2006-02-11 10:07:12 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-10-23 06:44:35 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-11-12 17:47:16 +00:00
|
|
|
#ifndef QUEEN_INPUT_H
|
|
|
|
#define QUEEN_INPUT_H
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2003-12-01 20:48:41 +00:00
|
|
|
#include "common/util.h"
|
2007-04-02 19:12:17 +00:00
|
|
|
#include "common/rect.h"
|
2003-10-23 06:44:35 +00:00
|
|
|
#include "queen/defs.h"
|
|
|
|
|
2004-03-15 01:45:22 +00:00
|
|
|
class OSystem;
|
|
|
|
|
2007-04-02 19:12:17 +00:00
|
|
|
namespace Common {
|
|
|
|
class EventManager;
|
|
|
|
}
|
|
|
|
|
2003-10-23 06:44:35 +00:00
|
|
|
namespace Queen {
|
|
|
|
|
|
|
|
class Input {
|
2004-12-31 00:25:18 +00:00
|
|
|
public:
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! Adjust here to change delays!
|
|
|
|
enum {
|
|
|
|
DELAY_SHORT = 10,
|
2007-04-02 19:12:17 +00:00
|
|
|
DELAY_NORMAL = 100, // 5 * 20ms
|
2004-12-31 00:25:18 +00:00
|
|
|
DELAY_SCREEN_BLANKER = 5 * 60 * 1000
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
MOUSE_LBUTTON = 1,
|
|
|
|
MOUSE_RBUTTON = 2
|
|
|
|
};
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2006-11-03 22:36:05 +00:00
|
|
|
Input(Common::Language language, OSystem *system);
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
void delay(uint amount);
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! convert input to verb
|
|
|
|
int checkKeys();
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! use instead of KEYVERB=0
|
|
|
|
void clearKeyVerb() { _keyVerb = VERB_NONE; }
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
void canQuit(bool cq) { _canQuit = cq; }
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
bool cutawayRunning() const { return _cutawayRunning; }
|
|
|
|
void cutawayRunning(bool running) { _cutawayRunning = running; }
|
2003-10-23 18:50:47 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
bool cutawayQuit() const { return _cutawayQuit; }
|
|
|
|
void cutawayQuitReset() { _cutawayQuit = false; }
|
2003-10-23 18:50:47 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
void dialogueRunning(bool running) { _dialogueRunning = running; }
|
2003-10-23 18:50:47 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
bool talkQuit() const { return _talkQuit; }
|
|
|
|
void talkQuitReset() { _talkQuit = false; }
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
bool quickSave() const { return _quickSave; }
|
|
|
|
void quickSaveReset() { _quickSave = false; }
|
|
|
|
bool quickLoad() const { return _quickLoad; }
|
|
|
|
void quickLoadReset() { _quickLoad = false; }
|
|
|
|
bool debugger() const { return _debugger; }
|
|
|
|
void debuggerReset() { _debugger = false; }
|
2003-11-15 21:16:01 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
bool fastMode() const { return _fastMode; }
|
|
|
|
void fastMode(bool fm) { _fastMode = fm; }
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
Verb keyVerb() const { return _keyVerb; }
|
2003-11-09 21:31:18 +00:00
|
|
|
|
2007-04-02 19:12:17 +00:00
|
|
|
Common::Point getMousePos() const;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
int mouseButton() const { return _mouseButton; }
|
|
|
|
void clearMouseButton() { _mouseButton = 0; }
|
2003-10-28 20:58:46 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! returns user idle time (used by Display, to trigger the screensaver)
|
|
|
|
uint32 idleTime() const { return _idleTime; }
|
2003-10-28 20:58:46 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
private:
|
2003-10-28 20:58:46 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
enum KeyCode {
|
|
|
|
KEY_SPACE = ' ',
|
|
|
|
KEY_COMMA = ',',
|
|
|
|
KEY_DOT = '.',
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
KEY_DIGIT_1 = '1',
|
|
|
|
KEY_DIGIT_2 = '2',
|
|
|
|
KEY_DIGIT_3 = '3',
|
|
|
|
KEY_DIGIT_4 = '4',
|
|
|
|
|
|
|
|
KEY_ESCAPE = 27,
|
|
|
|
KEY_RETURN = 13,
|
|
|
|
KEY_BACKSPACE = 8,
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
KEY_F1 = 282,
|
|
|
|
KEY_F11 = KEY_F1 + 10,
|
|
|
|
KEY_F5 = KEY_F1 + 4,
|
|
|
|
KEY_F12
|
|
|
|
};
|
|
|
|
|
|
|
|
//! used to get keyboard and mouse events
|
|
|
|
OSystem *_system;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2007-04-02 19:12:17 +00:00
|
|
|
Common::EventManager *_eventMan;
|
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! some cutaways require update() run faster
|
|
|
|
bool _fastMode;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! the current verb received from keyboard
|
|
|
|
Verb _keyVerb;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set if a cutaway is running
|
|
|
|
bool _cutawayRunning;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set this if we can quit
|
|
|
|
bool _canQuit;
|
2003-10-23 18:50:47 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! moved Cutaway::_quit here
|
|
|
|
bool _cutawayQuit;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set if a dialogue is running
|
|
|
|
bool _dialogueRunning;
|
2003-11-15 21:16:01 +00:00
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
//! moved Talk::_quit here
|
2004-12-31 00:25:18 +00:00
|
|
|
bool _talkQuit;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set if quicksave requested
|
|
|
|
bool _quickSave;
|
2003-11-09 21:31:18 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set if quickload requested
|
|
|
|
bool _quickLoad;
|
2003-11-09 21:31:18 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set if debugger requested
|
|
|
|
bool _debugger;
|
2003-12-26 12:58:27 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set by delay();
|
|
|
|
int _inKey;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! set by delay();
|
|
|
|
int _mouseButton;
|
2003-10-23 06:44:35 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! user idle time
|
|
|
|
uint32 _idleTime;
|
2003-12-26 14:49:49 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! command keys for current language
|
|
|
|
const char *_currentCommandKeys;
|
2003-11-02 20:42:36 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! command keys for all languages
|
2006-11-03 22:36:05 +00:00
|
|
|
static const char *_commandKeys[];
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-31 00:25:18 +00:00
|
|
|
//! verbs matching the command keys
|
2006-11-03 22:36:05 +00:00
|
|
|
static const Verb _verbKeys[];
|
2003-10-23 06:44:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Queen
|
|
|
|
|
|
|
|
#endif
|