OGWEntityViewDelegate Protocol Reference
Conforms to | NSObject |
Declared in | OGWEntity.h |
Overview
Views can implement this protocol to tie their position and rotation with the entity.
By implementing custom versions of the setters you can perform any coordinate conversion as needed, ie converting from OpenGW world coordinates to screen space, respectively converting the OpenGW rotation from radians to degrees.
For Sprite Kit the delegate methods are chosen so that SKNode objects implicitly implement the delegate methods. Meaning you can set any SKNode object as an entity’s view delegate.
Planned for future releases are delegates that adapt themselves based on the engine they’re used with.
Tasks
Position and Rotation Change
-
– setPosition:
required method -
– setZRotation:
required method
Entity Events
-
– willRemoveEntity:
required method
Instance Methods
setPosition:
Sent when the entity’s position has changed. Override/swizzle this method in your view class to perform coordinate conversion as needed.
- (void)setPosition:(GWPoint)position
Parameters
- position
The entity’s position in points (world coordinates).
Declared In
OGWEntity.h
setZRotation:
Send when the entity’s rotation has changed. Override/swizzle this method in your view class to perform radian to degrees conversion if needed.
- (void)setZRotation:(GWFloat)rotation
Parameters
- rotation
The entity’s rotation, in radians.
Declared In
OGWEntity.h
willRemoveEntity:
Sent just before the entity is removed from the world. The view can use this to remove itself, or perform other tasks like playing a particle effect.
- (void)willRemoveEntity:(OGWEntity *)entity
Parameters
- entity
The entity that will be removed. In case the view delegate needs the entity and did not cache it locally.
Declared In
OGWEntity.h