Skip to content

Instantly share code, notes, and snippets.

@rdavisau
rdavisau / CocosExtensions.cs
Last active Aug 29, 2015
CocosSharp Extension Methods - Helpers for actions, layout, sizing, drawing
View CocosExtensions.cs
/*
Snippet Name: CocosSharp Extension Methods
Platform: All
Function: CocosSharp helpers for actions, layout, sizing, drawing
Includes:
- Awaitable CCNode.RunActionsWithTask - allows you to await the running of a set of actions (for example, in order to not proceed with subsequent code till an animation completes), without having to explicitly calculate the duration of the actions or use a callback.
- Easy relative positioning with CCNode.PlaceAt - allows you to position a CCNode relative to the boundaries of a parent CCNode. Fluent style, so can be used at initialisation time.
- Easy filled colours with CCDrawNode.FillWith and quick sprite initialisation with CCNode.WithSprite, also fluent.
- Quick insetting or outsetting with CCSize.MultiplyBy.