Where To Handle Mouse Events When Using GKStateMachine

88 views Asked by At

There is just not a lot of information out there about using GKStateMachine and I was wondering where mouse events should be handled. In Apple's "Dispenser" example, they handle the mouse click events in the main scene and I was wondering if that's where they should be handled or can each state handle its own mouse events?

My purpose for using GKStateMachine in the first place is for a MacOS SpriteKit project (Objective C) I'm working on involving the creation of a Leaderboard for a tournament. In the setup phase of the app, I have a visual list of competitors and I click on them one at a time to decide on match ups.

1

There are 1 answers

3
Mark Brownsword On BEST ANSWER

Mouse events will be captured by visual elements e.g. nodes in the scene or the scene itself. GKStateMachine is not a visual element so it doesn't make sense for it to handle mouse events. You could expect the mouse event captured by a visual element to trigger a state change.