I'm using the latest version of jPCT-AE.
Texture loading code:
public void addOrReplaceTexture(final TextureManager textureManager,
final String textureName, final Texture texture) {
texture.setClamping(true);
texture.setFiltering(false);
texture.setMipmap(true);
if (textureManager.containsTexture(textureName)) {
textureManager.replaceTexture(textureName, texture);
} else {
textureManager.addTexture(textureName, texture);
}
}
@SuppressWarnings("deprecation")
public void loadTextures() {
System.gc();
toaster("Loading...", Toast.LENGTH_LONG);
com.threed.jpct.Config.unloadImmediately = false;
Texture.defaultTo4bpp(true);
// Texture.defaultToMipmapping(true);
final TextureManager textureManager = TextureManager.getInstance();
// For flipping the bitmap from left to right
final Matrix mHor = new Matrix();
mHor.preScale(-1, 1);
// For flipping the bitmap upside-down
final Matrix mVer = new Matrix();
mVer.preScale(1, -1);
// load background (moved down!)
Texture bg = null;
final Bitmap tempSkin = this.gLkinScaledBitmap(skin);
this.addOrReplaceTexture(
textureManager,
"snow",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.snow)).getBitmap(), false));
this.addOrReplaceTexture(
textureManager,
"rain",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.rain)).getBitmap(), false));
this.addOrReplaceTexture(
textureManager,
"hamburger",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.hamburger)).getBitmap(), false));
// (tex, coordX, coordY, sizeX, sizeY)
if (hasOldSkinDimensions(tempSkin)) {
final int height = tempSkin.getHeight();
final int width = tempSkin.getWidth();
// HEAD
final Bitmap headFront1 = Bitmap.createBitmap(tempSkin, width / 8,
height / 4, width / 8, height / 4); // x,y,x,y (64,32,64,32)
final Bitmap headTop1 = Bitmap.createBitmap(tempSkin, width / 8, 0,
width / 8, height / 4);
final Bitmap headBack1 = Bitmap.createBitmap(tempSkin,
width / 8 * 3, height / 4, width / 8, height / 4);
final Bitmap headRight1 = Bitmap.createBitmap(tempSkin, 0,
height / 4, width / 8, height / 4, mHor, false);
final Bitmap headLeft1 = Bitmap.createBitmap(tempSkin, width / 4,
height / 4, width / 8, height / 4);
final Bitmap headBottom1 = Bitmap.createBitmap(tempSkin, width / 4,
0, width / 8, height / 4);
final Texture headFront2 = new Texture(headFront1, true);
final Texture headTop2 = new Texture(headTop1, true);
final Texture headBack2 = new Texture(headBack1, true);
final Texture headRight2 = new Texture(headRight1, true);
final Texture headLeft2 = new Texture(headLeft1, true);
final Texture headBottom2 = new Texture(headBottom1, true);
// HAT
final Bitmap hatFront1 = Bitmap.createBitmap(tempSkin,
width / 8 * 5, height / 4, width / 8, height / 4);
final Bitmap hatTop1 = Bitmap.createBitmap(tempSkin, width / 8 * 5,
0, width / 8, height / 4);
final Bitmap hatBack1 = Bitmap.createBitmap(tempSkin,
width / 8 * 7, height / 4, width / 8, height / 4);
final Bitmap hatRight1 = Bitmap.createBitmap(tempSkin, width / 2,
height / 4, width / 8, height / 4, mHor, false);
final Bitmap hatLeft1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, height / 4, width / 8, height / 4);
final Bitmap hatBottom1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, 0, width / 8, height / 4);
final Texture hatFront2 = new Texture(hatFront1, true);
final Texture hatTop2 = new Texture(hatTop1, true);
final Texture hatBack2 = new Texture(hatBack1, true);
final Texture hatRight2 = new Texture(hatRight1, true);
final Texture hatLeft2 = new Texture(hatLeft1, true);
final Texture hatBottom2 = new Texture(hatBottom1, true);
// BODY
final Bitmap bodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 5, height / 8 * 5,
width / 8, height / 8 * 3), 64, 64, false);
final Bitmap bodyTop1 = Bitmap.createBitmap(tempSkin,
width / 16 * 5, 16, width / 8, height / 4);
final Bitmap bodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 2, height / 8 * 5,
width / 8, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 4, height / 8 * 5,
width / 16, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 7, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap bodyBottom1 = Bitmap.createBitmap(tempSkin,
width / 16 * 7, height / 2, width / 8, height / 4);
final Texture bodyFront2 = new Texture(bodyFront1, true);
final Texture bodyTop2 = new Texture(bodyTop1, true);
final Texture bodyBack2 = new Texture(bodyBack1, true);
final Texture bodyRight2 = new Texture(bodyRight1, true);
final Texture bodyLeft2 = new Texture(bodyLeft1, true);
final Texture bodyBottom2 = new Texture(bodyBottom1, true);
// ARM
final Bitmap armFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 11, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armTop1 = Bitmap.createBitmap(tempSkin,
width / 16 * 11, height / 2, width / 16, height / 8);
final Bitmap armBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 13, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 8 * 5, height / 8 * 5,
width / 16, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap armLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 4 * 3, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armBottom1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, height / 2, width / 16, height / 8);
final Texture armFront2 = new Texture(armFront1, true);
final Texture armTop2 = new Texture(armTop1, true);
final Texture armBack2 = new Texture(armBack1, true);
final Texture armRight2 = new Texture(armRight1, true);
final Texture armLeft2 = new Texture(armLeft1, true);
final Texture armBottom2 = new Texture(armBottom1, true);
// LEG
final Bitmap legFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap legTop1 = Bitmap.createBitmap(tempSkin, width / 16,
height / 2, width / 16, height / 8);
final Bitmap legBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 3, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap legRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, height / 8 * 5, width / 16,
height / 8 * 3, mHor, false), 64, 64, false);
final Bitmap legLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 8, height / 8 * 5, width / 16,
height / 8 * 3), 64, 64, false);
final Bitmap legBottom1 = Bitmap.createBitmap(tempSkin, width / 8,
height / 2, width / 16, height / 8);
final Texture legFront2 = new Texture(legFront1, true);
final Texture legTop2 = new Texture(legTop1, true);
final Texture legBack2 = new Texture(legBack1, true);
final Texture legRight2 = new Texture(legRight1, true);
final Texture legLeft2 = new Texture(legLeft1, true);
final Texture legBottom2 = new Texture(legBottom1, true);
final Bitmap rightLegFront1 = Bitmap.createBitmap(legFront1, 0, 0,
legFront1.getWidth(), legFront1.getHeight(), mHor, false);
final Texture leftLegFront2 = new Texture(rightLegFront1, true);
final Bitmap rightArmFront1 = Bitmap.createBitmap(armFront1, 0, 0,
legFront1.getWidth(), legFront1.getHeight(), mHor, false);
final Texture leftArmFront2 = new Texture(rightArmFront1, true);
final int maxDimension;
if (Build.VERSION.SDK_INT > 12) {
// Prevents OOM's
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
maxDimension = Math.max(size.x, size.y);
} else {
Display display = getWindowManager().getDefaultDisplay();
maxDimension = Math
.max(display.getWidth(), display.getHeight());
}
if (maxDimension <= 512) {
// minimum
bg = new Texture(Bitmap.createScaledBitmap(Bitmap.createBitmap(
background, 0, 0, background.getWidth(),
background.getHeight(), mVer, false), 256, 256, false));
} else if (maxDimension <= 1024) {
// default
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 512,
512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 256,
256, false));
}
} else if (maxDimension <= 1536) {
// big
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 1024,
1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
512, 512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
256, 256, false));
}
}
} else {
// maximum
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 2048,
2048, false));
} catch (final OutOfMemoryError e3) {
e3.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
1024, 1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 512, 512,
false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 256, 256,
false));
}
}
}
}
// BACKGROUND
addOrReplaceTexture(textureManager, "bg", bg);
// HEAD
addOrReplaceTexture(textureManager, "headfront", headFront2);
addOrReplaceTexture(textureManager, "headtop", headTop2);
addOrReplaceTexture(textureManager, "headback", headBack2);
addOrReplaceTexture(textureManager, "headright", headRight2);
addOrReplaceTexture(textureManager, "headleft", headLeft2);
addOrReplaceTexture(textureManager, "headbottom", headBottom2);
// HAT
addOrReplaceTexture(textureManager, "hatfront", hatFront2);
addOrReplaceTexture(textureManager, "hattop", hatTop2);
addOrReplaceTexture(textureManager, "hatback", hatBack2);
addOrReplaceTexture(textureManager, "hatright", hatRight2);
addOrReplaceTexture(textureManager, "hatleft", hatLeft2);
addOrReplaceTexture(textureManager, "hatbottom", hatBottom2);
// BODY
addOrReplaceTexture(textureManager, "bodyfront", bodyFront2);
addOrReplaceTexture(textureManager, "bodytop", bodyTop2);
addOrReplaceTexture(textureManager, "bodyback", bodyBack2);
addOrReplaceTexture(textureManager, "bodyright", bodyRight2);
addOrReplaceTexture(textureManager, "bodyleft", bodyLeft2);
addOrReplaceTexture(textureManager, "bodybottom", bodyBottom2);
// RIGHTARM
addOrReplaceTexture(textureManager, "outerrightarmfront", armFront2);
addOrReplaceTexture(textureManager, "outerrightarmtop", armTop2);
addOrReplaceTexture(textureManager, "outerrightarmback", armBack2);
addOrReplaceTexture(textureManager, "outerrightarmright", armRight2);
addOrReplaceTexture(textureManager, "outerrightarmleft", armLeft2);
addOrReplaceTexture(textureManager, "outerrightarmbottom",
armBottom2);
// LEFTARM
addOrReplaceTexture(textureManager, "outerleftarmfront",
leftArmFront2);
addOrReplaceTexture(textureManager, "outerleftarmtop", armTop2);
addOrReplaceTexture(textureManager, "outerleftarmback", armBack2);
addOrReplaceTexture(textureManager, "outerleftarmright", armRight2);
addOrReplaceTexture(textureManager, "outerleftarmleft", armLeft2);
addOrReplaceTexture(textureManager, "outerleftarmbottom",
armBottom2);
// RIGHTLEG
addOrReplaceTexture(textureManager, "outerrightlegfront", legFront2);
addOrReplaceTexture(textureManager, "outerrightlegtop", legTop2);
addOrReplaceTexture(textureManager, "outerrightlegback", legBack2);
addOrReplaceTexture(textureManager, "outerrightlegright", legRight2);
addOrReplaceTexture(textureManager, "outerrightlegleft", legLeft2);
addOrReplaceTexture(textureManager, "outerrightlegbottom",
legBottom2);
// LEFTLEG
addOrReplaceTexture(textureManager, "outerleftlegfront",
leftLegFront2);
addOrReplaceTexture(textureManager, "outerleftlegtop", legTop2);
addOrReplaceTexture(textureManager, "outerleftlegback", legBack2);
addOrReplaceTexture(textureManager, "outerleftlegright", legRight2);
addOrReplaceTexture(textureManager, "outerleftlegleft", legLeft2);
addOrReplaceTexture(textureManager, "outerleftlegbottom",
legBottom2);
} else {
// NEW SKIN TEMPLATE!
final int dimen = tempSkin.getHeight(); // default = 64
// HEAD
final Bitmap headFront1 = Bitmap.createBitmap(tempSkin, dimen / 8,
dimen / 8, dimen / 8, dimen / 8);
final Bitmap headTop1 = Bitmap.createBitmap(tempSkin, dimen / 8, 0,
dimen / 8, dimen / 8);
final Bitmap headBack1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 3, dimen / 8, dimen / 8, dimen / 8);
final Bitmap headRight1 = Bitmap.createBitmap(tempSkin, 0,
dimen / 8, dimen / 8, dimen / 8, mHor, false);
final Bitmap headLeft1 = Bitmap.createBitmap(tempSkin, dimen / 4,
dimen / 8, dimen / 8, dimen / 8);
final Bitmap headBottom1 = Bitmap.createBitmap(tempSkin, dimen / 4,
0, dimen / 8, dimen / 8);
final Texture headFront2 = new Texture(headFront1, true);
final Texture headTop2 = new Texture(headTop1, true);
final Texture headBack2 = new Texture(headBack1, true);
final Texture headRight2 = new Texture(headRight1, true);
final Texture headLeft2 = new Texture(headLeft1, true);
final Texture headBottom2 = new Texture(headBottom1, true);
// HAT
final Bitmap hatFront1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 5, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatTop1 = Bitmap.createBitmap(tempSkin, dimen / 8 * 5,
0, dimen / 8, dimen / 8);
final Bitmap hatBack1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 7, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatRight1 = Bitmap.createBitmap(tempSkin, dimen / 2,
dimen / 8, dimen / 8, dimen / 8, mHor, false);
final Bitmap hatLeft1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, 0, dimen / 8, dimen / 8);
final Texture hatFront2 = new Texture(hatFront1, true);
final Texture hatTop2 = new Texture(hatTop1, true);
final Texture hatBack2 = new Texture(hatBack1, true);
final Texture hatRight2 = new Texture(hatRight1, true);
final Texture hatLeft2 = new Texture(hatLeft1, true);
final Texture hatBottom2 = new Texture(hatBottom1, true);
// BODY
final Bitmap bodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 5,
dimen / 8, dimen / 16 * 3), 64, 64, false);
final Bitmap bodyTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 4, dimen / 8, dimen / 8);
final Bitmap bodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 5,
dimen / 8, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap bodyBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 7, dimen / 4, dimen / 8, dimen / 8);
final Texture bodyFront2 = new Texture(bodyFront1, true);
final Texture bodyTop2 = new Texture(bodyTop1, true);
final Texture bodyBack2 = new Texture(bodyBack1, true);
final Texture bodyRight2 = new Texture(bodyRight1, true);
final Texture bodyLeft2 = new Texture(bodyLeft1, true);
final Texture bodyBottom2 = new Texture(bodyBottom1, true);
// OUTERBODY
final Bitmap outerBodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 9,
dimen / 8, dimen / 16 * 3), 64, 64, false);
final Bitmap outerBodyTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 2, dimen / 8, dimen / 8);
final Bitmap outerBodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 9,
dimen / 8, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerBodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerBodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerBodyBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 7, dimen / 2, dimen / 8, dimen / 8);
final Texture outerBodyFront2 = new Texture(outerBodyFront1, true);
final Texture outerBodyTop2 = new Texture(outerBodyTop1, true);
final Texture outerBodyBack2 = new Texture(outerBodyBack1, true);
final Texture outerBodyRight2 = new Texture(outerBodyRight1, true);
final Texture outerBodyLeft2 = new Texture(outerBodyLeft1, true);
final Texture outerBodyBottom2 = new Texture(outerBodyBottom1, true);
// INNERRIGHTARM
final Bitmap innerRightArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 11, dimen / 4, dimen / 16, dimen / 16);
final Bitmap innerRightArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerRightArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 4, dimen / 16, dimen / 16);
final Texture innerRightArmFront2 = new Texture(
innerRightArmFront1, true);
final Texture innerRightArmTop2 = new Texture(innerRightArmTop1,
true);
final Texture innerRightArmBack2 = new Texture(innerRightArmBack1,
true);
final Texture innerRightArmRight2 = new Texture(
innerRightArmRight1, true);
final Texture innerRightArmLeft2 = new Texture(innerRightArmLeft1,
true);
final Texture innerRightArmBottom2 = new Texture(
innerRightArmBottom1, true);
// OUTERRIGHTARM
final Bitmap outerRightArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 11, dimen / 2, dimen / 16, dimen / 16);
final Bitmap outerRightArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerRightArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 2, dimen / 16, dimen / 16);
final Texture outerRightArmFront2 = new Texture(
outerRightArmFront1, true);
final Texture outerRightArmTop2 = new Texture(outerRightArmTop1,
true);
final Texture outerRightArmBack2 = new Texture(outerRightArmBack1,
true);
final Texture outerRightArmRight2 = new Texture(
outerRightArmRight1, true);
final Texture outerRightArmLeft2 = new Texture(outerRightArmLeft1,
true);
final Texture outerRightArmBottom2 = new Texture(
outerRightArmBottom1, true);
// INNERRIGHTLEG
final Bitmap innerRightLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 4, dimen / 16, dimen / 16);
final Bitmap innerRightLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 5, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap innerRightLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 4, dimen / 16, dimen / 16);
final Texture innerRightLegFront2 = new Texture(
innerRightLegFront1, true);
final Texture innerRightLegTop2 = new Texture(innerRightLegTop1,
true);
final Texture innerRightLegBack2 = new Texture(innerRightLegBack1,
true);
final Texture innerRightLegRight2 = new Texture(
innerRightLegRight1, true);
final Texture innerRightLegLeft2 = new Texture(innerRightLegLeft1,
true);
final Texture innerRightLegBottom2 = new Texture(
innerRightLegBottom1, true);
// OUTERRIGHTLEG
final Bitmap outerRightLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 2, dimen / 16, dimen / 16);
final Bitmap outerRightLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 9, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap outerRightLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 2, dimen / 16, dimen / 16);
final Texture outerRightLegFront2 = new Texture(
outerRightLegFront1, true);
final Texture outerRightLegTop2 = new Texture(outerRightLegTop1,
true);
final Texture outerRightLegBack2 = new Texture(outerRightLegBack1,
true);
final Texture outerRightLegRight2 = new Texture(
outerRightLegRight1, true);
final Texture outerRightLegLeft2 = new Texture(outerRightLegLeft1,
true);
final Texture outerRightLegBottom2 = new Texture(
outerRightLegBottom1, true);
// OUTERLEFTLEG
final Bitmap outerLeftLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap outerLeftLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 13, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap outerLeftLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 4 * 3, dimen / 16, dimen / 16);
final Texture outerLeftLegFront2 = new Texture(outerLeftLegFront1,
true);
final Texture outerLeftLegTop2 = new Texture(outerLeftLegTop1, true);
final Texture outerLeftLegBack2 = new Texture(outerLeftLegBack1,
true);
final Texture outerLeftLegRight2 = new Texture(outerLeftLegRight1,
true);
final Texture outerLeftLegLeft2 = new Texture(outerLeftLegLeft1,
true);
final Texture outerLeftLegBottom2 = new Texture(
outerLeftLegBottom1, true);
// INNERLEFTLEG
final Bitmap innerLeftLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap innerLeftLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerLeftLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 3, dimen / 4 * 3, dimen / 16, dimen / 16);
final Texture innerLeftLegFront2 = new Texture(innerLeftLegFront1,
true);
final Texture innerLeftLegTop2 = new Texture(innerLeftLegTop1, true);
final Texture innerLeftLegBack2 = new Texture(innerLeftLegBack1,
true);
final Texture innerLeftLegRight2 = new Texture(innerLeftLegRight1,
true);
final Texture innerLeftLegLeft2 = new Texture(innerLeftLegLeft1,
true);
final Texture innerLeftLegBottom2 = new Texture(
innerLeftLegBottom1, true);
// INNERLEFTARM
final Bitmap innerLeftArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 9, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 9, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap innerLeftArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerLeftArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 5, dimen / 4 * 3, dimen / 16, dimen / 16);
final Texture innerLeftArmFront2 = new Texture(innerLeftArmFront1,
true);
final Texture innerLeftArmTop2 = new Texture(innerLeftArmTop1, true);
final Texture innerLeftArmBack2 = new Texture(innerLeftArmBack1,
true);
final Texture innerLeftArmRight2 = new Texture(innerLeftArmRight1,
true);
final Texture innerLeftArmLeft2 = new Texture(innerLeftArmLeft1,
true);
final Texture innerLeftArmBottom2 = new Texture(
innerLeftArmBottom1, true);
// OUTERLEFTARM
final Bitmap outerLeftArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 13, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap outerLeftArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 15, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
// /
final Bitmap outerLeftArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerLeftArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 7, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 7, dimen / 4 * 3, dimen / 16, dimen / 16);
final Texture outerLeftArmFront2 = new Texture(outerLeftArmFront1,
true);
final Texture outerLeftArmTop2 = new Texture(outerLeftArmTop1, true);
final Texture outerLeftArmBack2 = new Texture(outerLeftArmBack1,
true);
final Texture outerLeftArmRight2 = new Texture(outerLeftArmRight1,
true);
final Texture outerLeftArmLeft2 = new Texture(outerLeftArmLeft1,
true);
final Texture outerLeftArmBottom2 = new Texture(
outerLeftArmBottom1, true);
final int maxDimension;
if (Build.VERSION.SDK_INT > 12) {
// Prevents OOM's
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
maxDimension = Math.max(size.x, size.y);
} else {
Display display = getWindowManager().getDefaultDisplay();
maxDimension = Math
.max(display.getWidth(), display.getHeight());
}
if (maxDimension <= 512) {
// minimum
bg = new Texture(Bitmap.createScaledBitmap(Bitmap.createBitmap(
background, 0, 0, background.getWidth(),
background.getHeight(), mVer, false), 256, 256, false));
} else if (maxDimension <= 1024) {
// default
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 512,
512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 256,
256, false));
}
} else if (maxDimension <= 1536) {
// big
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 1024,
1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
512, 512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
256, 256, false));
}
}
} else {
// maximum
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 2048,
2048, false));
} catch (final OutOfMemoryError e3) {
e3.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
1024, 1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 512, 512,
false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 256, 256,
false));
}
}
}
}
// BACKGROUND
addOrReplaceTexture(textureManager, "bg", bg);
// HEAD
addOrReplaceTexture(textureManager, "headfront", headFront2);
addOrReplaceTexture(textureManager, "headtop", headTop2);
addOrReplaceTexture(textureManager, "headback", headBack2);
addOrReplaceTexture(textureManager, "headright", headRight2);
addOrReplaceTexture(textureManager, "headleft", headLeft2);
addOrReplaceTexture(textureManager, "headbottom", headBottom2);
// HAT
addOrReplaceTexture(textureManager, "hatfront", hatFront2);
addOrReplaceTexture(textureManager, "hattop", hatTop2);
addOrReplaceTexture(textureManager, "hatback", hatBack2);
addOrReplaceTexture(textureManager, "hatright", hatRight2);
addOrReplaceTexture(textureManager, "hatleft", hatLeft2);
addOrReplaceTexture(textureManager, "hatbottom", hatBottom2);
// BODY
addOrReplaceTexture(textureManager, "innerbodyfront", bodyFront2);
addOrReplaceTexture(textureManager, "innerbodytop", bodyTop2);
addOrReplaceTexture(textureManager, "innerbodyback", bodyBack2);
addOrReplaceTexture(textureManager, "innerbodyright", bodyRight2);
addOrReplaceTexture(textureManager, "innerbodyleft", bodyLeft2);
addOrReplaceTexture(textureManager, "innerbodybottom", bodyBottom2);
// OUTERBODY
addOrReplaceTexture(textureManager, "bodyfront", outerBodyFront2);
addOrReplaceTexture(textureManager, "bodytop", outerBodyTop2);
addOrReplaceTexture(textureManager, "bodyback", outerBodyBack2);
addOrReplaceTexture(textureManager, "bodyright", outerBodyRight2);
addOrReplaceTexture(textureManager, "bodyleft", outerBodyLeft2);
addOrReplaceTexture(textureManager, "bodybottom", outerBodyBottom2);
// INNERRIGHTARM
addOrReplaceTexture(textureManager, "innerrightarmfront",
innerRightArmFront2);
addOrReplaceTexture(textureManager, "innerrightarmtop",
innerRightArmTop2);
addOrReplaceTexture(textureManager, "innerrightarmback",
innerRightArmBack2);
addOrReplaceTexture(textureManager, "innerrightarmright",
innerRightArmRight2);
addOrReplaceTexture(textureManager, "innerrightarmleft",
innerRightArmLeft2);
addOrReplaceTexture(textureManager, "innerrightarmbottom",
innerRightArmBottom2);
// OUTERRIGHTARM
addOrReplaceTexture(textureManager, "outerrightarmfront",
outerRightArmFront2);
addOrReplaceTexture(textureManager, "outerrightarmtop",
outerRightArmTop2);
addOrReplaceTexture(textureManager, "outerrightarmback",
outerRightArmBack2);
addOrReplaceTexture(textureManager, "outerrightarmright",
outerRightArmRight2);
addOrReplaceTexture(textureManager, "outerrightarmleft",
outerRightArmLeft2);
addOrReplaceTexture(textureManager, "outerrightarmbottom",
outerRightArmBottom2);
// INNERRIGHTLEG
addOrReplaceTexture(textureManager, "innerrightlegfront",
innerRightLegFront2);
addOrReplaceTexture(textureManager, "innerrightlegtop",
innerRightLegTop2);
addOrReplaceTexture(textureManager, "innerrightlegback",
innerRightLegBack2);
addOrReplaceTexture(textureManager, "innerrightlegright",
innerRightLegRight2);
addOrReplaceTexture(textureManager, "innerrightlegleft",
innerRightLegLeft2);
addOrReplaceTexture(textureManager, "innerrightlegbottom",
innerRightLegBottom2);
// OUTERRIGHTLEG
addOrReplaceTexture(textureManager, "outerrightlegfront",
outerRightLegFront2);
addOrReplaceTexture(textureManager, "outerrightlegtop",
outerRightLegTop2);
addOrReplaceTexture(textureManager, "outerrightlegback",
outerRightLegBack2);
addOrReplaceTexture(textureManager, "outerrightlegright",
outerRightLegRight2);
addOrReplaceTexture(textureManager, "outerrightlegleft",
outerRightLegLeft2);
addOrReplaceTexture(textureManager, "outerrightlegbottom",
outerRightLegBottom2);
// OUTERLEFTLEG
addOrReplaceTexture(textureManager, "outerleftlegfront",
outerLeftLegFront2);
addOrReplaceTexture(textureManager, "outerleftlegtop",
outerLeftLegTop2);
addOrReplaceTexture(textureManager, "outerleftlegback",
outerLeftLegBack2);
addOrReplaceTexture(textureManager, "outerleftlegright",
outerLeftLegRight2);
addOrReplaceTexture(textureManager, "outerleftlegleft",
outerLeftLegLeft2);
addOrReplaceTexture(textureManager, "outerleftlegbottom",
outerLeftLegBottom2);
// INNERLEFTLEG
addOrReplaceTexture(textureManager, "innerleftlegfront",
innerLeftLegFront2);
addOrReplaceTexture(textureManager, "innerleftlegtop",
innerLeftLegTop2);
addOrReplaceTexture(textureManager, "innerleftlegback",
innerLeftLegBack2);
addOrReplaceTexture(textureManager, "innerleftlegright",
innerLeftLegRight2);
addOrReplaceTexture(textureManager, "innerleftlegleft",
innerLeftLegLeft2);
addOrReplaceTexture(textureManager, "innerleftlegbottom",
innerLeftLegBottom2);
// OUTERLEFTARM
addOrReplaceTexture(textureManager, "outerleftarmfront",
outerLeftArmFront2);
addOrReplaceTexture(textureManager, "outerleftarmtop",
outerLeftArmTop2);
addOrReplaceTexture(textureManager, "outerleftarmback",
outerLeftArmBack2);
addOrReplaceTexture(textureManager, "outerleftarmright",
outerLeftArmRight2);
addOrReplaceTexture(textureManager, "outerleftarmleft",
outerLeftArmLeft2);
addOrReplaceTexture(textureManager, "outerleftarmbottom",
outerLeftArmBottom2);
// INNERLEFTARM
addOrReplaceTexture(textureManager, "innerleftarmfront",
innerLeftArmFront2);
addOrReplaceTexture(textureManager, "innerleftarmtop",
innerLeftArmTop2);
addOrReplaceTexture(textureManager, "innerleftarmback",
innerLeftArmBack2);
addOrReplaceTexture(textureManager, "innerleftarmright",
innerLeftArmRight2);
addOrReplaceTexture(textureManager, "innerleftarmleft",
innerLeftArmLeft2);
addOrReplaceTexture(textureManager, "innerleftarmbottom",
innerLeftArmBottom2);
}
if (this.armor != null) {
// Load armor
if (hasArmorDimensions()) {
final Bitmap bodyArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 6, 33, 8, 6), 32, 32, false);
final Bitmap bodyArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 6, 39, 8, 13), 32,
32, false);
final Bitmap bodyArmorBack1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 20, 39, 8, 13), 32, 32,
false);
final Bitmap bodyArmorRight1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 14, 39, 6, 13), 32, 32,
false);
final Bitmap bodyArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 0, 39, 6, 13), 32,
32, false);
final Bitmap headArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 40, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorFront1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 10, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorBack1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 30, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorRight1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 20, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorLeft1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 0, 54, 10, 10), 32, 32,
false);
final Bitmap footArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 8, 8, 6, 6), 32, 32, false);
final Bitmap footArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 34, 49, 6, 4), 32,
32, false);
final Bitmap footArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 45, 49, 6, 4), 32,
32, false);
final Bitmap footArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 40, 49, 5, 4), 32,
32, false);
final Bitmap footArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 29, 49, 5, 4), 32,
32, false);
final Bitmap legArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 29, 33, 4, 9), 32,
32, false);
final Bitmap legArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 33, 33, 4, 9), 32,
32, false);
final Bitmap legArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 37, 33, 4, 9), 32,
32, false);
final Bitmap legArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 41, 33, 4, 9), 32,
32, false);
final Bitmap shoulderArmorTop1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 51, 6, 6), 32,
32, false);
final Bitmap shoulderArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 33, 6, 6), 32,
32, false);
final Bitmap shoulderArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 45, 6, 6), 32,
32, false);
final Bitmap shoulderArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 57, 6, 6), 32,
32, false);
final Bitmap shoulderArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 39, 6, 6), 32,
32, false);
final Drawable transparent = getResources().getDrawable(
R.drawable.transparent);
final Texture bodyArmorTop2 = new Texture(bodyArmorTop1, true);
final Texture bodyArmorFront2 = new Texture(bodyArmorFront1,
true);
final Texture bodyArmorLeft2 = new Texture(bodyArmorLeft1, true);
final Texture bodyArmorRight2 = new Texture(bodyArmorRight1,
true);
final Texture bodyArmorBack2 = new Texture(bodyArmorBack1, true);
final Texture bodyArmorBottom2 = new Texture(transparent, true);
final Texture headArmorTop2 = new Texture(headArmorTop1, true);
final Texture headArmorFront2 = new Texture(headArmorFront1,
true);
final Texture headArmorLeft2 = new Texture(headArmorLeft1, true);
final Texture headArmorRight2 = new Texture(headArmorRight1,
true);
final Texture headArmorBack2 = new Texture(headArmorBack1, true);
final Texture headArmorBottom2 = new Texture(transparent, true);
final Texture footArmorTop2 = new Texture(footArmorTop1, true);
final Texture footArmorFront2 = new Texture(footArmorFront1,
true);
final Texture footArmorLeft2 = new Texture(footArmorLeft1, true);
final Texture footArmorRight2 = new Texture(footArmorRight1,
true);
final Texture footArmorBack2 = new Texture(footArmorBack1, true);
final Texture footArmorBottom2 = new Texture(transparent, true);
final Texture legArmorTop2 = new Texture(transparent, true);
final Texture legArmorFront2 = new Texture(legArmorFront1, true);
final Texture legArmorLeft2 = new Texture(legArmorLeft1, true);
final Texture legArmorRight2 = new Texture(legArmorRight1, true);
final Texture legArmorBack2 = new Texture(legArmorBack1, true);
final Texture legArmorBottom2 = new Texture(transparent, true);
final Texture shoulderArmorTop2 = new Texture(
shoulderArmorTop1, true);
final Texture shoulderArmorFront2 = new Texture(
shoulderArmorFront1, true);
final Texture shoulderArmorLeft2 = new Texture(
shoulderArmorLeft1, true);
final Texture shoulderArmorRight2 = new Texture(
shoulderArmorRight1, true);
final Texture shoulderArmorBack2 = new Texture(
shoulderArmorBack1, true);
final Texture shoulderArmorBottom2 = new Texture(transparent,
true);
bodyArmorTop2.setFiltering(false);
bodyArmorFront2.setFiltering(false);
bodyArmorLeft2.setFiltering(false);
bodyArmorRight2.setFiltering(false);
bodyArmorBack2.setFiltering(false);
bodyArmorBottom2.setFiltering(false);
headArmorTop2.setFiltering(false);
headArmorFront2.setFiltering(false);
headArmorLeft2.setFiltering(false);
headArmorRight2.setFiltering(false);
headArmorBack2.setFiltering(false);
headArmorBottom2.setFiltering(false);
footArmorTop2.setFiltering(false);
footArmorFront2.setFiltering(false);
footArmorLeft2.setFiltering(false);
footArmorRight2.setFiltering(false);
footArmorBack2.setFiltering(false);
footArmorBottom2.setFiltering(false);
legArmorTop2.setFiltering(false);
legArmorFront2.setFiltering(false);
legArmorLeft2.setFiltering(false);
legArmorRight2.setFiltering(false);
legArmorBack2.setFiltering(false);
legArmorBottom2.setFiltering(false);
shoulderArmorTop2.setFiltering(false);
shoulderArmorFront2.setFiltering(false);
shoulderArmorLeft2.setFiltering(false);
shoulderArmorRight2.setFiltering(false);
shoulderArmorBack2.setFiltering(false);
shoulderArmorBottom2.setFiltering(false);
addOrReplaceTexture(textureManager, "armorbodytop",
bodyArmorTop2);
addOrReplaceTexture(textureManager, "armorbodyfront",
bodyArmorFront2);
addOrReplaceTexture(textureManager, "armorbodyleft",
bodyArmorLeft2);
addOrReplaceTexture(textureManager, "armorbodyright",
bodyArmorRight2);
addOrReplaceTexture(textureManager, "armorbodyback",
bodyArmorBack2);
addOrReplaceTexture(textureManager, "armorbodybottom",
bodyArmorBottom2);
addOrReplaceTexture(textureManager, "armorheadtop",
headArmorTop2);
addOrReplaceTexture(textureManager, "armorheadfront",
headArmorFront2);
addOrReplaceTexture(textureManager, "armorheadleft",
headArmorLeft2);
addOrReplaceTexture(textureManager, "armorheadright",
headArmorRight2);
addOrReplaceTexture(textureManager, "armorheadback",
headArmorBack2);
addOrReplaceTexture(textureManager, "armorheadbottom",
headArmorBottom2);
addOrReplaceTexture(textureManager, "armorfootbottom",
footArmorTop2);
addOrReplaceTexture(textureManager, "armorfootfront",
footArmorFront2);
addOrReplaceTexture(textureManager, "armorfootleft",
footArmorLeft2);
addOrReplaceTexture(textureManager, "armorfootright",
footArmorRight2);
addOrReplaceTexture(textureManager, "armorfootback",
footArmorBack2);
addOrReplaceTexture(textureManager, "armorfoottop",
footArmorBottom2);
addOrReplaceTexture(textureManager, "armorlegtop", legArmorTop2);
addOrReplaceTexture(textureManager, "armorlegfront",
legArmorFront2);
addOrReplaceTexture(textureManager, "armorlegleft",
legArmorLeft2);
addOrReplaceTexture(textureManager, "armorlegright",
legArmorRight2);
addOrReplaceTexture(textureManager, "armorlegback",
legArmorBack2);
addOrReplaceTexture(textureManager, "armorlegbottom",
legArmorBottom2);
addOrReplaceTexture(textureManager, "armorshouldertop",
shoulderArmorTop2);
addOrReplaceTexture(textureManager, "armorshoulderfront",
shoulderArmorFront2);
addOrReplaceTexture(textureManager, "armorshoulderleft",
shoulderArmorLeft2);
addOrReplaceTexture(textureManager, "armorshoulderright",
shoulderArmorRight2);
addOrReplaceTexture(textureManager, "armorshoulderback",
shoulderArmorBack2);
addOrReplaceTexture(textureManager, "armorshoulderbottom",
shoulderArmorBottom2);
}
}
for (final String name : textureManager.getNames()) {
textureManager.getTexture(name).setFiltering(false);
}
textureManager.compress();
}
I might have to clean up the code a bit sometime...