Jump to content
  • Advertisement
Sign in to follow this  
Captain P

[java] Forcing a repaint - used for loading screens

This topic is 4436 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I've been working on some mobile games for the past two months, and recently I had to add loading screens to an already existing game. Not a big deal, I thought, untill I tried to implement it. I used a Canvas object to set as the current displayable object, and called it´s repaint() function. Needless to say, it didn't work: repaint() is inteded to act as a request, not a direct action. Adding a waiting time after the repaint() call didn't work either. Some hacks, including storing a Graphics object and manually calling paint(), and forcing the midlet only to continue after the paint() function had been called at least once, didn't work either. It's a MIDP 2.0, CLDC 1.1 midlet and I'm testing with the WTK22 emulator, Nokia S60 emulator and Carbide.J emulators. Since the game needs to include loading screens, it's getting a bit troublesome. Anyone here who has encountered the same problem and knows a workaround or solution?

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the reply, but MediaTrackers aren't available with MIDP 2.0 midlets. Also, I´m not looking to keep track of images being loaded, but to force a screen to be redrawn.

Share this post


Link to post
Share on other sites
Thanks. However, I already received an answer on the Nokia Developer forums, and it turns out that calling serviceRepaints() forces Java to execute all waiting repaint() calls.

The real source of my problem was something else, though: the object I was waiting for to repaint was never set as the displayable object, since Display.setCurrent() is a request function as well... talk about misleading function names there... Since I found no way to enforce those requests, I went with a different solution: installing one object as the displayable, and using that object as a manager, implementing a state machine design so I can swap the objects I want to display manually and immediatly. No need to depend on that setCurrent() function anymore. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!