ZVISION: Add ScriptManager mouse event handlers
This allows the main engine to pass mouse events to Controls
This commit is contained in:
parent
a6b2bb7581
commit
e3b08793dd
2 changed files with 42 additions and 0 deletions
|
@ -233,6 +233,25 @@ void ScriptManager::disableControl(uint32 key) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
||||||
|
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||||
|
(*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptManager::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
||||||
|
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||||
|
(*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
||||||
|
bool cursorWasChanged = false;
|
||||||
|
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||||
|
cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cursorWasChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) {
|
void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) {
|
||||||
|
|
|
@ -86,6 +86,29 @@ public:
|
||||||
void enableControl(uint32 key);
|
void enableControl(uint32 key);
|
||||||
void disableControl(uint32 key);
|
void disableControl(uint32 key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when LeftMouse is pushed.
|
||||||
|
*
|
||||||
|
* @param screenSpacePos The position of the mouse in screen space
|
||||||
|
* @param backgroundImageSpacePos The position of the mouse in background image space
|
||||||
|
*/
|
||||||
|
void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);
|
||||||
|
/**
|
||||||
|
* Called when LeftMouse is lifted.
|
||||||
|
*
|
||||||
|
* @param screenSpacePos The position of the mouse in screen space
|
||||||
|
* @param backgroundImageSpacePos The position of the mouse in background image space
|
||||||
|
*/
|
||||||
|
void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);
|
||||||
|
/**
|
||||||
|
* Called on every MouseMove.
|
||||||
|
*
|
||||||
|
* @param screenSpacePos The position of the mouse in screen space
|
||||||
|
* @param backgroundImageSpacePos The position of the mouse in background image space
|
||||||
|
* @return Was the cursor changed?
|
||||||
|
*/
|
||||||
|
bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);
|
||||||
|
|
||||||
void changeLocation(char world, char room, char node, char view, uint32 offset);
|
void changeLocation(char world, char room, char node, char view, uint32 offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue