-
Notifications
You must be signed in to change notification settings - Fork 10
Component Assets
hypersurge edited this page May 28, 2015
·
1 revision
Assets, assets, assets. Every project has them: graphics, sounds, music, movies, 3D meshes, fonts. Assets are the external binaries which provide the fluff to the crunch.
The AssetManager provides a (potentially) type safe route to any asset, of any type, for any target. Therefore it is somewhat abstract, and arguably useless in it's default form.
- No two projects are the same. So it is safe to assume that because assets are concrete, reference to them should be too.
- Consider extending AAssetManager for your project to include factory methods for each asset - and inject Entities with their required assets from Factory (good).
- Or cast IKernel.assets in situations as they arise - e.g. Scene or Entity (bad).
- Or use string keys and identifiers to reference assets at runtime (ugly).
- Perhaps a good asset manager is also a Preloader - when creating these concrete implementations consider their union.
- Implements IAssetManager.
- Typed assets (e.g. via Haxe generate intrinsics) allows compile time safe querying of any asset which reduces runtime errors significantly.