Text setText isn working

  ... in the unlikely case you discovered a bug, post it here.

Re: Text setText isn working

Postby OzLark » Mon Apr 02, 2012 3:01 am

What is the exception stack trace for the crash?
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am

Re: Text setText isn working

Postby Nortsx » Mon Apr 02, 2012 6:40 pm

OzLark wrote:What is the exception stack trace for the crash?

If you ll tell me how can i watch that stack trace in android.jar file, i ll give it a try. It crashes somewhere in native library.
Nortsx
 
Posts: 67
Joined: Tue Dec 06, 2011 6:49 pm

Re: Text setText isn working

Postby Nortsx » Mon Apr 02, 2012 7:30 pm

This is a LogCat exception stack

04-02 21:28:55.208: E/AndroidRuntime(10285): FATAL EXCEPTION: UpdateThread
04-02 21:28:55.208: E/AndroidRuntime(10285): java.lang.ArrayIndexOutOfBoundsException
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.entity.text.vbo.HighPerformanceTextVertexBufferObject.onUpdateVertices(HighPerformanceTextVertexBufferObject.java:121)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.entity.text.Text.onUpdateVertices(Text.java:339)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.entity.text.Text.setText(Text.java:227)
04-02 21:28:55.208: E/AndroidRuntime(10285): at ru.rocknglory.games.player.startCrossed(player.java:177)
04-02 21:28:55.208: E/AndroidRuntime(10285): at ru.rocknglory.games.player.movePlayer(player.java:159)
04-02 21:28:55.208: E/AndroidRuntime(10285): at ru.rocknglory.games.player.access$1(player.java:146)
04-02 21:28:55.208: E/AndroidRuntime(10285): at ru.rocknglory.games.player$2.onAreaTouched(player.java:133)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.entity.scene.Scene.onAreaTouchEvent(Scene.java:409)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.entity.scene.Scene.onSceneTouchEvent(Scene.java:357)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.engine.Engine.onTouchScene(Engine.java:449)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.engine.Engine.onTouchEvent(Engine.java:435)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.input.touch.controller.BaseTouchController$TouchEventRunnablePoolItem.run(BaseTouchController.java:102)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.util.adt.pool.RunnablePoolUpdateHandler.onHandlePoolItem(RunnablePoolUpdateHandler.java:54)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.util.adt.pool.RunnablePoolUpdateHandler.onHandlePoolItem(RunnablePoolUpdateHandler.java:1)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.util.adt.pool.PoolUpdateHandler.onUpdate(PoolUpdateHandler.java:88)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.input.touch.controller.BaseTouchController.onUpdate(BaseTouchController.java:62)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.engine.Engine.onUpdate(Engine.java:581)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.engine.Engine.onTickUpdate(Engine.java:545)
04-02 21:28:55.208: E/AndroidRuntime(10285): at org.andengine.engine.Engine$UpdateThread.run(Engine.java:817)
04-02 21:28:55.218: D/AndEngine(10285): KingStepsActivity.onPause @(Thread: 'main')

The last traceable piece of code lies in here
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                                 if(!letter.isWhitespace()) {
  2.                                         final float x = xBase + letter.mOffsetX;
  3.                                         final float y = yBase + letter.mOffsetY;
  4.  
  5.                                         final float y2 = y + letter.mHeight;
  6.                                         final float x2 = x + letter.mWidth;
  7.  
  8.                                         final float u = letter.mU;
  9.                                         final float v = letter.mV;
  10.                                         final float u2 = letter.mU2;
  11.                                         final float v2 = letter.mV2;
  12.  
  13.                                         bufferData[bufferDataOffset + 0 * Text.VERTEX_SIZE + Text.VERTEX_INDEX_X] = x;
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
Nortsx
 
Posts: 67
Joined: Tue Dec 06, 2011 6:49 pm

Re: Text setText isn working

Postby OzLark » Tue Apr 03, 2012 12:25 am

Just a guess here, but given that stack trace and the code you've shown I'd assume you're using GLES1 and I think by default touch events do not occur on the update thread but you can set an option to make it do so: engineOptions.getTouchOptions().setRunOnUpdateThread(true);
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am

Re: Text setText isn working

Postby Nortsx » Tue Apr 03, 2012 6:39 am

OzLark wrote:Just a guess here, but given that stack trace and the code you've shown I'd assume you're using GLES1 and I think by default touch events do not occur on the update thread but you can set an option to make it do so: engineOptions.getTouchOptions().setRunOnUpdateThread(true);

Sorry, i didn t understand about GLES1. Isn a AndEndgine GLES2 guarantee GLES2 usage for me. The AndEngine is GLES2 branch=)
I also don t refresh the text in touch event. It refreshes in procedures whic is not strictly called by touch events.
P.S Maybe i didn t understand you, sorry :?:
Nortsx
 
Posts: 67
Joined: Tue Dec 06, 2011 6:49 pm

Re: Text setText isn working

Postby OzLark » Tue Apr 03, 2012 7:06 am

Sorry, if I cared to look properly at the stack trace I would have noticed that you are using GLES2.

Hmm, it doesn't really make sense, unless capitalText is being reassigned elsewhere (?)... you should use the debugger to see what is happening in there - or at least just add some Log.d() trace printing in that method...
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am

Re: Text setText isn working

Postby bsavells » Fri Apr 06, 2012 6:56 pm

Nortsx wrote:
OzLark wrote:
If i put the figures in constructor it works OK. What s the problem with that?


The only thing that stands out to me is that "MONEY" is 5 chars long and "MONEY 500" is 9, does the constructor call specify at least 9 characters for pCharactersMaximum?

There is my constructor.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. capitalText = new Text(100,100,this.mMainFont,"Capital:",500,this.getVertexBufferObjectManager(),DrawType.DYNAMIC);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


It looks like anything that is longer than start string`s length doesn t go into the buffer and crashes somehow(with max length and DrawType.DYNAMIC applicatoion doesnt crash but i have the black screen).


I was having the same issue this morning. It looks like you're correct in your assumption that anything longer than the start strings' length overflows the buffer. When using the constructor like you have, the maximum number of characters you can have gets set to 8 (capital:). To fix mine, I simply added some buffer space to the string in the constructor since I know mine will never grow past 5 characters. Perhaps the same would work for you!
bsavells
 
Posts: 2
Joined: Wed Apr 04, 2012 8:40 pm

Re: Text setText isn working

Postby Nortsx » Sat Apr 07, 2012 12:36 am

bsavells wrote:
It looks like anything that is longer than start string`s length doesn t go into the buffer and crashes somehow(with max length and DrawType.DYNAMIC applicatoion doesnt crash but i have the black screen).


I was having the same issue this morning. It looks like you're correct in your assumption that anything longer than the start strings' length overflows the buffer. When using the constructor like you have, the maximum number of characters you can have gets set to 8 (capital:). To fix mine, I simply added some buffer space to the string in the constructor since I know mine will never grow past 5 characters. Perhaps the same would work for you![/quote]
Yep i tried to fix it the same way. Hope that nicolas will look through this post and solve the issue. I ll try to fix the engine code by myself and in case of success i ll post it here=)
Nortsx
 
Posts: 67
Joined: Tue Dec 06, 2011 6:49 pm

Previous

Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests