2012-09-08 08:45:22 +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
|
|
|
*
|
2012-09-08 08:45:22 +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
|
|
|
*
|
2012-09-08 08:45:22 +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 HOPKINS_EVENTS_H
|
|
|
|
#define HOPKINS_EVENTS_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
2012-10-24 08:55:43 +00:00
|
|
|
#include "common/events.h"
|
2012-09-08 08:45:22 +00:00
|
|
|
#include "common/str.h"
|
|
|
|
|
|
|
|
namespace Hopkins {
|
|
|
|
|
2012-09-15 00:27:15 +00:00
|
|
|
#define GAME_FRAME_RATE 50
|
|
|
|
#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
|
|
|
|
|
2012-09-19 11:34:23 +00:00
|
|
|
class HopkinsEngine;
|
|
|
|
|
2012-10-28 11:17:55 +00:00
|
|
|
enum DIALOG_KEY { KEY_NONE = 0, KEY_INVENTORY = 1, KEY_OPTIONS = 2, KEY_SAVE = 3, KEY_LOAD = 4 };
|
2012-10-28 03:26:07 +00:00
|
|
|
|
2012-09-15 00:27:15 +00:00
|
|
|
class EventsManager {
|
|
|
|
private:
|
2013-02-07 17:56:40 +00:00
|
|
|
int _oldIconId;
|
|
|
|
uint32 _priorCounterTime;
|
|
|
|
uint32 _priorFrameTime;
|
|
|
|
bool _keyState[256];
|
2013-02-15 07:33:42 +00:00
|
|
|
bool _mouseLinuxFl;
|
|
|
|
int _mouseSizeX, _mouseSizeY;
|
2013-02-07 17:56:40 +00:00
|
|
|
|
2012-09-19 11:34:23 +00:00
|
|
|
HopkinsEngine *_vm;
|
|
|
|
|
2012-09-15 00:27:15 +00:00
|
|
|
void pollEvents();
|
2013-04-11 10:17:06 +00:00
|
|
|
void handleKey(const Common::Event &event);
|
2012-09-15 01:45:36 +00:00
|
|
|
void checkForNextFrameCounter();
|
2012-11-01 11:35:33 +00:00
|
|
|
void updateCursor();
|
2013-02-07 17:56:40 +00:00
|
|
|
|
2012-09-08 08:45:22 +00:00
|
|
|
public:
|
2013-02-07 17:56:40 +00:00
|
|
|
DIALOG_KEY _gameKey;
|
|
|
|
uint32 _rateCounter;
|
|
|
|
uint32 _gameCounter;
|
|
|
|
bool _escKeyFl;
|
2012-12-11 00:53:50 +00:00
|
|
|
bool _mouseFl;
|
2013-02-07 17:56:40 +00:00
|
|
|
bool _breakoutFl;
|
2012-12-11 00:53:50 +00:00
|
|
|
Common::Point _startPos;
|
|
|
|
Common::Point _mousePos;
|
2013-02-07 17:56:40 +00:00
|
|
|
Common::Point _mouseOffset;
|
2012-12-11 07:31:07 +00:00
|
|
|
int _mouseSpriteId;
|
|
|
|
int _curMouseButton;
|
|
|
|
int _mouseButton;
|
|
|
|
int _mouseCursorId;
|
2012-12-11 00:53:50 +00:00
|
|
|
byte *_objectBuf;
|
2013-02-07 17:56:40 +00:00
|
|
|
byte *_mouseCursor;
|
|
|
|
|
2013-03-19 19:40:55 +00:00
|
|
|
EventsManager(HopkinsEngine *vm);
|
2012-11-01 11:35:33 +00:00
|
|
|
~EventsManager();
|
2013-03-24 14:31:59 +00:00
|
|
|
void clearAll();
|
2013-02-15 07:33:42 +00:00
|
|
|
void initMouseData();
|
|
|
|
|
2013-02-07 17:56:40 +00:00
|
|
|
void delay(int totalMilli);
|
2013-04-11 10:17:06 +00:00
|
|
|
void changeMouseCursor(int id);
|
2013-02-07 17:56:40 +00:00
|
|
|
void refreshEvents();
|
|
|
|
int waitKeyPress();
|
2012-12-11 00:53:50 +00:00
|
|
|
int getMouseX();
|
|
|
|
int getMouseY();
|
|
|
|
int getMouseButton();
|
2013-02-07 17:56:40 +00:00
|
|
|
void setMouseXY(Common::Point pos);
|
|
|
|
void setMouseXY(int xp, int yp);
|
2012-12-11 00:53:50 +00:00
|
|
|
void mouseOn();
|
|
|
|
void mouseOff();
|
2013-02-07 17:56:40 +00:00
|
|
|
void setMouseOn();
|
2013-03-04 06:46:15 +00:00
|
|
|
void refreshScreenAndEvents();
|
2012-09-08 08:45:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Hopkins
|
|
|
|
|
|
|
|
#endif /* HOPKINS_EVENTS_H */
|