2021-12-26 20:19:38 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2015-02-22 07:52:57 +00:00
|
|
|
*
|
2021-12-26 20:19:38 +00:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2015-02-22 07:52:57 +00:00
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 17:47:58 +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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2015-02-22 07:52:57 +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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2015-02-22 07:52:57 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-12-25 08:35:50 +00:00
|
|
|
#ifndef STARK_UI_CURSOR_H
|
|
|
|
#define STARK_UI_CURSOR_H
|
2015-02-22 07:52:57 +00:00
|
|
|
|
|
|
|
#include "common/rect.h"
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
|
|
|
|
namespace Stark {
|
|
|
|
|
2015-02-22 10:55:17 +00:00
|
|
|
class VisualImageXMG;
|
2015-07-13 15:37:18 +00:00
|
|
|
class VisualText;
|
2015-02-22 10:55:17 +00:00
|
|
|
|
2015-02-22 07:52:57 +00:00
|
|
|
namespace Gfx {
|
|
|
|
class Driver;
|
|
|
|
}
|
|
|
|
|
2020-10-26 19:57:25 +00:00
|
|
|
namespace Resources {
|
|
|
|
class Sound;
|
|
|
|
}
|
|
|
|
|
2015-12-24 20:52:42 +00:00
|
|
|
/**
|
2015-02-22 07:52:57 +00:00
|
|
|
* Manager for the current game Cursor
|
|
|
|
*/
|
|
|
|
class Cursor {
|
|
|
|
public:
|
2018-02-14 19:25:30 +00:00
|
|
|
explicit Cursor(Gfx::Driver *gfx);
|
2015-02-22 07:52:57 +00:00
|
|
|
~Cursor();
|
|
|
|
|
2015-12-24 20:52:42 +00:00
|
|
|
/** Render the Cursor */
|
2015-02-22 07:52:57 +00:00
|
|
|
void render();
|
|
|
|
|
|
|
|
/** Update the mouse position */
|
2018-02-14 19:25:30 +00:00
|
|
|
void setMousePosition(const Common::Point &pos);
|
2015-02-22 07:52:57 +00:00
|
|
|
|
2020-10-26 19:57:25 +00:00
|
|
|
/** Make cycle the cursor's brightness and play sound */
|
|
|
|
void setItemActive(bool fading);
|
2015-12-24 20:52:42 +00:00
|
|
|
|
2018-06-27 13:28:06 +00:00
|
|
|
/** Update when the screen resolution has changed */
|
|
|
|
void onScreenChanged();
|
|
|
|
|
2015-03-17 20:04:17 +00:00
|
|
|
Common::Point getMousePosition(bool unscaled = false) const;
|
2015-02-23 08:28:46 +00:00
|
|
|
|
2018-11-21 16:24:10 +00:00
|
|
|
/** Rectangle at the mouse position to consider to hit test small world items */
|
|
|
|
Common::Rect getHotRectangle() const;
|
|
|
|
|
2015-02-23 11:28:35 +00:00
|
|
|
enum CursorType {
|
2018-04-08 17:56:24 +00:00
|
|
|
kImage = -1,
|
2015-02-23 11:28:35 +00:00
|
|
|
kDefault = 0,
|
|
|
|
kActive = 3,
|
2015-02-23 13:08:58 +00:00
|
|
|
kPassive = 9,
|
|
|
|
kEye = 10,
|
|
|
|
kHand = 11,
|
|
|
|
kMouth = 12
|
2015-02-23 11:28:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void setCursorType(CursorType type);
|
2015-07-11 12:24:07 +00:00
|
|
|
void setCursorImage(VisualImageXMG *image);
|
2015-02-23 19:31:28 +00:00
|
|
|
void setMouseHint(const Common::String &hint);
|
2015-02-22 07:52:57 +00:00
|
|
|
private:
|
2015-12-24 20:52:42 +00:00
|
|
|
void updateFadeLevel();
|
2019-01-25 20:02:02 +00:00
|
|
|
void updateHintDelay();
|
2015-12-24 20:52:42 +00:00
|
|
|
|
2015-02-22 07:52:57 +00:00
|
|
|
Gfx::Driver *_gfx;
|
|
|
|
|
2015-02-23 19:31:28 +00:00
|
|
|
Common::String _currentHint;
|
2019-01-25 20:02:02 +00:00
|
|
|
int32 _hintDisplayDelay;
|
|
|
|
|
2015-02-22 07:52:57 +00:00
|
|
|
Common::Point _mousePos;
|
2015-02-22 10:55:17 +00:00
|
|
|
VisualImageXMG *_cursorImage;
|
2015-07-13 15:37:18 +00:00
|
|
|
VisualText *_mouseText;
|
2015-02-23 11:28:35 +00:00
|
|
|
CursorType _currentCursorType;
|
2015-12-24 20:52:42 +00:00
|
|
|
|
2020-10-26 19:57:25 +00:00
|
|
|
Resources::Sound *_actionHoverSound;
|
|
|
|
|
|
|
|
bool _itemActive;
|
2015-12-24 20:52:42 +00:00
|
|
|
float _fadeLevel;
|
|
|
|
bool _fadeLevelIncreasing;
|
|
|
|
static const float _fadeValueMax;
|
2015-02-22 07:52:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Stark
|
|
|
|
|
2015-12-25 08:35:50 +00:00
|
|
|
#endif // STARK_UI_CURSOR_H
|