NEVERHOOD: Add mouse cursor hiding/showing

This commit is contained in:
johndoe123 2012-10-16 11:15:13 +00:00 committed by Willem Jan Palenstijn
parent 682d15fce4
commit f5c7070ace
2 changed files with 9 additions and 1 deletions

View File

@ -42,7 +42,7 @@ Mouse::Mouse(NeverhoodEngine *vm, uint32 fileHash, const NRect &mouseRect)
Mouse::Mouse(NeverhoodEngine *vm, uint32 fileHash, int16 x1, int16 x2)
: StaticSprite(vm, 2000), _mouseType(kMouseType435),
_mouseCursorResource(vm), _frameNum(0), _x1(x1), _x2(x2) {
_mouseCursorResource(vm), _frameNum(0), _x1(x1), _x2(x2), _visible(true) {
init(fileHash);
if (_x <= _x1) {
@ -85,6 +85,13 @@ void Mouse::load(uint32 fileHash) {
}
void Mouse::update() {
if (_visible && !_surface->getVisible()) {
CursorMan.showMouse(false);
_visible = false;
} else if (!_visible && _surface->getVisible()) {
CursorMan.showMouse(true);
_visible = true;
}
updateCursor();
_frameNum++;
if (_frameNum >= 6)

View File

@ -51,6 +51,7 @@ protected:
int16 _x1;
int16 _x2;
int _type;
bool _visible;
void init(uint32 fileHash);
void update();
void updateCursorNum();