2014-02-19 01:08:58 +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.
|
|
|
|
|
|
|
|
* 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 MADS_EVENTS_H
|
|
|
|
#define MADS_EVENTS_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
2014-02-22 17:17:37 +00:00
|
|
|
#include "mads/assets.h"
|
2014-03-05 03:33:27 +00:00
|
|
|
#include "mads/sprites.h"
|
2014-02-19 01:08:58 +00:00
|
|
|
|
|
|
|
namespace MADS {
|
|
|
|
|
2014-02-22 16:13:35 +00:00
|
|
|
enum CursorType { CURSOR_NONE = 0, CURSOR_ARROW = 1, CURSOR_WAIT = 2, CURSOR_GO_DOWN = 3,
|
|
|
|
CURSOR_GO_UP = 4, CURSOR_GO_LEFT = 5, CURSOR_GO_RIGHT = 6 };
|
|
|
|
|
2014-02-19 01:08:58 +00:00
|
|
|
class MADSEngine;
|
|
|
|
|
|
|
|
class EventsManager {
|
|
|
|
private:
|
|
|
|
MADSEngine *_vm;
|
2014-03-05 01:06:48 +00:00
|
|
|
uint32 _frameCounter;
|
2014-02-22 22:25:30 +00:00
|
|
|
uint32 _priorFrameTime;
|
|
|
|
Common::Point _mousePos;
|
2014-03-03 04:09:17 +00:00
|
|
|
Common::Point _currentPos;
|
2014-02-22 16:13:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the cursor image when the current cursor changes
|
|
|
|
*/
|
|
|
|
void changeCursor();
|
2014-02-22 22:25:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks for whether the next game frame number has been reached.
|
|
|
|
*/
|
|
|
|
void checkForNextFrameCounter();
|
2014-02-22 17:17:37 +00:00
|
|
|
public:
|
|
|
|
SpriteAsset *_cursorSprites;
|
2014-03-03 05:42:41 +00:00
|
|
|
CursorType _cursorId;
|
|
|
|
CursorType _newCursorId;
|
2014-02-22 22:25:30 +00:00
|
|
|
bool _mouseClicked;
|
2014-03-03 04:09:17 +00:00
|
|
|
bool _mouseReleased;
|
|
|
|
byte _mouseButtons;
|
2014-04-05 18:27:33 +00:00
|
|
|
bool _rightMousePressed;
|
2014-02-22 22:25:30 +00:00
|
|
|
bool _keyPressed;
|
2014-03-03 04:09:17 +00:00
|
|
|
int _vCC;
|
|
|
|
int _vD2;
|
|
|
|
int _vD4;
|
2014-03-22 16:02:17 +00:00
|
|
|
bool _mouseMoved;
|
2014-03-03 04:09:17 +00:00
|
|
|
int _vD8;
|
2014-02-19 01:08:58 +00:00
|
|
|
public:
|
2014-02-22 16:13:35 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
2014-02-19 01:08:58 +00:00
|
|
|
EventsManager(MADSEngine *vm);
|
|
|
|
|
2014-02-22 16:13:35 +00:00
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
|
|
|
~EventsManager();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the sprite set containing the cursors
|
|
|
|
*/
|
|
|
|
void loadCursors(const Common::String &spritesName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the cursor
|
|
|
|
*/
|
|
|
|
void setCursor(CursorType cursorId);
|
|
|
|
|
2014-02-22 17:17:37 +00:00
|
|
|
/**
|
|
|
|
* Sets the cursor
|
|
|
|
*/
|
|
|
|
void setCursor2(CursorType cursorId);
|
|
|
|
|
2014-02-22 22:25:30 +00:00
|
|
|
/**
|
|
|
|
* Show the mouse cursor
|
|
|
|
*/
|
|
|
|
void showCursor();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide the mouse cursor
|
|
|
|
*/
|
|
|
|
void hideCursor();
|
|
|
|
|
2014-02-24 00:33:26 +00:00
|
|
|
/**
|
2014-03-28 01:04:27 +00:00
|
|
|
* Shows the wait cursor
|
2014-02-24 00:33:26 +00:00
|
|
|
*/
|
2014-03-28 01:04:27 +00:00
|
|
|
void waitCursor();
|
2014-02-24 00:33:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free currently loaded cursors
|
|
|
|
*/
|
|
|
|
void freeCursors();
|
|
|
|
|
2014-02-22 22:25:30 +00:00
|
|
|
/**
|
|
|
|
* Poll any pending events
|
|
|
|
*/
|
|
|
|
void pollEvents();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the current mouse position
|
|
|
|
*/
|
|
|
|
Common::Point mousePos() const { return _mousePos; }
|
|
|
|
|
2014-03-03 04:09:17 +00:00
|
|
|
/**
|
|
|
|
* Return the current mouse position
|
|
|
|
*/
|
|
|
|
Common::Point currentPos() const { return _currentPos; }
|
|
|
|
|
2014-02-22 22:25:30 +00:00
|
|
|
/**
|
|
|
|
* Delay for a given number of frames
|
|
|
|
*/
|
|
|
|
void delay(int amount);
|
2014-03-02 15:49:20 +00:00
|
|
|
|
2014-03-05 01:06:48 +00:00
|
|
|
/**
|
|
|
|
* Wait for the next frame
|
|
|
|
*/
|
|
|
|
void waitForNextFrame();
|
|
|
|
|
2014-03-02 15:49:20 +00:00
|
|
|
/**
|
|
|
|
* Gets the current frame counter
|
|
|
|
*/
|
2014-03-05 01:06:48 +00:00
|
|
|
uint32 getFrameCounter() const { return _frameCounter; }
|
2014-03-03 00:29:54 +00:00
|
|
|
|
|
|
|
void initVars();
|
2014-02-19 01:08:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace MADS
|
|
|
|
|
|
|
|
#endif /* MADS_EVENTS_H */
|