Author Topic: Loading Screen  (Read 3636 times)

Offline Thunderfox

  • byte
  • *
  • Posts: 10
    • View Profile
Loading Screen
« on: July 20, 2011, 04:13:54 pm »
Hi,
I want to create a loading screen for the time while the GLSurfaceView, objects and textures are loading. But when I try to load a ProgressDialog in Android, you can see it not until the GLSurfaceView is ready and the renderloop is started. Also a overlay with Android Widgets can't displayed until GLSurfaceView is loaded.
Before I found this engine, I loaded objects in the renderloop, one object per frame and every frame I scaled a colored rectangle, the progressbar, in x-direction. At all, this solution is not really clear.
So, is there another easy solution to show a ProgressBar while loading the GLSurfaceView?

By the way: Is there a easy function to draw 2D text?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Loading Screen
« Reply #1 on: July 20, 2011, 09:08:03 pm »
In AlienRunner, i'm starting a thread that loads the data in onSurfaceCreated() and blit some loading screen while it runs in onDrawFrame().

About blitting text: You can either draw your text onto a texture and blit that or use raft's blitting classes. You can find them here: http://www.jpct.net/forum2/index.php/topic,1563.0.html.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: Loading Screen
« Reply #2 on: July 21, 2011, 11:23:56 am »
If you have an activity running before you start the game activity (like a main menu) then you can actually do setContentView(ImageView) immediately before the startActivity() of your jpct part.  Then in the main menu activity you want an onRestart() method that does setContentView(MainMenu) back so that it doesn't continue showing the ImageView loading screen.  This is what I am doing.

Also if you don't have a main menu, then perhaps you could make a dummy activity that litteraly just does setContentView(ImageView) then startActivity of your main activity.  Unfortunately, this ImageView method does not support a progress bar though.
« Last Edit: July 21, 2011, 11:26:03 am by Disastorm »

Offline Thunderfox

  • byte
  • *
  • Posts: 10
    • View Profile
Re: Loading Screen
« Reply #3 on: July 21, 2011, 12:16:12 pm »
Then I think it is the best, when I also load the objects while the onDrawFrame function is running (which I called renderloop above) and not while initialize the GLSurface.

Thanks for the Textclass :)