• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement a "Please wait" message

 
Luz Luz
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I'm writing a game that needs to do a heavy initializing routine before every level. Now it would be nice to show some "please wait..." message to the user so that he knows that the program hasn't crashed.
Surprisingly that was quite problematic thing to implement. As Display.setCurrent() doesn't necessarily have immediate effect this following code doesn't seem to work:
display.setCurrent(messageCanvas);
someTimeTakingRoutines();
display.setCurrent(gameCanvas);
The result is the same as if the first setCurrent() function wasn't called at all.
Can anyone give me a simple example how I could show a message screen while the program is loading something?
Thank you.
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first setCurrent() was called -- it just would not take effect because your main application thread is blocking the UI update. You have to display and update the "wait" screen from another thread. For an example, check out an sample application from my book.
Also, your display name does not conform to the JavaRanch naming policy, which you had agreed to when you registered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic