Closed kikito closed 12 years ago
The shapes need to update the spatial hash when moved/rotated, but only when created using the main module.
Because HC is modular - you can roll your own shape management if you want to - shape:move(...)
is required to be bound to the shape. HC:move(shape, ...)
would duplicate functionality. For the same reason - i.e. transparent, modular API - shapes may not hold a reference to the HC instance.
These four Shape methods are defined on the instance level (added to each instance on creation instead of being on the class) inside HC:new_shape.
I imagine that the reasoning behind this decision is that shapes don't have to "know about HC".
This seems a bit "backwards" to me. In my opinion, if rotate affects both HC and the shape, then it should either be a method of HC exclusively (HC:rotate(shape)) or shapes should hold a reference to HC so they can notify it (shape:init(HC, ...))