Skip to content

Commit

Permalink
Updated examples due to AndEngine changes. Added HullAlgorithmExample.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Gramlich committed Feb 10, 2012
1 parent ebfa99c commit f1ec8a1
Show file tree
Hide file tree
Showing 88 changed files with 443 additions and 229 deletions.
1 change: 1 addition & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<activity android:name=".EntityModifierExample" android:configChanges="orientation"/>
<activity android:name=".EntityModifierIrregularExample" android:configChanges="orientation"/>
<activity android:name=".ETC1TextureExample" android:configChanges="orientation"/>
<activity android:name=".HullAlgorithmExample" android:configChanges="orientation"/>
<activity android:name=".ImageFormatsExample" android:configChanges="orientation"/>
<activity android:name=".LevelLoaderExample" android:configChanges="orientation"/>
<activity android:name=".LineExample" android:configChanges="orientation"/>
Expand Down
1 change: 1 addition & 0 deletions project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ android.library.reference.5=../AndEnginePhysicsBox2DExtension
android.library.reference.7=../AndEngineMultiplayerExtension
android.library.reference.8=../AndEngineLiveWallpaperExtension
android.library.reference.9=../AndEngineTMXTiledMapExtension
android.library.reference.10=../AndEngineScriptingExtension
4 changes: 1 addition & 3 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
<string name="tv_xmllayoutexample_above">You can put <b>one</b> <i>AndEngine</i> View into any Activity.</string>
<string name="tv_xmllayoutexample_below">Lorem ipsum dolor sit amat...</string>

<string name="scriptingexample_code_hint">Place JS code here...</string>
<string name="scriptingexample_code_apply">Apply</string>

<string name="textbreakexample_text_default">Hello, World!</string>

<!-- Example-Groups -->
Expand Down Expand Up @@ -63,6 +60,7 @@
<string name="example_entitymodifier">Using EntityModifiers</string>
<string name="example_entitymodifierirregular">Irregular EntityModifiers</string>
<string name="example_etc1texture">Using ETC1 Textures</string>
<string name="example_hullalgorithm">Hull Algorithm</string>
<string name="example_imageformats">Using ImageFormats (PNG, JPG, GIF, BMP)</string>
<string name="example_levelloader">Loading a Level from XML</string>
<string name="example_line">Drawing Lines</string>
Expand Down
8 changes: 4 additions & 4 deletions src/org/andengine/examples/AnalogOnScreenControlExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();

this.mOnScreenControlTexture = new BitmapTextureAtlas(256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlBaseTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0);
this.mOnScreenControlKnobTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0);
this.mOnScreenControlTexture.load(this.getTextureManager());
this.mOnScreenControlTexture.load();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/org/andengine/examples/AnalogOnScreenControlsExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();

this.mOnScreenControlTexture = new BitmapTextureAtlas(256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlBaseTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0);
this.mOnScreenControlKnobTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0);
this.mOnScreenControlTexture.load(this.getTextureManager());
this.mOnScreenControlTexture.load();
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions src/org/andengine/examples/AnimatedSpritesExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(512, 256, TextureOptions.NEAREST);
// this.mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(512, 256, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(this.getTextureManager(), 512, 256, TextureOptions.NEAREST);
// this.mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(this.getTextureManager(), 512, 256, TextureOptions.BILINEAR);

this.mSnapdragonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this, "snapdragon_tiled.png", 4, 3);
this.mHelicopterTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this, "helicopter_tiled.png", 2, 2);
Expand All @@ -78,7 +78,7 @@ public void onCreateResources() {

try {
this.mBitmapTextureAtlas.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1));
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();
} catch (TextureAtlasBuilderException e) {
Debug.e(e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/andengine/examples/AsyncGameActivityExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public void onCreateResourcesAsync(final IProgressListener pProgressListener) th
pProgressListener.onProgressChanged(20);
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
Thread.sleep(1000);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
pProgressListener.onProgressChanged(40);
Thread.sleep(1000);
this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(AsyncGameActivityExample.this.mBitmapTextureAtlas, AsyncGameActivityExample.this, "face_box.png", 0, 0);
pProgressListener.onProgressChanged(60);
Thread.sleep(1000);
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();
pProgressListener.onProgressChanged(80);
Thread.sleep(1000);
pProgressListener.onProgressChanged(100);
Expand Down
4 changes: 2 additions & 2 deletions src/org/andengine/examples/AugmentedRealityExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
// public void onCreateResources() {
// BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
//
// this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR);
// this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
// this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
// this.mBitmapTextureAtlas.load(this.getTextureManager());
// this.mBitmapTextureAtlas.load();
// }
//
// @Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
// public void onCreateResources() {
// BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
//
// this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR);
// this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
// this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
// this.mBitmapTextureAtlas.load(this.getTextureManager());
// this.mBitmapTextureAtlas.load();
// }
//
// @Override
Expand Down
8 changes: 4 additions & 4 deletions src/org/andengine/examples/AutoParallaxBackgroundExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BitmapTextureAtlas(256, 128, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
this.mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this, "player.png", 0, 0, 3, 4);
this.mEnemyTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this, "enemy.png", 73, 0, 3, 4);
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();

this.mAutoParallaxBackgroundTexture = new BitmapTextureAtlas(1024, 1024);
this.mAutoParallaxBackgroundTexture = new BitmapTextureAtlas(this.getTextureManager(), 1024, 1024);
this.mParallaxLayerFront = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mAutoParallaxBackgroundTexture, this, "parallax_background_layer_front.png", 0, 0);
this.mParallaxLayerBack = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mAutoParallaxBackgroundTexture, this, "parallax_background_layer_back.png", 0, 188);
this.mParallaxLayerMid = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mAutoParallaxBackgroundTexture, this, "parallax_background_layer_mid.png", 0, 669);
this.mAutoParallaxBackgroundTexture.load(this.getTextureManager());
this.mAutoParallaxBackgroundTexture.load();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/org/andengine/examples/BasePhysicsJointExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BitmapTextureAtlas(64, 64, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 64, 64, TextureOptions.BILINEAR);
this.mBoxFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this, "face_box_tiled.png", 0, 0, 2, 1); // 64x32
this.mCircleFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this, "face_circle_tiled.png", 0, 32, 2, 1); // 64x32
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/org/andengine/examples/BitmapFontExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public EngineOptions onCreateEngineOptions() {

@Override
public void onCreateResources() {
this.mBitmapFont = new BitmapFont(this, "font/BitmapFont.fnt");
this.mBitmapFont.loadTextures(this.getTextureManager());
this.mBitmapFont = new BitmapFont(this.getTextureManager(), this.getAssets(), "font/BitmapFont.fnt");
this.mBitmapFont.load();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/org/andengine/examples/BoundCameraExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ public Engine onCreateEngine(final EngineOptions pEngineOptions) {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BitmapTextureAtlas(64, 32, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 64, 32, TextureOptions.BILINEAR);
this.mBoxFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this, "face_box_tiled.png", 0, 0, 2, 1); // 64x32
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();

this.mHUDTexture = new BitmapTextureAtlas(256, 128,TextureOptions.BILINEAR);
this.mHUDTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 128,TextureOptions.BILINEAR);
this.mToggleButtonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mHUDTexture, this, "toggle_button.png", 0, 0, 2, 1); // 256x128
this.mHUDTexture.load(this.getTextureManager());
this.mHUDTexture.load();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/org/andengine/examples/ButtonSpriteExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(512, 512);
this.mBitmapTextureAtlas = new BuildableBitmapTextureAtlas(this.getTextureManager(), 512, 512);
this.mFace1TextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box_tiled.png");
this.mFace2TextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_circle_tiled.png");
this.mFace3TextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_hexagon_tiled.png");

try {
this.mBitmapTextureAtlas.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 0));
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();
} catch (TextureAtlasBuilderException e) {
Debug.e(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public EngineOptions onCreateEngineOptions() {

@Override
public void onCreateResources() {
this.mBitmapTextureAtlas = new BitmapTextureAtlas(190, 190, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 190, 190, TextureOptions.BILINEAR);

final IBitmapTextureAtlasSource baseTextureSource = new EmptyBitmapTextureAtlasSource(190, 190);
final IBitmapTextureAtlasSource decoratedTextureAtlasSource = new BaseBitmapTextureAtlasSourceDecorator(baseTextureSource) {
Expand Down Expand Up @@ -99,7 +99,7 @@ public BaseBitmapTextureAtlasSourceDecorator deepCopy() {
};

this.mDecoratedBalloonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromSource(this.mBitmapTextureAtlas, decoratedTextureAtlasSource, 0, 0);
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/org/andengine/examples/ChangeableTextExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public EngineOptions onCreateEngineOptions() {

@Override
public void onCreateResources() {
this.mFont = FontFactory.create(256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 48).load(this.getTextureManager(), this.getFontManager());
this.mFont = FontFactory.create(this.getFontManager(), this.getTextureManager(), 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 48);
this.mFont.load();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/org/andengine/examples/CollisionDetectionExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();

this.mOnScreenControlTexture = new BitmapTextureAtlas(256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlBaseTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0);
this.mOnScreenControlKnobTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0);
this.mOnScreenControlTexture.load(this.getTextureManager());
this.mOnScreenControlTexture.load();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public EngineOptions onCreateEngineOptions() {

@Override
public void onCreateResources() {
this.mBitmapTextureAtlas = new BitmapTextureAtlas(256, 128, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);

/* The actual AssetTextureSource. */
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
Expand All @@ -79,7 +79,7 @@ public void onCreateResources() {

this.mChromaticCircleColorKeyedTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromSource(this.mBitmapTextureAtlas, colorKeyBitmapTextureAtlasSource, 128, 0);

this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/org/andengine/examples/CoordinateConversionExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ public EngineOptions onCreateEngineOptions() {
public void onCreateResources() {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR);
this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
this.mBitmapTextureAtlas.load(this.getTextureManager());
this.mBitmapTextureAtlas.load();

this.mOnScreenControlTexture = new BitmapTextureAtlas(256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
this.mOnScreenControlBaseTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0);
this.mOnScreenControlKnobTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0);
this.mOnScreenControlTexture.load(this.getTextureManager());
this.mOnScreenControlTexture.load();
}

@Override
Expand Down
Loading

0 comments on commit f1ec8a1

Please sign in to comment.