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.
posted 13 years ago
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.