Skip to main content
GameDev.net gamedev.net
🔒 Locked

Loading?

Started by Goguigo Jul 22, 2006 at 1:35 AM 6 replies 850+ views
Original Post
Goguigo
Goguigo
Is there any way to know when the cellphone, any, is loading? Thanks
JohnLamock
JohnLamock
What do you mean with "loading"?

Loading your application resources like images, MIDI files, sprites... ?
Or do you mean the time cellphone spend to make itself on?

Or is it another thing? [wink]

Regards,

John.
zolee
zolee
battery being charged, I think this is what he means.
br,Zolee------
Goguigo
Goguigo
no no, lol. :)

... like when you select Play and the cell is preparing to play the damn thing. ;)

Cya
JohnLamock
JohnLamock
Hi,

The loading screen shows to the user (with a progress bar or something like that), the time that the device is taking to load the images, load MIDI files, create tables, etc...

So, a way to make that is to call the paint method the times you want to update the progress bar. Something like this:

public static void loading(int perc, Graphics g) {	g.setColor(0,0,0);	g.fillRect(0,0,canvasWidth, canvasHeight);	g.setColor(255,255,255);	g.drawString("loading, " + perc + "%", canvasWidth/2, canvasHeight/2, Graphics.TOP | Graphics.HCenter);}public boolean loadRes() {	try {		//Load Character Image		Image imgC1 =  Image.createImage("/res/c.png");
loading(10, this.g);

//Create enemy object
enemy = new Enemy(ENEMY_1);
loading(20, this.g);

//...

}
catch (Exception e) {
e.printStackTrace();
}
}






Something like this.
It's a idea. Obviously not the better one, but you can improve it. [wink]

Regards,

John.
Goguigo
Goguigo
Thanks man.

The sad news is that it didnt work perfectly.... i'm working with a MG150D LG cellphone, and it seems that it has a single buffer or something like that. The thing is that, i tried to create several loading methods and ways... but i get a whit screen allways on that cellphone. The problem is that the game takes 5 segs on loading, and the user may think "damn, maybe the game got stuck... just like windows" (lol).

:(

Thanks tho
JohnLamock
JohnLamock
Maybe is because your app aren't calling repaint() method.

You can try to call repaint() and serviceRepaints() to force the painting method to draw the loading screen.
Another way to do is running the loading method in another thread.

Regards,

John.
Goguigo
Goguigo
Thanks man, that fixed the problem. :D


Just curious... how can i load and run the program in 2 diferent threads?

thanks again

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.