Android AndEngine关于触摸事件的问题

发布于 2024-11-07 12:41:46 字数 15163 浏览 0 评论 0原文

我正在学习 andEngine 并尝试根据一些示例制作一个简单的游戏。我的问题是游戏在某些随机时刻停止,我只能使用后退按钮;/我使用 logcat 并发现问题,日志如下:

/释放键'

I/DEBUG (2656): pid: 4918, tid: 第4926章com.homework.mygame <<< I/DEBUG (2656):信号 11 (SIGSEGV),代码 1 (SEGV_MAPERR),故障 地址 3f8191d 4 I/调试(2656):r0 00000000 r1 00000000 r2 3f800000 r3 000191d4 I/调试(2656):r4 00140a30 r5 00149978 r6 449d9b18 r7 44dbe008 I/调试(2656):r8 449d9b6c r9 43707d58 10 43707d40 FP 449d9ed8

I/DEBUG (2656): ip 00000000 sp 449d9b00 lr 8062eeb8 电脑 806189b8 cpsr 600 00010 I/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 3 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 3 件物品尚未回收。分配 1 更多的 。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 4 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 4 件物品尚未回收。分配 1 更多的 。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 5 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 5 件物品尚未回收。分配 1 更多的 。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 6 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 6 件物品尚未回收。分配 1 更多的 。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 7 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 7 件物品尚未回收。分配 1 更多的 。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 8 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 8 件物品尚未回收。分配 1 更多的 。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 9 项 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 9 件物品尚未回收。分配 1 更多的 。 D/dalvikvm(929):克洛诺斯 GC_EXTERNAL_ALLOC 释放了 166K,55% 空闲 2686K/5895K,外置905K/987K, 暂停 268 毫秒 I/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 10 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 10 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 11 项 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 11 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 12 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 12 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 13 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 13 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 14 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 14 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 15 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 15 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 16 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 16 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 17 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 17 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 18 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 18 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 19 项 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 19 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 20 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 20 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 21 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 21 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 22 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 22 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 23 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 23 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 24 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 24 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 25 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 25 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 26 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 26 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 27 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 27 件物品尚未回收。分配 1 更多的。 D/dalvikvm(929):克洛诺斯 GC_EXTERNAL_ALLOC 释放 10K,55% 空闲 2686K/5895K,外接905K/927K, 暂停 294ms D/dalvikvm(929):克洛诺斯 GC_EXTERNAL_ALLOC 释放了 5K,55% 空闲 2686K/5895K,外部920K/1016K, 暂停 135 毫秒 I/DEBUG (2656):

00 pc 000189b8 /data/data/com.homework.mygame/lib

/libandenginephysicalsbox2dextension.so (_ZN6b2Body13CreateFixtureEPK12b2FixtureDe f) I/DEBUG (2656): #01 件 0000bfbc /data/data/com.homework.mygame/lib /libandenginephysicalsbox2dextension.so (Java_com_badlogic_gdx_physical_box2d_Body_ jniCreateFixture__JJFFFZSSS) I/DEBUG
(2656):#02 00011d74 /system/lib/libdvm.so I/DEBUG ( 第2656章 2656章 2656章 电脑:我/调试(2656):80618998 eb00595d e3500000 0a000001 e1a00004 我/调试(2656):806189a8 ebfffd9f e594205c e3a03a19 e2833f75 I/调试( 第2656章):806189b8 e7921003 e1a00005 e3811001 e7821003 I/调试(2656): 806189c8 e8bd81f0 e594105c e1a00005 e284200c I/调试(2656):806189d8 e2811a19 e2811f76 eb0003ae eaffffe2 我/调试(2656): 我/调试(2656): lr 周围的代码:I/DEBUG (2656): 8062ee98 e51d0004 e12fff1e e1a0c000 e1a00001 I/调试(2656):8062eea8 e1a0100c eafffff e92d400f ebffffe1 我/调试(2656):8062eeb8 e3500000 43700000 e8bd800f e52de008 I/调试( 第2656章 8062eec8 ebfffff8 03a00001 13a00000 e49df008 I/调试(2656): 8062eed8 e52de008 ebfffff3 33a00001 23a00000 I/调试(2656):I/调试
(2656):堆栈:I/DEBUG(2656):
449d9ac0 43707d58 I/调试(2656): 449d9ac4 43707d40 I/调试(2656): 449d9ac8 449d9ed8 I/调试(2656): 449d9acc 80617174 /data/data/com.homework.mygame/lib/li bandenginephysicalbox2dextension.so 我/调试(2656):449d9ad0 00149978 I/调试(2656):
449d9ad4 449d9b18 I/调试(2656): 449d9ad8 0000ffff 我/调试(2656): 449d9adc 44dbe008 I/调试(2656): 449d9ae0 00000001 I/调试(2656): 449d9ae4 00000000 I/调试(2656): 449d9ae8 00000000 I/调试(2656): 449d9aec 421cf249 I/调试(2656): 449d9af0 bf800001 I/调试(2656): 449d9af4 8062ef1c /data/data/com.homework.mygame/lib/li bandenginephysicalbox2dextension.so 我/调试(2656):449d9af8 df002777 I/调试(2656):
449d9afc e3a070ad I/调试(2656):

00 449d9b00 ffffffff I/DEBUG (2656): 449d9b04 00000000 I/DEBUG

(2656): 449d9b08 80632718 我/调试(2656):449d9b0c 43707d84 I/调试(2656):
449d9b10 449d9b6c I/调试(2656): 449d9b14 8060bfc0 /data/data/com.homework.mygame/lib/li bandenginephysicalbox2dextension.so 我/调试(2656):#01 449d9b18 80632718 I/调试(2656):
449d9b1c 0016a928 I/调试(2656): 449d9b20 00000000 I/调试(2656): 449d9b24 00000000 I/调试(2656): 449d9b28 00000000 I/调试(2656): 449d9b2c 00000000 I/调试(2656): 449d9b30 00017b00 I/调试(2656): 449d9b34 0000ffff 我/调试(2656): 449d9b38 449d9b90 I/调试(2656): 449d9b3c 00000003 I/调试(2656): 449d9b40 44843052 I/调试(2656): 449d9b44 aca11d78 /system/lib/libdvm.so I/AndEngine( 第4918章): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 28 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 28 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 29 个项目 尚未回收。又分配了1个。 D/dalvikvm(602):克洛诺斯 GC_EXTERNAL_ALLOC 释放了 257K,40% 空闲 6266K/10311K,外接1546K/1581K, 暂停 445 毫秒 I/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 29 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 30 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 30 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 31 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 31 件物品尚未回收。分配 1 更多的。我/AndEngine(4918): org.anddev.andengine.input.touch.TouchEvent$TouchEventPool 已耗尽,有 32 个项目 尚未回收。又分配了1个。 我/AndEngine(4918): org.anddev.andengine.util.pool.PoolUpdateHandler$1 已耗尽, 32 件物品尚未回收。分配 1 更多的。 D/dalvikvm(929):克洛诺斯 GC_EXTERNAL_ALLOC 释放了 11K,55% 空闲 2685K/5895K,外接726K/889K, 暂停 139ms D/dalvikvm(929):克洛诺斯 GC_EXTERNAL_ALLOC 释放 10K,55% 空闲 2686K/5895K,外接667K/749K, 暂停 140 毫秒 D/dalvikvm( 929):克洛诺斯 GC_EXTERNAL_ALLOC 释放了 5K,55% 空闲 2685K/5895K,外部920K/1016K, 暂停 138ms D/dalvikvm( 602):克洛诺斯 GC_EXTERNAL_ALLOC 释放了 32K,40% 空闲 6246K/10311K,外置1403K/1470K, 暂停 343ms I/BootReceiver( 602): 复制 /data/tombstones/tombstone_02 到 DropBox (SYSTEM_ TOMBSTONE) E/InputDispatcher(602):通道 '408f3600 com.homework.mygame/com.homework.myg ame.com.homework.mygame(服务器)'~ 消费者关闭输入通道或 发生错误。事件=0x8 E/InputDispatcher(602):通道 '408f3600 com.homework.mygame/com.homework.myg ame.com.homework.mygame(服务器)'~ 通道已不可恢复地损坏并且 将被处置! D/受精卵(565​​): 进程 4918 由信号终止 (11) D/dalvikvm(602):克洛诺斯 GC_FOR_MALLOC 释放了 123K,39% 已释放 6384K/10311K,外部958K/1470K, 暂停 141 毫秒 I/dalvikvm-heap(602): 将堆(碎片情况)增长到 9.928MB 161568字节分配D/dalvikvm( 602): Cronos GC_FOR_MALLOC 释放了 3K, 38% 免费 6538K/10503K,外部 958K/1470K,暂停147ms I/WindowManager(602):胜利死亡: 窗户{408f3600 com.homework.mygame/com.homew ork.mygame.com.homework.mygame 暂停=假}D/dalvikvm(602): Cronos GC_FOR_MALLOC 释放了 2K, 38% 免费 6537K/10503K,外部 847K/1359K,暂停143ms I/dalvikvm-heap(602):增长堆 (碎片情况)80792 字节为 9.891MB 分配D/dalvikvm(602):克罗诺斯 GC_FOR_MALLOC 已释放 <1K,38% 已释放 6615K/10631K,外接847K/1359K, 暂停 144ms D/dalvikvm(602):克洛诺斯 GC_FOR_MALLOC 释放了 217K,40% 空闲 6398K/10631K,外部847K/1359K, 暂停 142 毫秒 I/WindowManager(602): 赢得死亡:窗口{4090fff8 SurfaceView 暂停=假}D/gralloc(602): 在 0 D/gralloc 处释放 GPU 缓冲区( 602): 释放 307200 处的 GPU 缓冲区 I/ActivityManager(602):进程 com.homework.mygame (pid 4918) 有 死了。带输入管理服务(602): 收到 RemoteException 发送 setActive(false) 通知 pid 4918 uid 10088 D/dalvikvm(929): Cronos GC_EXPLICIT 释放了 9K,55% 免费 2683K/5895K,外接4个89K/889K, 暂停 68 毫秒 V/com.mobilityflow.animatedweather.services.UpdateService$ServiceThread( 929): 定时闹钟 onReceive() 开始 时间:2011-05-13 17:07:25.491 W/系统错误(929): java.net.UnknownHostException: www.yr.no W/System.err( 929): 在 java.net.InetAddress.lookupHostByName(InetAddress.jav a:506) W/System.err(929): 在 java.net.InetAddress.getAllByNameImpl(InetAddress.jav a:294) W/System.err(929): 在 java.net.InetAddress.getAllByName(InetAddress.java:25 6) W/System.err(929): 在 org.apache.http.impl.conn.DefaultClientConnectionOper ator.openConnection(DefaultClientConnectionOperator.java:136) W/System.err(929):位于 org.apache.http.impl.conn.AbstractPoolEntry.open(Abst ractPoolEntry.java:164) W/System.err( 第929章):在 org.apache.http.impl.conn.AbstractPooledConnAdapter.o 笔(AbstractPooledConnAdapter.java:119) W/System.err(929):位于 org.apache.http.impl.client.DefaultRequestDirector.ex ecute(DefaultRequestDirector.java:348) W/System.err(929):位于 org.apache.http.impl.client.AbstractHttpClient.execut e(AbstractHttpClient.java:555) W/System.err(929):位于 org.apache.http.impl.client.AbstractHttpClient.execut e(AbstractHttpClient.java:487) W/System.err(929):位于 org.apache.http.impl.client.AbstractHttpClient.execut e(AbstractHttpClient.java:465) W/System.err(929):位于 com.mobilityflow.animatedweather.weather_providers.Yr Provider.loadWeatherWeek(YrProvider.java:440) W/System.err(929):位于 com.mobilityflow.animatedweather.weather_providers.Yr Provider.providerLoadWeather(YrProvider.java:135) W/System.err(929):位于 com.mobilityflow.animatedweather.weather_providers.We atherProvider.loadWeatherData(WeatherProvider.java:125) W/System.err(929):位于 com.mobilityflow.animatedweather.WebProvider$ThreadWe atherLoad.run(WebProvider.java:256)

所以我猜这是因为 onAreaTouched 函数。我用它来控制一个玩家,有2个箭头,我们可以触摸它们从左到右移动玩家。我是正确地做还是应该以另一种方式这样做?这是我的代码

 mRArrow = new Sprite(125, CAMERA_HEIGHT - 55, mRArrowTextureRegion) {
                @Override
                protected void onManagedUpdate(float pSecondsElapsed) {

                    super.onManagedUpdate(pSecondsElapsed);
                }

                @Override
                public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                        float pTouchAreaLocalX, float pTouchAreaLocalY) {


                    Body playerBody = mPhysicsWorld.getPhysicsConnectorManager()
                        .findBodyByShape(mPlayer);

                    playerBody.setTransform(new Vector2((playerBody.getPosition().x + 0.15f) ,playerBody.getPosition().y), 0);

                    return true;
                }
             };

            mLArrow = new Sprite(15, CAMERA_HEIGHT - 55, mLArrowTextureRegion) {
                @Override
                protected void onManagedUpdate(float pSecondsElapsed) {

                    super.onManagedUpdate(pSecondsElapsed);
                }

                @Override
                public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                        float pTouchAreaLocalX, float pTouchAreaLocalY) {

                    Body playerBody = mPhysicsWorld.getPhysicsConnectorManager()
                    .findBodyByShape(mPlayer);

                    playerBody.setTransform(new Vector2((playerBody.getPosition().x - 0.15f) ,playerBody.getPosition().y), 0);

                    return true;
                }
             };

谢谢格雷格

I'm learning andEngine and trying to make a simple game based on some examples. My problem is that the game stops in some random moments and I can only use back button ;/ I used logcat and found problem, here's log:

/release-keys'

I/DEBUG ( 2656): pid: 4918, tid:
4926 >>> com.homework.mygame <<<
I/DEBUG ( 2656): signal 11
(SIGSEGV), code 1 (SEGV_MAPERR), fault
addr 3f8191d 4 I/DEBUG ( 2656): r0
00000000 r1 00000000 r2 3f800000 r3
000191d4 I/DEBUG ( 2656): r4
00140a30 r5 00149978 r6 449d9b18 r7
44dbe008 I/DEBUG ( 2656): r8
449d9b6c r9 43707d58 10 43707d40 fp
449d9ed8

I/DEBUG ( 2656): ip 00000000 sp
449d9b00 lr 8062eeb8 pc 806189b8
cpsr 600 00010 I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 3 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
3 item not yet recycled. Allocated 1
more . I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 4 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
4 item not yet recycled. Allocated 1
more . I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 5 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
5 item not yet recycled. Allocated 1
more . I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 6 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
6 item not yet recycled. Allocated 1
more . I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 7 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
7 item not yet recycled. Allocated 1
more . I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 8 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
8 item not yet recycled. Allocated 1
more . I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 9 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
9 item not yet recycled. Allocated 1
more . D/dalvikvm( 929): Cronos
GC_EXTERNAL_ALLOC freed 166K, 55% free
2686K/5895K, ex ternal 905K/987K,
paused 268ms I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 10 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
10 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 11 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
11 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 12 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
12 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 13 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
13 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 14 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
14 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 15 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
15 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 16 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
16 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 17 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
17 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 18 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
18 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 19 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
19 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 20 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
20 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 21 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
21 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 22 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
22 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 23 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
23 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 24 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
24 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 25 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
25 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 26 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
26 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 27 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
27 item not yet recycled. Allocated 1
mor e. D/dalvikvm( 929): Cronos
GC_EXTERNAL_ALLOC freed 10K, 55% free
2686K/5895K, ext ernal 905K/927K,
paused 294ms D/dalvikvm( 929): Cronos
GC_EXTERNAL_ALLOC freed 5K, 55% free
2686K/5895K, exte rnal 920K/1016K,
paused 135ms I/DEBUG ( 2656):

00 pc 000189b8 /data/data/com.homework.mygame/lib

/libandenginephysicsbox2dextension.so
(_ZN6b2Body13CreateFixtureEPK12b2FixtureDe
f) I/DEBUG ( 2656): #01 pc
0000bfbc
/data/data/com.homework.mygame/lib
/libandenginephysicsbox2dextension.so
(Java_com_badlogic_gdx_physics_box2d_Body_
jniCreateFixture__JJFFFZSSS) I/DEBUG
( 2656): #02 pc 00011d74
/system/lib/libdvm.so I/DEBUG (
2656): I/DEBUG ( 2656): code around
pc: I/DEBUG ( 2656): 80618998
eb00595d e3500000 0a000001 e1a00004
I/DEBUG ( 2656): 806189a8 ebfffd9f
e594205c e3a03a19 e2833f75 I/DEBUG (
2656): 806189b8 e7921003 e1a00005
e3811001 e7821003 I/DEBUG ( 2656):
806189c8 e8bd81f0 e594105c e1a00005
e284200c I/DEBUG ( 2656): 806189d8
e2811a19 e2811f76 eb0003ae eaffffe2
I/DEBUG ( 2656): I/DEBUG ( 2656):
code around lr: I/DEBUG ( 2656):
8062ee98 e51d0004 e12fff1e e1a0c000
e1a00001 I/DEBUG ( 2656): 8062eea8
e1a0100c eaffffff e92d400f ebffffe1
I/DEBUG ( 2656): 8062eeb8 e3500000
43700000 e8bd800f e52de008 I/DEBUG (
2656): 8062eec8 ebfffff8 03a00001
13a00000 e49df008 I/DEBUG ( 2656):
8062eed8 e52de008 ebfffff3 33a00001
23a00000 I/DEBUG ( 2656): I/DEBUG
( 2656): stack: I/DEBUG ( 2656):
449d9ac0 43707d58 I/DEBUG ( 2656):
449d9ac4 43707d40 I/DEBUG ( 2656):
449d9ac8 449d9ed8 I/DEBUG ( 2656):
449d9acc 80617174
/data/data/com.homework.mygame/lib/li
bandenginephysicsbox2dextension.so
I/DEBUG ( 2656): 449d9ad0
00149978 I/DEBUG ( 2656):
449d9ad4 449d9b18 I/DEBUG ( 2656):
449d9ad8 0000ffff I/DEBUG ( 2656):
449d9adc 44dbe008 I/DEBUG ( 2656):
449d9ae0 00000001 I/DEBUG ( 2656):
449d9ae4 00000000 I/DEBUG ( 2656):
449d9ae8 00000000 I/DEBUG ( 2656):
449d9aec 421cf249 I/DEBUG ( 2656):
449d9af0 bf800001 I/DEBUG ( 2656):
449d9af4 8062ef1c
/data/data/com.homework.mygame/lib/li
bandenginephysicsbox2dextension.so
I/DEBUG ( 2656): 449d9af8
df002777 I/DEBUG ( 2656):
449d9afc e3a070ad I/DEBUG ( 2656):

00 449d9b00 ffffffff I/DEBUG ( 2656): 449d9b04 00000000 I/DEBUG

( 2656): 449d9b08 80632718
I/DEBUG ( 2656): 449d9b0c
43707d84 I/DEBUG ( 2656):
449d9b10 449d9b6c I/DEBUG ( 2656):
449d9b14 8060bfc0
/data/data/com.homework.mygame/lib/li
bandenginephysicsbox2dextension.so
I/DEBUG ( 2656): #01 449d9b18
80632718 I/DEBUG ( 2656):
449d9b1c 0016a928 I/DEBUG ( 2656):
449d9b20 00000000 I/DEBUG ( 2656):
449d9b24 00000000 I/DEBUG ( 2656):
449d9b28 00000000 I/DEBUG ( 2656):
449d9b2c 00000000 I/DEBUG ( 2656):
449d9b30 00017b00 I/DEBUG ( 2656):
449d9b34 0000ffff I/DEBUG ( 2656):
449d9b38 449d9b90 I/DEBUG ( 2656):
449d9b3c 00000003 I/DEBUG ( 2656):
449d9b40 44843052 I/DEBUG ( 2656):
449d9b44 aca11d78
/system/lib/libdvm.so I/AndEngine(
4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 28 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
28 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 29 item
not yet recycled. Allocated 1 more.
D/dalvikvm( 602): Cronos
GC_EXTERNAL_ALLOC freed 257K, 40% free
6266K/10311K, e xternal 1546K/1581K,
paused 445ms I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
29 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 30 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
30 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 31 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
31 item not yet recycled. Allocated 1
mor e. I/AndEngine( 4918):
org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 32 item
not yet recycled. Allocated 1 more.
I/AndEngine( 4918):
org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
32 item not yet recycled. Allocated 1
mor e. D/dalvikvm( 929): Cronos
GC_EXTERNAL_ALLOC freed 11K, 55% free
2685K/5895K, ext ernal 726K/889K,
paused 139ms D/dalvikvm( 929): Cronos
GC_EXTERNAL_ALLOC freed 10K, 55% free
2686K/5895K, ext ernal 667K/749K,
paused 140ms D/dalvikvm( 929): Cronos
GC_EXTERNAL_ALLOC freed 5K, 55% free
2685K/5895K, exte rnal 920K/1016K,
paused 138ms D/dalvikvm( 602): Cronos
GC_EXTERNAL_ALLOC freed 32K, 40% free
6246K/10311K, ex ternal 1403K/1470K,
paused 343ms I/BootReceiver( 602):
Copying /data/tombstones/tombstone_02
to DropBox (SYSTEM_ TOMBSTONE)
E/InputDispatcher( 602): channel
'408f3600
com.homework.mygame/com.homework.myg
ame.com.homework.mygame (server)' ~
Consumer closed input channel or an
error oc curred. events=0x8
E/InputDispatcher( 602): channel
'408f3600
com.homework.mygame/com.homework.myg
ame.com.homework.mygame (server)' ~
Channel is unrecoverably broken and
will be disposed! D/Zygote ( 565):
Process 4918 terminated by signal (11)
D/dalvikvm( 602): Cronos
GC_FOR_MALLOC freed 123K, 39% free
6384K/10311K, exter nal 958K/1470K,
paused 141ms I/dalvikvm-heap( 602):
Grow heap (frag case) to 9.928MB for
161568-byte allocat ion D/dalvikvm(
602): Cronos GC_FOR_MALLOC freed 3K,
38% free 6538K/10503K, externa l
958K/1470K, paused 147ms
I/WindowManager( 602): WIN DEATH:
Window{408f3600
com.homework.mygame/com.homew
ork.mygame.com.homework.mygame
paused=false} D/dalvikvm( 602):
Cronos GC_FOR_MALLOC freed 2K, 38%
free 6537K/10503K, externa l
847K/1359K, paused 143ms
I/dalvikvm-heap( 602): Grow heap
(frag case) to 9.891MB for 80792-byte
allocati on D/dalvikvm( 602): Cronos
GC_FOR_MALLOC freed <1K, 38% free
6615K/10631K, extern al 847K/1359K,
paused 144ms D/dalvikvm( 602): Cronos
GC_FOR_MALLOC freed 217K, 40% free
6398K/10631K, exter nal 847K/1359K,
paused 142ms I/WindowManager( 602):
WIN DEATH: Window{4090fff8 SurfaceView
paused=false} D/gralloc ( 602):
freeing GPU buffer at 0 D/gralloc (
602): freeing GPU buffer at 307200
I/ActivityManager( 602): Process
com.homework.mygame (pid 4918) has
died. W/InputManagerService( 602):
Got RemoteException sending
setActive(false) notif ication to pid
4918 uid 10088 D/dalvikvm( 929):
Cronos GC_EXPLICIT freed 9K, 55% free
2683K/5895K, external 4 89K/889K,
paused 68ms
V/com.mobilityflow.animatedweather.services.UpdateService$ServiceThread(
929): Timed alarm onReceive() started
at time: 2011-05-13 17:07:25.491
W/System.err( 929):
java.net.UnknownHostException:
www.yr.no W/System.err( 929): at
java.net.InetAddress.lookupHostByName(InetAddress.jav
a:506) W/System.err( 929): at
java.net.InetAddress.getAllByNameImpl(InetAddress.jav
a:294) W/System.err( 929): at
java.net.InetAddress.getAllByName(InetAddress.java:25
6) W/System.err( 929): at
org.apache.http.impl.conn.DefaultClientConnectionOper
ator.openConnection(DefaultClientConnectionOperator.java:136)
W/System.err( 929): at
org.apache.http.impl.conn.AbstractPoolEntry.open(Abst
ractPoolEntry.java:164) W/System.err(
929): at
org.apache.http.impl.conn.AbstractPooledConnAdapter.o
pen(AbstractPooledConnAdapter.java:119)
W/System.err( 929): at
org.apache.http.impl.client.DefaultRequestDirector.ex
ecute(DefaultRequestDirector.java:348)
W/System.err( 929): at
org.apache.http.impl.client.AbstractHttpClient.execut
e(AbstractHttpClient.java:555)
W/System.err( 929): at
org.apache.http.impl.client.AbstractHttpClient.execut
e(AbstractHttpClient.java:487)
W/System.err( 929): at
org.apache.http.impl.client.AbstractHttpClient.execut
e(AbstractHttpClient.java:465)
W/System.err( 929): at
com.mobilityflow.animatedweather.weather_providers.Yr
Provider.loadWeatherWeek(YrProvider.java:440)
W/System.err( 929): at
com.mobilityflow.animatedweather.weather_providers.Yr
Provider.providerLoadWeather(YrProvider.java:135)
W/System.err( 929): at
com.mobilityflow.animatedweather.weather_providers.We
atherProvider.loadWeatherData(WeatherProvider.java:125)
W/System.err( 929): at
com.mobilityflow.animatedweather.WebProvider$ThreadWe
atherLoad.run(WebProvider.java:256)

So I guess it's because on onAreaTouched function. I use it to control a player, there are 2 arrows and we can touch them to move player from left to right. Am I doing it correctly or should I do it in another way ? Here's my code:

 mRArrow = new Sprite(125, CAMERA_HEIGHT - 55, mRArrowTextureRegion) {
                @Override
                protected void onManagedUpdate(float pSecondsElapsed) {

                    super.onManagedUpdate(pSecondsElapsed);
                }

                @Override
                public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                        float pTouchAreaLocalX, float pTouchAreaLocalY) {


                    Body playerBody = mPhysicsWorld.getPhysicsConnectorManager()
                        .findBodyByShape(mPlayer);

                    playerBody.setTransform(new Vector2((playerBody.getPosition().x + 0.15f) ,playerBody.getPosition().y), 0);

                    return true;
                }
             };

            mLArrow = new Sprite(15, CAMERA_HEIGHT - 55, mLArrowTextureRegion) {
                @Override
                protected void onManagedUpdate(float pSecondsElapsed) {

                    super.onManagedUpdate(pSecondsElapsed);
                }

                @Override
                public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                        float pTouchAreaLocalX, float pTouchAreaLocalY) {

                    Body playerBody = mPhysicsWorld.getPhysicsConnectorManager()
                    .findBodyByShape(mPlayer);

                    playerBody.setTransform(new Vector2((playerBody.getPosition().x - 0.15f) ,playerBody.getPosition().y), 0);

                    return true;
                }
             };

Thanks in advance

Greg

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

独守阴晴ぅ圆缺 2024-11-14 12:41:46

不要触摸 TouchEvent 内部的物理“主体”。 UI-Thread 和 UpdateThread 讨厌同时工作!

Do not touch a Physics-"Body" inside of a TouchEvent. UI-Thread and UpdateThread hate working at the same time!

ι不睡觉的鱼゛ 2024-11-14 12:41:46

我得到了同样的错误,这是因为我没有调用 scene.registerTouchArea(...)。
希望这对某人有帮助。

I got the same error and it was because I had not called scene.registerTouchArea(...).
Hope this helps somebody.

紙鸢 2024-11-14 12:41:46

时出现问题。

physicsWorld.destroyBody(fixture.getBody());

就我而言,当我尝试使用我避免这条线并且场景工作正常

In my case, the problem appeared when I try use

physicsWorld.destroyBody(fixture.getBody());

I avoided this line and the scene worked fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文