I’m trying to make a splash screen for a basic game utility jar. I call the method to draw the splash image to the screen, then i tell the thread to sleep. However, the image doesn’t always show, i have no idea why, but it’s very annoying, can anyone tell me why? I’m hesitant to post the code because it’s very complicated and hard to read and trace.
Yeah, there is no way around it, you are going to have to post some kind of example so people know the library you are using (possibly Java2D), or what mistake you did while using the sleep() method. You could try posting the section where you think the problems are at.
Some time ago I had the same problem. Are you using passiv or activ rendering. passiv-rendering isnt appreciated for gamedev and leads to a lot of problems, especially if you are using java2d. Even if you force the immediate repaint, it’s repainted after everything else is down.
best regards
Yeah, this is just a thought, but sleeping may prevent your program from rendering until after the sleep is over.
You could try using a timer instead?
Don’t use a timer, they still execute on the EDT, so the same problems will occur. Just use however many cycles of your main loop.