How to effectively implement GUI with jPCT-AE?

Started by kiffa, July 31, 2013, 07:32:29 AM

Previous topic - Next topic

kiffa

GUI means menu\button\dash board\HP-bar and so on,  they are 2D images in most case.

I have tried 2 methods:
  1, Use Android GUI mechanism: This is simple, but will be slow when the view(s) need to update frequently(send msg to UI-Thread, then measure\layout\draw the View-hierarchy.)

2, Use FrameBuffer.blit(): Need to code yourself for some special effects, and seems to be not very fast(Maybe I used it in a wrong way).

My question:
  1, Could you explain the implementation of FrameBuffer.blit()? And how fast should it be?

  2, Is there a third way? The performance is the most important factor  to me.

kiffa

#1
I have made a racing game, and need update  the dash board frequently, e.g: the current speed of player, the current ranking of player, the current score of player, the current time of race and so on.

I use Android-GUI for this now,  it works fine for static views, but slowly for views which update frequently.  After measuring, the updating of GUI was one of the bottlenecks. I have controlled the rate of updating, but the performance was also not good enough.



EgonOlsen

Blitting is as fast as it gets and i've never seen any impact on performance when using it. For example in this scene



The dialog window itself consists of several blits and each character of the text is a single blit and i don't see any performance impact from it.

kiffa


Thomas.

Or you can get inspired by my GUI (maybe it will be sometimes for download...) ;)


Yerst


Thomas.

For graphics part is used only FrameBuffer.blit(...), but control of menu itself is little bit complex. I am used recursive algorithm.