AllBinary Open License Version 1.0
Copyright (c) 2011 AllBinary.
By agreeing to this license you and any business entity you represent are
legally bound to this legal agreement.
You may transmit, m...
If you think the Android project AllBinary-Platform-Game listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* AllBinary Open License Version 1//fromwww.java2s.com
* Copyright (c) 2011 AllBinary
*
* By agreeing to this license you and any business entity you represent are
* legally bound to the AllBinary Open License Version 1 legal agreement.
*
* You may obtain the AllBinary Open License Version 1 legal agreement from
* AllBinary or the root directory of AllBinary's AllBinary Platform repository.
*
* Created By: Travis Berthelot
*
*/package org.allbinary.animation.image;
import org.allbinary.graphics.opengles.OpenGLFeatureFactory;
import org.allbinary.animation.resource.BaseResourceAnimationInterfaceFactoryInterfaceFactory;
import org.allbinary.game.configuration.feature.Features;
import org.allbinary.game.configuration.feature.GraphicsFeatureFactory;
import org.allbinary.graphics.canvas.transition.progress.ProgressCanvas;
import org.allbinary.graphics.canvas.transition.progress.ProgressCanvasFactory;
import org.allbinary.image.ImageCache;
import org.allbinary.image.ImageCacheFactory;
publicclass TestGameDemoImageBasedAnimationInterfaceFactoryInterfaceFactory
extends BaseResourceAnimationInterfaceFactoryInterfaceFactory
{
public TestGameDemoImageBasedAnimationInterfaceFactoryInterfaceFactory()
{
super("Image Animations");
}
public TestGameDemoImageBasedAnimationInterfaceFactoryInterfaceFactory(String name)
{
super(name);
}
publicvoid init(int level)
throws Exception
{
this.init(ImageCacheFactory.getInstance(), level);
}
protectedvoid init(ImageCache imageCache, int level)
throws Exception
{
if(this.isInitialized())
{
return;
}
finalint portion = 120;
final String loadingString = this.toString() + " Loading: ";
int index = 0;
ProgressCanvas progressCanvas =
ProgressCanvasFactory.getInstance();
progressCanvas.addPortion(portion, loadingString + index++);
this.addRectangles();
progressCanvas.addPortion(portion, loadingString + index++);
//Image EXPLOSION_IMAGE = imageCache.get(
// ExplosionResources.getInstance().EXPLOSION_60_RESOURCE);
//int scaleDenominator = 2;
//int explosionFrameSize = (60 * GameConfigurationCentral.getInstance().SCALE.getValue().intValue()) / scaleDenominator;
//LogUtil.put(LogFactory.getInstance("Explosiont: " + explosionFrameSize + " " + explosionFrameSize/2 + " " + explosionFrameSize/4, this, CommonStrings.getInstance().INIT));
//90 x 360
//this.add(ExplosionResources.getInstance().EXPLOSION_60_RESOURCE,
// new SpriteIndexedAnimationFactory(
// EXPLOSION_IMAGE,
// explosionFrameSize, explosionFrameSize));
//progressCanvas.addPortion(portion, loadingString, index++);
//this.add(TouchButtonLoginResource.RESOURCE,
// new OneRowSpriteIndexedAnimationFactory(
// imageCache.get(TouchButtonLoginResource.RESOURCE)));
super.init(level);
}
publicboolean isLoadingLevel(int level)
{
if(level > 0 && level < Integer.MAX_VALUE - 100)
{
return true;
}
else
{
return super.isLoadingLevel(level);
}
}
publicboolean isFeature()
{
Features features = Features.getInstance();
if (features.isFeature(
GraphicsFeatureFactory.getInstance().IMAGE_GRAPHICS) &&
features.isFeature(
GraphicsFeatureFactory.getInstance().IMAGE_TO_ARRAY_GRAPHICS) &&
!features.isDefault(
OpenGLFeatureFactory.getInstance().OPENGL))
{
return true;
}
else
{
return false;
}
}
privatevoid addRectangles() throws Exception
{
//this.addRectangle(BossOneShipResources.getInstance().RESOURCE, new Rectangle(PointFactory
// .ZERO_ZERO, 52, 52));
}
}