Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I actually wanted just a fake loading scene. For a fake loading scene, how do I make a time variable or a time Method? I'm still a fresh java programmer!

share|improve this question
2  
Need to work on that accept rate. 0% is pretty low. –  Byte56 Sep 27 '12 at 14:15
    
I think this question is way too broad to be useful, unfortunately. –  Josh Petrie Oct 19 '12 at 17:37

2 Answers 2

As fresh java programmer, at first try to have basics, then do it through an example and then you are expert (use professional libraries for your projects).

Basics #

Core Example #

Open Source Library #

EDIT: Regarding loading Scene in SLick

Slick provides a way to get this loading bar style initialisation - called deferred loading. When deferred loading is enabled all the calls to load resoures (images, sounds, music, fonts etc) are wrapped in the library to load only the explicit data required for the resource immediately.

public void render(GameContainer container, Graphics g) { 
    g.drawString("Loaded: "+lastLoaded, 100, 100);      
} 

public void update(GameContainer container, int delta) throws SlickException { 
    if (LoadingList.get().getRemainingResources() > 0) { 
        DeferredResource nextResource = LoadingList.get().getNext(); 
        nextResource.load();
        lastLoaded = nextResource.getDescription();
    } else { 
        // loading is complete, do normal updat ehere      
    }
}

For more details, go through the followings

share|improve this answer
    
Nice links. Think I have to take a look at launch4j. But I think this does not answers the question. If I understood right, SystemNetworks wants to display a loading screen / animation in the context of slick2d / opengl. –  tom van green Sep 27 '12 at 11:29
    
@tomvangreen Yes, you are right. Now i have edited my answer. –  Md. Mahbubur R. Aaman Sep 27 '12 at 13:59
    
To complete the answer. What deffered loading does in slick is, that the resource objects are instanciated directly, but not loaded. Every update frame only one resource is loaded. Normally the resource would load directly... This is a problem, when you want to display an animation or a progress bar, as normally the process is blocked (and therefore no render or update takes place) during the loading. With deffered loading, it may be that you experience some hangers (when loading big files), but generally you can display a loading bar animation in this way. –  tom van green Sep 27 '12 at 14:01
    
You just have to make sure, that you only start using the resources, when they are loaded and not before. This means you need to track the state of the resource loading and skip actions, where the resources are needed, until they are loaded... –  tom van green Sep 27 '12 at 14:03
    
@tomvangreen, Yes, I agree with you. –  Md. Mahbubur R. Aaman Sep 27 '12 at 14:10

You can use java Timer. Draw a rect somewhere on your screen as a progress bar and increase his width regarding the elapsed/remaining time, it can be done with a really simple percentage operation.

timer = new Timer(...)
timer.addActionListener(yourSceneLoader)

yourSceneLoader can be a class in charge of handling the loading of your scenes, regarding the code above it should implements ActionListener and in the actionPerformed method:

public void actionPerformed() {
    updateProgressBar() //do the calculations in this method
}

You don't necessarily have to use a Timer but it's a way to achieve what you want and you can easily control how fast the progress bar progress.

Also if you want to do real loading, you can read this.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.