SilverLining for Android 1.0 Skies, 3D clouds, and weather for Android

- Main Page
- Related Pages
- Packages
- Classes
- Files

Including SilverLining's Resources in your App

It's important that you include SilverLining's assets with your application, and point SilverLining at their location - otherwise you'll be left wondering why you received an error when calling Atmosphere::Initialize().

Each of the sample applications includes an assets/Resources folder. You'll need to copy one of them into your own project; they are all the same, and include SilverLining's texture, configuration, and shader files.

SilverLining needs to know how to load these assets from its native code. If you're using Java and the com.sundogsoftware.silverlining.SilverLining class included with the SilverLiningAndroidLibrary, all you need to do is pass your AssetManager into SilverLining::Initialize(). For example:

            import com.sundogsoftware.silverlining.*;

            mSilverLining = new SilverLining();
            mSilverLining.Initialize("user name", "license code", mAssetManager);

mAssetManager may be obtained from the getAssets() method on your Activity class.

If your path is something other than assets/Resources, just change the path specified inside the implementation of SilverLining::Initialize().

C++ developers of native activities will instead need to provide a SilverLining::ResourceLoader implementation to SilverLining. We provide an AndroidResourceLoader class inside the SilverLining static libraries to make this easy. For example:

            #include "AndroidResourceLoader.h"

            atm = SL_NEW Atmosphere("user name", "license code");
            AndroidResourceLoader *rl = SL_NEW AndroidResourceLoader(engine->app->activity->assetManager);
            atm->SetResourceLoader(rl);
            atm->Initialize(Atmosphere::OPENGLES2, "Resources", true, 0);

It's important that you set the resource loader prior to initializing the Atmosphere. Native developers may specify any path underneath your assets folder to Atmosphere::Initialize() if you'd like to locate SilverLining's assets elsewhere.