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