package com.jukusoft.renderer2d.prototyp.engine.asset;

/**
 * Asset manager to manages resources / assets
 *
 * Created by Justin on 24.08.2016.
 */
public class AssetManager {

    /**
    * instance of asset manager
    */
    protected static AssetManager instance = null;

    /**
    * default constructor
    */
    public AssetManager () {
        //
    }

    public static AssetManager getInstance () {
        //check, if instance of asset manager doesnt exists
        if (AssetManager.instance == null) {
            //create new asset manager
            AssetManager.instance = new AssetManager();
        }

        //return instance of asset manager
        return AssetManager.instance;
    }

    /**
    * set new instance of asset manager
     *
     * @param assetManager instance of new asset manager
    */
    public static void setInstance (AssetManager assetManager) {
        //override instance
        AssetManager.instance = assetManager;
    }

}

@@ -49,16 +49,68 @@
 asset;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 /**%0A * A
@@ -323,16 +323,196 @@
  null;%0A%0A
+    /**%0A     * list with asset manager initializer to add asset loader%0A     */%0A    protected static List%3CAssetManagerInitializer%3E assetManagerInitializerList = new ArrayList%3C%3E();%0A%0A
     /**%0A
@@ -838,16 +838,110 @@
 nager();
+%0A%0A            //initialize asset manager and add asset loaders%0A            callInitializers();
 %0A       
@@ -1244,16 +1244,16 @@
 nstance%0A
-
         
@@ -1297,10 +1297,924 @@
 %0A    %7D%0A%0A
+    /**%0A    * add initializer for asset manager to add Assetloader%0A     *%0A     * @param initializer instance of asset manager initializer%0A    */%0A    public static void addInitializer (AssetManagerInitializer initializer) %7B%0A        //check, if instance of asset manager already exists%0A        if (instance != null) %7B%0A            throw new IllegalStateException(%22AssetManager is already initialized, you have to add initializers before any call of getInstance().%22);%0A        %7D%0A%0A        //add initializer to list%0A        assetManagerInitializerList.add(initializer);%0A    %7D%0A%0A    /**%0A    * call asset manager initializers and add asset loaders%0A    */%0A    private static void callInitializers () %7B%0A        //initialize asset manager%0A        for (AssetManagerInitializer initializer : assetManagerInitializerList) %7B%0A            //add asset loaders%0A            initializer.initializeAssetLoader(instance);%0A        %7D%0A    %7D%0A%0A
 %7D%0A

change class AssetManager, added support to add initializers.