PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
630 stars 58 forks source link

Make the `HitArea` component a view element #434

Open davesmith00000 opened 1 year ago

davesmith00000 commented 1 year ago

Currently the HitArea only lives within the model/viewModel, and this works just fine.

Unless you have a complicated view with groups and scale and transform their elements. Now synchronising the position of the HitArea with the view is really difficult, if not impossible.

So the proposal is to figure out a way to have the HitArea live within the view and have all the usual spacial modifiers and process events, but not render.

My suspicion is that you just add it to the scene graph, process the events, and filter it out before it goes to the renderer during the display object conversation process.

davesmith00000 commented 1 year ago

Needs some thought. For one thing we don't have the concept of an element that is in the view but doesn't render. The problem at the moment is that they aren't stateless, as they track mouse over's and so on.

So choices:

  1. Make another similar thing that only lives in the view, but which is stateless and therefore more limited with respect to state management, but is easier to transform.
  2. Separate 'render' from model. Currently there is no render, but what I mean is to store the state, include a view element and the user has to track/bind them.
  3. Do nothing. A user can always just make an actually transparent button if they like?

What I'm going to do is take this off the TODO list for v0.15.0, and wait until I actually need this and have some clearer motivation.