Code Monkey home page Code Monkey logo

andengine's Introduction

šŸ‘‹ Hi, Iā€™m @nicolasgramlich

andengine's People

Contributors

brig avatar coccor avatar davidschreiber avatar ebbybeh avatar fixedd avatar gnufz avatar levinotik avatar loffe avatar makersf avatar moraes avatar nazgee avatar nicolasgramlich avatar player-03 avatar recastrodiaz avatar sjvc avatar spencerelliott avatar stevosaurus avatar vershinin avatar vertti avatar winniehell avatar xyuzynga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

andengine's Issues

cannot be resolved to a type

I got this errors.

Description Resource Path Location Type
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 71 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 93 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 115 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 121 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 129 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 148 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 163 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 175 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 204 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 216 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 236 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 245 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 261 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 272 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 293 Java Problem
BuildConfig cannot be resolved to a variable BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 308 Java Problem
BuildConfig cannot be resolved to a variable Engine.java /AndEngine/src/org/andengine/engine line 820 Java Problem
BuildConfig cannot be resolved to a variable FPSLogger.java /AndEngine/src/org/andengine/entity/util line 75 Java Problem
BuildConfig cannot be resolved to a variable FrameCountCrasher.java /AndEngine/src/org/andengine/entity/util line 53 Java Problem
BuildConfig cannot be resolved to a variable GLState.java /AndEngine/src/org/andengine/opengl/util line 131 Java Problem
BuildConfig cannot be resolved to a variable GenericPool.java /AndEngine/src/org/andengine/util/adt/pool line 135 Java Problem
BuildConfig cannot be resolved to a variable ITexture.java /AndEngine/src/org/andengine/opengl/texture line 104 Java Problem
BuildConfig cannot be resolved to a variable ITexture.java /AndEngine/src/org/andengine/opengl/texture line 111 Java Problem
BuildConfig cannot be resolved to a variable ITextureAtlas.java /AndEngine/src/org/andengine/opengl/texture/atlas line 82 Java Problem
BuildConfig cannot be resolved to a variable ITextureAtlas.java /AndEngine/src/org/andengine/opengl/texture/atlas line 99 Java Problem
GINGERBREAD cannot be resolved or is not a field SystemUtils.java /AndEngine/src/org/andengine/util/system line 32 Java Problem
HONEYCOMB cannot be resolved or is not a field BufferUtils.java /AndEngine/src/org/andengine/opengl/util line 41 Java Problem
HONEYCOMB cannot be resolved or is not a field BufferUtils.java /AndEngine/src/org/andengine/opengl/util line 54 Java Problem
HONEYCOMB cannot be resolved or is not a field SystemUtils.java /AndEngine/src/org/andengine/util/system line 33 Java Problem
HONEYCOMB_MR2 cannot be resolved or is not a field BufferUtils.java /AndEngine/src/org/andengine/opengl/util line 41 Java Problem
HONEYCOMB_MR2 cannot be resolved or is not a field BufferUtils.java /AndEngine/src/org/andengine/opengl/util line 54 Java Problem
ICE_CREAM_SANDWICH cannot be resolved or is not a field SystemUtils.java /AndEngine/src/org/andengine/util/system line 34 Java Problem
SCREEN_ORIENTATION_SENSOR_LANDSCAPE cannot be resolved or is not a field BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 438 Java Problem
SCREEN_ORIENTATION_SENSOR_PORTRAIT cannot be resolved or is not a field BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 449 Java Problem
The import org.andengine.BuildConfig cannot be resolved BaseGameActivity.java /AndEngine/src/org/andengine/ui/activity line 3 Java Problem
The import org.andengine.BuildConfig cannot be resolved Engine.java /AndEngine/src/org/andengine/engine line 7 Java Problem
The import org.andengine.BuildConfig cannot be resolved FPSLogger.java /AndEngine/src/org/andengine/entity/util line 3 Java Problem
The import org.andengine.BuildConfig cannot be resolved FrameCountCrasher.java /AndEngine/src/org/andengine/entity/util line 3 Java Problem
The import org.andengine.BuildConfig cannot be resolved GLState.java /AndEngine/src/org/andengine/opengl/util line 9 Java Problem
The import org.andengine.BuildConfig cannot be resolved GenericPool.java /AndEngine/src/org/andengine/util/adt/pool line 6 Java Problem
The import org.andengine.BuildConfig cannot be resolved ITexture.java /AndEngine/src/org/andengine/opengl/texture line 5 Java Problem
The import org.andengine.BuildConfig cannot be resolved ITextureAtlas.java /AndEngine/src/org/andengine/opengl/texture/atlas line 3 Java Problem
The method glVertexAttribPointer(int, int, int, boolean, int, Buffer) in the type GLES20 is not applicable for the arguments (int, int, int, boolean, int, int) VertexBufferObjectAttribute.java /AndEngine/src/org/andengine/opengl/vbo/attribute line 73 Java Problem

Removed Color.WHITE_PACKED is not fixed in source code

AndEngineTMXTiledMapExtension

org/andengine/extension/tmx/TMXLayer.java:

this.drawWithoutChecks(tmxTileTextureRegion, tmxTile.getTileX(), tmxTile.getTileY(), tileWidth, tileHeight, Color.WHITE_PACKED);
==>
this.drawWithoutChecks(tmxTileTextureRegion, tmxTile.getTileX(), tmxTile.getTileY(), tileWidth, tileHeight, Color.WHITE_ABGR_PACKED_FLOAT);

AndEngineExamples

org/andengine/examples/HullAlgorithmExample.java

private float[] mMeshVertices = new float[] {
0, 100, Color.WHITE_PACKED,
-100, -100, Color.WHITE_PACKED,
0, 0, Color.WHITE_PACKED,
100, -100, Color.WHITE_PACKED
};
===>
private float[] mMeshVertices = new float[] {
0, 100, Color.WHITE_ABGR_PACKED_FLOAT,
-100, -100, Color.WHITE_ABGR_PACKED_FLOAT,
0, 0, Color.WHITE_ABGR_PACKED_FLOAT,
100, -100, Color.WHITE_ABGR_PACKED_FLOAT
};

and

newMeshVertices[newMeshVertices.length - 1] = Color.WHITE_PACKED;
===>
newMeshVertices[newMeshVertices.length - 1] = Color.WHITE_ABGR_PACKED_FLOAT;

IndexOutOfBoundsException

I get the following error while continuously calling onTap() (by tapping the screen)

02-27 15:40:12.258: E/AndroidRuntime(29378): FATAL EXCEPTION: UpdateThread
02-27 15:40:12.258: E/AndroidRuntime(29378): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
02-27 15:40:12.258: E/AndroidRuntime(29378): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
02-27 15:40:12.258: E/AndroidRuntime(29378): at java.util.ArrayList.get(ArrayList.java:304)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.util.modifier.ModifierList.onUpdate(ModifierList.java:56)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.entity.Entity.onManagedUpdate(Entity.java:1266)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.entity.sprite.AnimatedSprite.onManagedUpdate(AnimatedSprite.java:114)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.entity.Entity.onUpdate(Entity.java:1040)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.entity.Entity.onManagedUpdate(Entity.java:1276)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.entity.scene.Scene.onManagedUpdate(Scene.java:285)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.entity.Entity.onUpdate(Entity.java:1040)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.engine.Engine.onUpdateScene(Engine.java:563)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.engine.Engine.onUpdate(Engine.java:558)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.engine.Engine.onTickUpdate(Engine.java:520)
02-27 15:40:12.258: E/AndroidRuntime(29378): at org.andengine.engine.Engine$UpdateThread.run(Engine.java:784)

This is also a stack trace from a market report (unobfuscated) - i believe it is the same

java.lang.IndexOutOfBoundsException: Invalid index 14, size is 2
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
at java.util.ArrayList.get(ArrayList.java:311)
at org.andengine.entity.Entity.boolean hasParent()(Unknown Source)
void setAlpha(float)
boolean detachChild(org.andengine.entity.IEntity)

float[] convertSceneToLocalCoordinates(float,float)
void onManagedDraw(org.andengine.opengl.util.GLState,org.andengine.engine.camera.Camera)
at org.andengine.entity.scene.Scene.void onManagedDraw(org.andengine.opengl.util.GLState,org.andengine.engine.camera.Camera)(Unknown Source)
at org.andengine.entity.Entity.void onUpdateColor()(Unknown Source)
void setVisible(boolean)
boolean isCulled(org.andengine.engine.camera.Camera)
void setParent(org.andengine.entity.IEntity)
void setPosition(float,float)
void registerEntityModifier(org.andengine.entity.modifier.IEntityModifier)
void onDraw(org.andengine.opengl.util.GLState,org.andengine.engine.camera.Camera)
void onUpdate(float)
void toString(java.lang.StringBuilder)at org.andengine.engine.Engine.void start()(Unknown Source)
void setScene(org.andengine.entity.scene.Scene)
void setSurfaceSize(int,int)
void setTouchController(org.andengine.input.touch.controller.ITouchController)
void registerUpdateHandler(org.andengine.engine.handler.IUpdateHandler)
boolean onTouchEvent(org.andengine.input.touch.TouchEvent)
void onDrawFrame(org.andengine.opengl.util.GLState)
org.andengine.engine.options.EngineOptions access$0(org.andengine.engine.Engine)
at com.example.livewallpaper.Example$1.void onDrawFrame(org.andengine.opengl.util.GLState)(Unknown Source)
com.apprsd.livewallpaper.Example access$0(com.apprsd.livewallpaper.Example$1)
at org.andengine.opengl.view.EngineRenderer.void onDrawFrame(javax.microedition.khronos.opengles.GL10)(Unknown Source)
at org.andengine.extension.opengl.GLThread.void guardedRun()(Unknown Source)
at org.andengine.extension.opengl.GLThread.void run()(Unknown Source)

Unhandled event loop exception. CPU may be pegged. trying again.

I'm having this error where my Live Wallpaper freezes randomly. Sometimes it takes a few minutes, sometimes when the phone wakes or I do something fast.
I've been looking for this and found others with similar problems like this one:

http://stackoverflow.com/questions/5814002/cpu-may-be-pegged-opengl-live-wallpaper-locks-up

It pointed me to those 2 links:

markfguerra/GLWallpaperService#7

markfguerra/GLWallpaperService#11

Is it possible that we have the same issues as them?

Stack trace:

java.lang.NullPointerException
at com.android.ddmuilib.logcat.LogCatPanel$WrappingToolTipSupport.createViewerToolTipContentArea(LogCatPanel.java:904)
at org.eclipse.jface.viewers.ColumnViewerToolTipSupport.createToolTipContentArea(ColumnViewerToolTipSupport.java:104)
at org.eclipse.jface.window.ToolTip.toolTipShow(ToolTip.java:359)
at org.eclipse.jface.window.ToolTip.toolTipOpen(ToolTip.java:483)
at org.eclipse.jface.window.ToolTip.toolTipCreate(ToolTip.java:348)
at org.eclipse.jface.window.ToolTip.access$2(ToolTip.java:342)
at org.eclipse.jface.window.ToolTip$ToolTipOwnerControlListener.handleEvent(ToolTip.java:631)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

Logcat:

03-07 09:32:21.094: W/SharedBufferStack(10571): waitForCondition(LockCondition) timed out (identity=3909, status=0). CPU may be pegged. trying again.

IOrientationListener initialization bug?

Hello there,

Just some thing I've noticed while developing my app: Sometimes the OrientationListener just doesn't initialize that well. It doesn't really work correctly at all sometimes. i.e. when tilting it to the right (change of roll) it doesn't recognize that correctly. After restarting the app (finish() and then start it again) normally everything is back to normal and works).

Which leads me to the question:

Is the OrientationSensor stuff being calibrated on each startup (maybe this causes this problem?)? But I don't really think so. Maybe it's a hardware bug on my side.

s4ke

the FPS is around 7-8 at ParticleSystem Examples

I think there is something wrong with the ParticleSystem in GLES2 version of the AndEngine. Even i run the AndEngineExamples project on my phone, i see the FPS is around 7-8 at ParticleSystem examples.

java.lang.RuntimeException: eglSwapBuffers failed

Getting this very often (but still intermittently)

Comes in a few flavours

java.lang.RuntimeException: eglSwapBuffers failed: EGL_SUCCESS
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1085)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1043)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1369)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1123)

Similarly, the following:

java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1079)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1037)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1342)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

And another:

java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_CURRENT_SURFACE
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1142)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1100)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1440)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1180)

BuildConfig cannot be resolved to a variable

I imported AndEngine from git (gles2) but Eclipse shows many errors:

  1. gen folder is missing (ok I added this manually)
  2. Buildconfig cannot be resolved to a variable (this error occurs many times)
  3. The container 'Library Projects' references non existing library 'XXXX/git/AndEngine/bin/andengine.jar' (xxxx is a path)
  4. The import org.andengine.BuildConfig cannot be resolved (this error occurs many times)

FontUtils measures some characters incorrectly

Some characters, it seems punctuation symbols in particular, do not have their width's measured correctly by FontUtils.

Expected result: Red rectangle lines up with text width.

Actual result: Perfect for the first string ("TEST"), but too short for the second string ("TEST.").

Text t = new Text(100f, 100f, theme.getMainFont().getFont(), "TEST", getVertexBufferObjectManager());
Rectangle r = new Rectangle(ct.getX(), ct.getY(), ct.getWidth(), ct.getHeight(), getVertexBufferObjectManager());
r.setColor(Color.RED);

scene.attachChild(r);
scene.attachChild(t);

t = new Text(100f, 100f, theme.getMainFont().getFont(), "TEST.", getVertexBufferObjectManager());
r = new Rectangle(ct.getX(), ct.getY(), ct.getWidth(), ct.getHeight(), getVertexBufferObjectManager());
r.setColor(Color.RED);

scene.attachChild(r);
scene.attachChild(t);

Back Button

First Thanks a lot for this awesome Engine, it helped me very much
Second,
i have used the onKeyDown to handle the back button to pause my game :

if((pKeyCode == KeyEvent.KEYCODE_MENU || pKeyCode == KeyEvent.KEYCODE_BACK  && pEvent.getAction() == KeyEvent.ACTION_DOWN) )
    {
        handlePausing();
    }

the menu button worked fine , but the back button exits the game not pause? how i can solve it

ChangeableText is gone, Text crashes

Hello there,

I've switched back to the GLES2 version and now that ChangeableText is gone, I am using Text, but this seems to make the game crash. I don't know when and why, but I will investigate if it's not a misusage of Text that causes crashing. Or to make it precise: Should setText(...) be used on Text objects? Because I get an ArrayIndexOutOfBounds Exception because of that.

01-28 20:47:40.453: E/AndroidRuntime(29893): FATAL EXCEPTION: UpdateThread
01-28 20:47:40.453: E/AndroidRuntime(29893): java.lang.ArrayIndexOutOfBoundsException
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.entity.text.Text$HighPerformanceTextVertexBufferObject.onUpdateVertices(Text.java:543)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.entity.text.Text.onUpdateVertices(Text.java:330)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.entity.text.Text.setText(Text.java:226)
01-28 20:47:40.453: E/AndroidRuntime(29893): at de.hotware.blockbreaker.android.BlockBreakerActivity$2.onTimePassed(BlockBreakerActivity.java:331)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.engine.handler.timer.TimerHandler.onUpdate(TimerHandler.java:83)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.engine.handler.UpdateHandlerList.onUpdate(UpdateHandlerList.java:47)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.entity.Entity.onManagedUpdate(Entity.java:1269)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.entity.scene.Scene.onManagedUpdate(Scene.java:286)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.entity.Entity.onUpdate(Entity.java:1040)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.engine.Engine.onUpdateScene(Engine.java:563)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.engine.Engine.onUpdate(Engine.java:558)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.engine.Engine.onTickUpdate(Engine.java:520)
01-28 20:47:40.453: E/AndroidRuntime(29893): at org.andengine.engine.Engine$UpdateThread.run(Engine.java:784)

Weird Text Bug - Maybe Issue #33

I think the issue #33 may not be 100% fixed. I am having the same problem where old letters are being displayed on top or after a text (TickerText in my case) after it has been set to a new string. This occurs when the string is smaller or even larger than the previous string, with random letters appearing in the same space as the new letter.
I have checked that there is nothing wrong with the actual string by outputting it to the log.
Also, the problem is possibly occuring more often when the tick speed is higher (i.e. 60 instead of 15).

Here are some screen shots:
http://i1062.photobucket.com/albums/t500/bhecox65/Starscape/textbug1.png
http://i1062.photobucket.com/albums/t500/bhecox65/Starscape/textbug2.png
http://i1062.photobucket.com/albums/t500/bhecox65/Starscape/textbug3.png

Alpha Broken

The example EntityModifierExample only shows black box, and always you use alpha.

Edit: The broken modifier is AlphaModifier
Edit2: It seems that all alpha is broken.

Compass/Orientation bug

Hi, I found a bug appearing when I use compass.

First I add compass in my app:

@Override
    public void onLoadComplete() {
        this.enableOrientationSensor(this);
    }

Then implement method "onOrientationChanged"

@Override
    public void onOrientationChanged(OrientationData pOrientationData) {
pOrientationData

pOrientationData.getYaw() //compass
pOrientationData.getPitch() //one orientation axis
pOrientationData.getRoll() //other orientation axis

}

Then there is a problem which happens spontaneously and SOMETIMES.
I don't know how to provoke the bug yet (except of many attempts to restart the app until success).

The bug has 3 symptoms:

  1. Compass returns wrong direction - 90 degrees different from correct.
  2. "Pitch" function returns Roll values
  3. "Roll" function returns Pitch values

(Samsung Galaxy S GTI-9000)

This is it.

ChangeableText missing

Now the Changeable Text is missing, or is there an other Implementation to use instead?

Black screen ( no textures on initialization )

EDIT: Originally I posted this problem without digging into it and have found out where the problem stems from and what the effects are.

The problem is simply initial textures are not appearing on the screen. Anything that would be attached during the activity launch, for example a background image, would be invisible. It is apparent that the sprites are being drawn, the resources are just missing.

After some snooping around I've come up with some behaviour that I'm sure is the cause of this problem. Here's a link to the post regarding what I've come up with so far for this problem: http://www.andengine.org/forums/gles2/resume-activity-no-texture-reload-maybe-a-bug-t6167.html#p27523

Examples don't compile

I cloned a new fresh AndEngineExample and have some errors.

ex:
import org.andengine.input.sensor.accelerometer.AccelerometerData;
import org.andengine.input.sensor.accelerometer.IAccelerometerListener;

replace every "accelerometer" by "acceleration" and every "Accelerometer" by "Acceleration"

Search "accelerometer" (18 hits in 9 files)
Search "Accelerometer" (90 hits in 9 files)

After that i have "The type BoundCameraExample must implement the inherited abstract method IAccelerationListener.onAccelerationAccuracyChanged(AccelerationData)"

Eclipse Quick fix worked for that

All engine is reinitialized after unlock the device

When you press power button in game the device locks and after unlock it with power button AndEngine reinitialize the whole game and resources and all the level progress is lost. (When you use "home button" and return to the game all the game is on the last state and progress is saved). Is it possible to prevent reinitializing of resources (if android doesn't kill the activity)? (there is a way to save the state with xml\json etc but i think it is not the best solution).

setAlpha in Entity.java

I found that "setAlpha" works incorrect for Particles with AlphaParticleInitializer. It's better to remove IF condition like this:

WAS:

@OverRide
public void setAlpha(final float pAlpha) {
if(this.mColor.setAlphaChecking(pAlpha)) {
this.onUpdateColor();
}
}

SHOULD BE:

@OverRide
public void setAlpha(final float pAlpha) {
this.mColor.setAlphaChecking(pAlpha);
this.onUpdateColor();
}

strange sprites transparency

Hi

I found a strange problem about textures.

To demonstrate it I've created the next two textures:
1 - some complex image
http://jfixbi.files.wordpress.com/2012/01/mid_1.png

2 - a rectangle, filled with the next color:
http://jfixbi.files.wordpress.com/2012/01/front_11.png

Simple code:

protected Scene onCreateScene() {

            this.mEngine.registerUpdateHandler(new FPSLogger());
            this.mScene = new Scene();

            Sprite mountains = new Sprite(0, 0, this.mid_1_png);
            Sprite rectangle = new Sprite(0, 0, this.front_11_png);

            mScene.attachChild(mountains);
            mScene.attachChild(rectangle);

            return mScene;
    }

Here is the result:

http://jfixbi.files.wordpress.com/2012/01/sc20120118-002245.png

Looks like the mountains is visible through the rectangle (in the left part of the image).

Maybe It is hard to see so I increase contrast to get something like this:

http://jfixbi.files.wordpress.com/2012/01/sc20120117-202930_cnt.png

RectangularShapeCollisionChecker.checkContains doesn't work properly with Entity as param

I have class which extends Entity and implements Scene.ITouchArea.
My implementation of method ITouchArea.contains(float pX, float pY) returns result of

RectangularShapeCollisionChecker.checkContains(this, 500, 500, pX, pY);

I think that first two params (x,y) of call

RectangularShapeCollisionChecker.fillVertices(pEntity.getX(), pEntity.getY(), pLocalWidth, pLocalHeight, ...);

should be 0,0 as it is in method checkContains with RectangularShape as param.

Multiplayer example issues

Hello there,

I have been messing around with andengine examples, i have downloaded the last version of andengine branch GLES2, exported it and tested it with 2 devices.

The first multiplayer example i tested, was the one that makes faces appear when you touch, but when i connected both devices, no faces appeared in phones.

The other one, the pong example, worked better, but i had to click connect fast or the example would close if the ball reaches the other side. Also, when both players are playing, it closes randomly, from 15 seconds to 50, maybe due to wifi packet loss(I was testing it using a third device as ad hoc).

I would like to use the andengine multiplayer extension, and i would like to know the limits of this extension and how much would i have to work on it to have it functional.

Moving touch area with camera

I had an issue where I was moving the camera, and adding sprites to the scene. I registered those sprites as touch areas, however the touch listener was not being called. The CameraScene class is translating the CameraScene coordinates in to screen coordinates, and hence not registering the touches on the sprites that had been registered 'off screen'.

The code is in org.anddev.andengine.engine.camera.Camera, line 313:

public void convertSceneToCameraSceneTouchEvent(final TouchEvent pSceneTouchEvent) {

        this.unapplySceneRotation(pSceneTouchEvent);

        this.applySceneToCameraSceneOffset(pSceneTouchEvent);

        this.applyCameraSceneRotation(pSceneTouchEvent);
}

I added a boolean flag to the camera class to switch this on and off, and it seems to work fine. Related form post here: http://www.andengine.org/forums/gles1/registered-toucharea-moves-with-camera-t5018.html

Add body from one Physicsworld to another in andengine

I have a gaming Issue :

I have two Physicsworld :

  1. It has no gravity
  2. It has Gravity

I like to Do:

I want to use the gravity of the 2nd World to drop the object from something and then disconnect from it's world and connect to the 1st world ...

I need exact as I described above to accomplish my need ...

so how can I add one body from one PhysicsWorld to Another in Android ???

-Thanks for Viewing

NullPointerException in AnimatedSprite

I think there is some issue with this line of code in class AnimatedSprite:

this.mAnimationListener.onPerformedFrameAnimation(currentFrameIndex);

It would be better to check if this.mAnimationListener is null or not, when calling onPerformedFrameAnimation. Otherwise, NullPointerException might be thrown.

registerTouchArea Bug

if you run this code. x will be equal to 2 instead of 1

int x=0;
Sprite mSprite = new Sprite(0,0,Textures,new VertexBufferObjectManager())   {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float pTouchAreaLocalX, float pTouchAreaLocalY){
                if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_UP)
                          x++;
                return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
            }};
registerTouchArea(mSprite);
registerTouchArea(mSprite);

Text whitespace stripping is wrong. Displays previous trailing characters when setting to a shorter String

Reported by @sjvc :

This is the code:

Text text1 = new Text(2, 100, myFont, "ThisIsTextWithoutWhiteSpaces", this.getVertexBufferObjectManager());
text1.setText("This has white spaces");
myScene.attachChild(text1);

Text text2 = new Text(2, 200, myFont, "This has white spaces", this.getVertexBufferObjectManager());
myScene.attachChild(text2);

This screenshot shows "weird result": http://i39.tinypic.com/9lehj4.png
This screenshot shows expected result after remove "if(!letter.isWhitespace())": http://i41.tinypic.com/xdxx5v.png

I don't know the correct way to solve it

Texture+Body shaking

Hi.

There is serious issue when we use PhysicalWorld: bodies has problems with updating sprites positions.
That's why moving sprites perform "jumping" during movement.

Looks like a general bug (in architecture) appearing because of difference in time intervals inside onUpdate for the Engine and for the World. Probably it is necessary to redesign the way of using the Box2d.

Here is the code to demonstrate the bug. The flowing is a modification of the FixedStepPhysics example.
I removed walls and add one body falling in the gravity field.

There you can see how the sprite is jumping during movement.

Also it demonstrates the "velocity=double-frame-rate" bug ( see: nicolasgramlich/AndEnginePhysicsBox2DExtension#3 ).

package org.andengine.examples;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.handler.IUpdateHandler;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.Scene.IOnSceneTouchListener;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.sprite.AnimatedSprite;
import org.andengine.entity.util.FPSLogger;
import org.andengine.extension.physics.box2d.FixedStepPhysicsWorld;
import org.andengine.extension.physics.box2d.PhysicsConnector;
import org.andengine.extension.physics.box2d.PhysicsFactory;
import org.andengine.extension.physics.box2d.PhysicsWorld;
import org.andengine.extension.physics.box2d.util.Vector2Pool;
import org.andengine.input.sensor.acceleration.AccelerationData;
import org.andengine.input.sensor.acceleration.IAccelerationListener;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.TiledTextureRegion;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import org.andengine.util.debug.Debug;

import android.hardware.SensorManager;
import android.widget.Toast;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.FixtureDef;

/**

  • (c) 2010 Nicolas Gramlich (c) 2011 Zynga

  • @author Nicolas Gramlich

  • @SInCE 18:47:08 - 19.03.2010
    */
    public class PhysicsFixedStepExample extends SimpleBaseGameActivity implements
    IUpdateHandler {
    // ===========================================================
    // Constants
    // ===========================================================

    private static final int CAMERA_WIDTH = 720;
    private static final int CAMERA_HEIGHT = 480;

    // ===========================================================
    // Fields
    // ===========================================================

    private BitmapTextureAtlas mBitmapTextureAtlas;

    private TiledTextureRegion mBoxFaceTextureRegion;
    private TiledTextureRegion mCircleFaceTextureRegion;

    private Scene mScene;

    private PhysicsWorld mPhysicsWorld;
    private int mFaceCount = 0;

    // ===========================================================
    // Constructors
    // ===========================================================

    // ===========================================================
    // Getter & Setter
    // ===========================================================

    // ===========================================================
    // Methods for/from SuperClass/Interfaces
    // ===========================================================

    Camera camera;

    @OverRide
    public EngineOptions onCreateEngineOptions() {
    camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
    new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
    }

    @OverRide
    public void onCreateResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    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();
    

    }

    @OverRide
    public Scene onCreateScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    this.mScene = new Scene();
    this.mScene.setBackground(new Background(0, 0, 0));
    
    this.mPhysicsWorld = new FixedStepPhysicsWorld(30, new Vector2(0,
            SensorManager.GRAVITY_EARTH), false, 3, 2);
    
    this.mScene.registerUpdateHandler(this.mPhysicsWorld);
    
    this.mScene.registerUpdateHandler(this);
    
    final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(1,
            0.5f, 0.5f);
    
    face = new AnimatedSprite(100, 100, this.mBoxFaceTextureRegion,
            this.getVertexBufferObjectManager());
    body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face,
            BodyType.DynamicBody, objectFixtureDef);
    
    face.animate(200);
    
    this.mScene.attachChild(face);
    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face,
            body, true, true));
    camera.setChaseEntity(face);
    
    return this.mScene;
    

    }

    private void addFace(final float pX, final float pY) {
    this.mFaceCount++;
    Debug.d("Faces: " + this.mFaceCount);

    final AnimatedSprite face;
    final Body body;
    
    final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(1,
            0.5f, 0.5f);
    
    if (this.mFaceCount % 2 == 0) {
        face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face,
                BodyType.DynamicBody, objectFixtureDef);
    } else {
        face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face,
                BodyType.DynamicBody, objectFixtureDef);
    }
    
    face.animate(200);
    
    this.mScene.attachChild(face);
    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face,
            body, true, true));
    

    }

    AnimatedSprite face;
    Body body;
    private Vector2 v;
    long t;

    @OverRide
    public void onUpdate(float pSecondsElapsed) {
    // TODO Auto-generated method stubbody
    if (System.currentTimeMillis() - t > 2000) {
    t = System.currentTimeMillis();

        v = body.getLinearVelocity();
        Debug.e("linear speed Vx=" + v.x + " Vy=" + v.y);
    }
    

    }

    @OverRide
    public void reset() {
    }
    // ===========================================================
    // Inner and Anonymous Classes
    // ===========================================================
    }

Color utils doesn't work

When using this import: import "org.andengine.util.color.Color;" The code does't work, but when using this "android.graphics.Color" works perfectly

/* Load the font we are going to use. */
FontFactory.setAssetBasePath("font/");
final ITexture plokFontTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
Game.this.mDefaultFont = FontFactory.createFromAsset(this.getFontManager(), plokFontTexture, this.getAssets(), "Plok.ttf", 32f, true, Color.WHITE);
Game.this.mDefaultFont.load();

And gets this message:
The method createFromAsset(FontManager, ITexture, AssetManager, String, float, boolean, int) in the type FontFactory is not applicable for the arguments (FontManager, ITexture, AssetManager, String, int, boolean, Color)

displaying distance between 2 sprites when moving camera

I have for my game several sprites with physic bodies for the ground on which the player is running. when i stand still the sprites are displayed correctly nearby each other without distance. But when i move the player and the camera followes the player ther always are distances shown between the sprites.
I have tried all variations of textureoptions and distances in the atlas but nothing fixed the problem.

I have uploaded some screen shots in the forum of andengine at topic:

http://www.andengine.org/forums/bugs-gles2/showing-distance-between-sprites-when-camera-moves-t7105.html

OnResume() don't call OnResumeGame()

In the method onPause() of class BaseGameActivity call the method onPauseGame(), which stop the engine, however, the method onResume() does not call onResumeGame() and therefore the engine is stopped, and therefore the game is blocked.

I tried overwriting the onPause () with:

onResume public void () {
super.onResume ();

if (isGamePaused ())
onResumeGame ();
}

and now works fine.

IndexOutOfBoundsException (Entity.java)

File: master:src/org/anddev/andengine/entity/Entity.java
Issue: When having an AnimatedSprite bounce around in a PhysicsWorld by setting gravity and turning the device, sometimes it will FC throwing an IndexOutOfBoundsException to the logcat.
Expected: Not to have this issue

Temporary Patch: http://pastebin.com/d1kExwzB

I don't believe this is the best way to fix it since there is an underlying cause. This is just a band-aid. However, it works for my needs currently, and I am strapped for time otherwise I would dig deeper. I haven't checked to see if this is fixed on the GLES2 branch.

[Bug] Nullpointer Exception in BaseGameActivity?

Hello there. Sometimes it occurs that in BaseGameActivity this part here:

@Override
   public void onResumeGame() {
      Debug.d(this.getClass().getSimpleName() + ".onResumeGame" + " @(Thread: '" + Thread.currentThread().getName() + "')");

      this.mEngine.start();

      this.mGamePaused = false;
   }

is being executed without mEngine being initialized (at game startup).

sake

Gravity force problem

There is a strange problem: looks like a sum of two equal forces with opposite directions is not equal to zero.

First of all I use FixedStepPhysics example.
Then I change it for to I apply a force on a single body.

The force is equal but fully opposite to the gravity.

[syntax="java"]

...
this.mPhysicsWorld = new FixedStepPhysicsWorld(30, new Vector2(0,
            10f), false, 3, 2);

...
}

.....
Vector2 Launch = new Vector2(0, -10f);
Vector2 Rocket = new Vector2(0, 0);

@Override
public void onUpdate(float pSecondsElapsed) {
    // TODO Auto-generated method stub
    if (go) {
        Rocket = body.getPosition();
        body.applyForce(Launch, Rocket);
    }
}

[/syntax]

So, when I run the example the body flies UP.
Moreover It is necessary to apply about Š° "Launch = new Vector2(0, -10f*0.41Š°);" force
to get the zero-gravity state for the body.

So basically, assuming that the engine works fine we conclude that 0.41f = 1f :)

Here is the full code of the activity, so you can check if I'm wrong:

[syntax="java"]
package com.jfixbi.red_baron.physics_test;

import org.andengine.engine.handler.IUpdateHandler;
import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.Scene.IOnSceneTouchListener;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.sprite.AnimatedSprite;
import org.andengine.entity.util.FPSLogger;

import org.andengine.extension.physics.box2d.FixedStepPhysicsWorld;
import org.andengine.extension.physics.box2d.PhysicsConnector;
import org.andengine.extension.physics.box2d.PhysicsFactory;
import org.andengine.extension.physics.box2d.PhysicsWorld;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.TiledTextureRegion;

import org.andengine.util.debug.Debug;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;import android.widget.Toast;

public class RB_Physics_testActivity extends BaseExample implements
IOnSceneTouchListener, IUpdateHandler {
// ===========================================================
// Constants
// ===========================================================

private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;

// ===========================================================
// Fields
// ===========================================================

private BitmapTextureAtlas mBitmapTextureAtlas;

private TiledTextureRegion mBoxFaceTextureRegion;
private TiledTextureRegion mCircleFaceTextureRegion;

private Scene mScene;

private PhysicsWorld mPhysicsWorld;
private int mFaceCount = 0;

@Override
public EngineOptions onCreateEngineOptions() {
    Toast.makeText(this, "Touch the screen to add objects.",
            Toast.LENGTH_SHORT).show();
    Toast.makeText(
            this,
            "The difference to the normal physics example is that here the simulation steps have a fixed size, which makes the simuation reproduceable.",
            Toast.LENGTH_LONG).show();

    final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
            new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
}

@Override
public void onCreateResources() {
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");

    this.mBitmapTextureAtlas = new BitmapTextureAtlas(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());
}

@Override
public Scene onCreateScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    this.mScene = new Scene();
    this.mScene.setBackground(new Background(0, 0, 0));
    this.mScene.setOnSceneTouchListener(this);

    this.mPhysicsWorld = new FixedStepPhysicsWorld(30, new Vector2(0,
            10f), false, 3, 2);

    final Rectangle ground = new Rectangle(0, CAMERA_HEIGHT - 2,
            CAMERA_WIDTH, 2);
    final Rectangle roof = new Rectangle(0, 0, CAMERA_WIDTH, 2);
    final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT);
    final Rectangle right = new Rectangle(CAMERA_WIDTH - 2, 0, 2,
            CAMERA_HEIGHT);

    final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0,
            0.5f, 0.5f);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground,
            BodyType.StaticBody, wallFixtureDef);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof,
            BodyType.StaticBody, wallFixtureDef);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, left,
            BodyType.StaticBody, wallFixtureDef);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, right,
            BodyType.StaticBody, wallFixtureDef);

    this.mScene.attachChild(ground);
    this.mScene.attachChild(roof);
    this.mScene.attachChild(left);
    this.mScene.attachChild(right);

    this.mScene.registerUpdateHandler(this.mPhysicsWorld);
    this.mScene.registerUpdateHandler(this);

    this.addFace(this.CAMERA_WIDTH / 2, this.CAMERA_HEIGHT / 2);

    return this.mScene;
}

boolean go = false;
long last = 0;

@Override
public boolean onSceneTouchEvent(final Scene pScene,
        final TouchEvent pSceneTouchEvent) {
    if (this.mPhysicsWorld != null) {
        if (pSceneTouchEvent.isActionDown()) {
            if (System.currentTimeMillis() - last > 20) {
                last = System.currentTimeMillis();
                go = !go;

            }

            return true;
        }
    }
    return false;
}


@Override
public void onPauseGame() {
    super.onPauseGame();

    this.disableAccelerometerSensor();
}


Body body;

private void addFace(final float pX, final float pY) {
    this.mFaceCount++;
    Debug.d("Faces: " + this.mFaceCount);

    final AnimatedSprite face;

    final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(1,
            0.5f, 0.5f);

    if (this.mFaceCount % 2 == 0) {
        face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion);
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face,
                BodyType.DynamicBody, objectFixtureDef);
    } else {
        face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion);
        body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face,
                BodyType.DynamicBody, objectFixtureDef);
    }

    face.animate(200);

    this.mScene.attachChild(face);
    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face,
            body, true, true));
}

Vector2 Launch = new Vector2(0, -10f);
Vector2 Rocket = new Vector2(0, 0);

@Override
public void onUpdate(float pSecondsElapsed) {
    // TODO Auto-generated method stub
    if (go) {
        Rocket = body.getPosition();
        body.applyForce(Launch, Rocket);
    }
}

@Override
public void reset() {
    // TODO Auto-generated method stub

}

}

[/syntax]

AndEngineExamples don't compile

Just cloned the latest and the examples don't compile. The issue is because you made a change to the textures where they take the texturemanager as a paramater.

My issue is bigger than this change though, since you have a single branch in your project every change you make has the possibility of breaking everything. The preferred solution here is to have multiple branches in for both AndEngine and the examples (a stable and a dev branch). Please branch your project to have a stable release that we (external developers) can rely on without issue and a branch for yourself where you make bugfixes/major changes and push to the stable as needed.

java.lang.UnsatisfiedLinkError: Library andengine not found

This occurs on particular devices. I'm guessing the native library for the chipset can't be found?
It's not proguard or anything like that, it's a native library not being found.

These are the devices I've found so far:
Fujitsu Toshiba REGZA Phone T01C(tg03)

Pantech Vega X(ef14l)
Pantech IS06(jmasai)

And here's the stack trace:
java.lang.ExceptionInInitializerError
at org.andengine.opengl.vbo.HighPerformanceVertexBufferObject.onBufferData(SourceFile:71)
at org.andengine.opengl.vbo.VertexBufferObject.bind(SourceFile:152)
at org.andengine.entity.sprite.Sprite.preDraw(SourceFile:170)
at org.andengine.entity.Entity.onManagedDraw(SourceFile:1227)
at org.andengine.entity.Entity.onDraw(SourceFile:1033)
at org.andengine.entity.Entity.onManagedDraw(SourceFile:1256)
at org.andengine.entity.scene.Scene.onManagedDraw(SourceFile:262)
at org.andengine.entity.Entity.onDraw(SourceFile:1033)
at org.andengine.engine.camera.Camera.onDrawHUD(SourceFile:268)
at org.andengine.engine.Engine.onDrawFrame(SourceFile:589)
at org.andengine.opengl.view.EngineRenderer.onDrawFrame(SourceFile:104)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1334)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
Caused by: java.lang.UnsatisfiedLinkError: Library andengine not found
at java.lang.Runtime.loadLibrary(Runtime.java:461)
at java.lang.System.loadLibrary(System.java:557)
at org.andengine.opengl.util.BufferUtils.(SourceFile:17)
... 13 more
java.lang.UnsatisfiedLinkError: Library andengine not found
at java.lang.Runtime.loadLibrary(Runtime.java:461)
at java.lang.System.loadLibrary(System.java:557)
at org.andengine.opengl.util.BufferUtils.(SourceFile:17)
at org.andengine.opengl.vbo.HighPerformanceVertexBufferObject.onBufferData(SourceFile:71)
at org.andengine.opengl.vbo.VertexBufferObject.bind(SourceFile:152)
at org.andengine.entity.sprite.Sprite.preDraw(SourceFile:170)
at org.andengine.entity.Entity.onManagedDraw(SourceFile:1227)
at org.andengine.entity.Entity.onDraw(SourceFile:1033)
at org.andengine.entity.Entity.onManagedDraw(SourceFile:1256)
at org.andengine.entity.scene.Scene.onManagedDraw(SourceFile:262)
at org.andengine.entity.Entity.onDraw(SourceFile:1033)
at org.andengine.engine.camera.Camera.onDrawHUD(SourceFile:268)
at org.andengine.engine.Engine.onDrawFrame(SourceFile:589)
at org.andengine.opengl.view.EngineRenderer.onDrawFrame(SourceFile:104)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1334)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

Change TiledTextureRegion

I've looked into Andengine-Examples, and it suggested to change Texture itself into other TextureRegiond. However, in my

opinion, this is not a very effective way when considering the use of resource.

Is any way to change the tiledTextureRegion of animatedSprite at a time when I want?

ShaderProgramException

Someone sent me that error report of my game (Juggle The Doodle):

org.andengine.opengl.shader.exception.ShaderProgramException: Unexpected uniform: 'u_modelViewProjectionMatrix'.
at org.andengine.opengl.shader.ShaderProgram.getUniformLocation(ShaderProgram.java:99)
at org.andengine.opengl.shader.PositionColorTextureCoordinatesShaderProgram.link(PositionColorTextureCoordinatesShaderProgram.java:83)
at org.andengine.opengl.shader.ShaderProgram.compile(ShaderProgram.java:149)
at org.andengine.opengl.shader.ShaderProgram.bind(ShaderProgram.java:122)
at org.andengine.opengl.shader.PositionColorTextureCoordinatesShaderProgram.bind(PositionColorTextureCoordinatesShaderProgram.java:89)
at org.andengine.opengl.vbo.VertexBufferObject.bind(VertexBufferObject.java:150)
at org.andengine.entity.sprite.Sprite.preDraw(Sprite.java:175)
at org.andengine.entity.Entity.onManagedDraw(Entity.java:1181)
at org.andengine.entity.shape.Shape.onManagedDraw(Shape.java:123)
at org.andengine.entity.Entity.onDraw(Entity.java:1009)
at org.andengine.entity.Entity.onManagedDrawChildren(Entity.java:1203)
at org.andengine.entity.Entity.onDrawChildren(Entity.java:1195)
at org.andengine.entity.Entity.onManagedDraw(Entity.java:1185)
at org.andengine.entity.scene.Scene.onManagedDraw(Scene.java:262)
at org.andengine.entity.Entity.onDraw(Entity.java:1009)
at org.andengine.entity.scene.Scene.onManagedDraw(Scene.java:269)
at org.andengine.entity.Entity.onDraw(Entity.java:1009)
at org.andengine.engine.Engine.onDrawScene(Engine.java:560)
at org.andengine.engine.Engine.onDrawFrame(Engine.java:552)
at org.andengine.opengl.view.EngineRenderer.onDrawFrame(EngineRenderer.java:104)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

AndEngine delays the window transition animation when resuming

When resuming from a normal Activity to an AndEngine based one there is a noticeable delay in the default Android view transition. Although the AndEngine activity calls its onResume immediately, the system doesn't "pop" the old Activity off until AndEngine is able to draw the scene. On some devices this results in a delay long enough (~2 seconds) that the user believes that he/she didn't actually hit the back button and presses it again, which will pop the AndEngine activity off the stack.

This behavior is new to the OpenGL ES 2 branch, on ES 1 the normal Activity would be removed immediately and a black screen would appear before the engine was ready to draw again. I preferred the old behavior because the user's action (pressing back) was immediately recognized.

Is there anyway to prevent this delay in the ES 2 branch and force the window transition immediately?

When I press home button, AndEngine calls onPauseGame and onResumeGame at the same time. When I resume the game, onResumeGame is not called.

Running on Samsung Galaxy S2, with Android 2.3.6. When I press home button, game goes background, and AndEngine calls onPauseGame and immediately onResumeGame. When I resume the game, onResumeGame is not called.

The problem is in BaseGameActivity, when onWindowFocusChanged event is called, for some reason pHasWindowFocus is true, and onResumeGame is called.

I tried to debug, I added the "Debug.d" line:

@Override
public synchronized void onWindowFocusChanged(final boolean pHasWindowFocus) {
    super.onWindowFocusChanged(pHasWindowFocus);

    Debug.d("pHasWindowFocus:" + String.valueOf(pHasWindowFocus));

    if(pHasWindowFocus && this.mGamePaused && this.mGameCreated) {
        this.onResumeGame();
    }
}

And this is the log I get when I press home button:

02-10 20:04:47.640: D/AndEngine(29438): DoodleJuggleActivity.onPause @(Thread: 'main')
02-10 20:04:47.680: D/AndEngine(29438): DoodleJuggleActivity.onPauseGame @(Thread: 'main')
02-10 20:04:47.725: D/AndEngine(29438): pHasWindowFocus:false
02-10 20:04:47.730: D/AndEngine(29438): pHasWindowFocus:true
02-10 20:04:47.730: D/AndEngine(29438): DoodleJuggleActivity.onResumeGame @(Thread: 'main')
02-10 20:04:47.730: D/AndEngine(29438): pHasWindowFocus:false

Seems that onWindowFocusChanged is called more than once...

Please fix the SpriteTransparency bug

Just insert this code into the org.andengine.util.color.Color

//;-------------------------------------------

public static final int FF_VALUE = 0XFFFFFFFF;
public static final int VALUE_255 = 255;
public static final int VALUE_24 = 24;
public static final int VALUE_16 = 16;
public static final int VALUE_8 = 8;

private void pack() {
final int packed = ((int) (VALUE_255 * this.mAlpha) << VALUE_24)
| ((int) (VALUE_255 * this.mBlue) << VALUE_16)
| ((int) (VALUE_255 * this.mGreen) << VALUE_8)
| ((int) (VALUE_255 * this.mRed));
this.mPacked = Float.intBitsToFloat(packed & FF_VALUE);
}

public static float pack(final float pRed, final float pGreen,
final float pBlue, final float pAlpha) {
final int packed = ((int) (VALUE_255 * pAlpha) << VALUE_24)
| ((int) (VALUE_255 * pBlue) << VALUE_16)
| ((int) (VALUE_255 * pGreen) << VALUE_8)
| ((int) (VALUE_255 * pRed));
return Float.intBitsToFloat(packed & FF_VALUE);

AndEngine not supporting Galaxy 3

Hi, community!

Sorry for open issue here, but i don't know where it's write.

Problem: AndEngine is not supporting Samsung Galaxy 3 (Samsung GT-I5800). Concerns GLES1 and GLES2.
All games from Android Market has a white textures, such as Bunny Shooter and many others.

Given that this is still not quite a bad phone - I think this is a big problem. How can I help in correcting this problem? Is it possible somehow to fix?

Thanks in advance. I hope for your understanding.

P.s. I recently opened topic at forum with video and screenshots, but none has yet been able to help -> (http://www.andengine.org/forums/gles1/how-to-completly-unload-scene-and-her-resources-t5609.html)

Change remove(T) to remove(Object) in Collections

I've noticed something I don't like. The remove method which is passed a reference of an Object normally just removes the given object reference from the List. That's all. Then why do it with a Generic? The default Java Implementation does this and removing something from the list doesn't need a cast and makes code more "uncrashy". Just look at this (from my code):

                public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
                    LevelSceneHandler.this.mCue.remove((BlockSprite)pItem);
                    LevelSceneHandler.this.mBlockSpritePool.recyclePoolItem((BlockSprite) pItem);
                }

What if this code is called on an Entity that is no BlockSprite? It will cause an ClassCastException (afaik) instead of not doing anything (which is imo better in this case). And I don't have to use an useless cast.

So why not change the remove method to remove(Object) in all collections?

onAreaTouched issue

Hi Nicolas,

I'm using the source code compiled AndEngine to develop a game. But I found it seems onAreaTouched on Sprite has problem.
My game will add about 30 new sprites in that event once touch a special Sprite, but the problem is the screen will hangup when I tapped about 15 times on it.

I checked the TouchDragExample.java in the AndEngineExamples project, found it also show below msg in log when tap that sprite. Is that normal?

03-21 15:25:19.534: V/AndEngine(17152): org.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 0 item not yet recycled. Allocated 1 more.
03-21 15:25:19.534: V/AndEngine(17152): org.andengine.util.adt.pool.PoolUpdateHandler$1 was exhausted, with 0 item not yet recycled. Allocated 1 more.

--Updated later
On my another machine, I kept a copy of your source code about 7 weeks ago (labeled as "Bad-ass package refactoring org.anddev.util and related classes/packages (only moved classes around so their new package makes more sense). SortedQueue is now a wrapper encapsulating another IQueue, instead of being a subclass to another specific Queue implementation -> allows for better reusability without duplicating code."). I can ran my same code successfully based on it, although I still can find above msg, but it just appear occasionally.

Hope the new finding are helpful.

Thanks & Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.