Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Loading, Screens, and General Trickery  (Read 1251 times)
0 Members and 1 Guest are viewing this topic.
Offline tariqbroadnax

Senior Devvie


Medals: 7
Exp: 3 years



« Posted 2017-11-10 01:21:30 »

Assume that you are using the "scene" paradigm.

Lets say you want to load in a new scene.

Here are the steps

1. Disable controls
2. Fade the loading screen in
3. Read the scene from a file
4. Set the new scene
5. Fade the loading screen out
6. Re-enable controls

Here are some problems to consider:

1. Fading in and Fading out take time. How would you follow up on something that finishes in the future, specifically on another cycle of the game loop.

2. Since loading screens usually has some type of animation, you probably do not want to read the scene on the game loop thread. How would you execute it on another thread.

3. What class do you place the code for #1 and #2 in?

4. How do you test your approach?

I have already solved this for my own project. But I am curious into what others will say. Also, this took me 2 hours on thinking for organize thread execution. I hope no one else suffers from this problem.
Offline zngga
« Reply #1 - Posted 2017-11-10 15:30:57 »

I don't really have much to say from my own experience on this topic, but take a look at libGDX's approach in their scene2d scene graph. Specifically the SequenceAction.
https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/scenes/scene2d/actions/SequenceAction.java

My code never has bugs... it just develops unexpected features!
Offline Stampler
« Reply #2 - Posted 2017-11-10 16:38:37 »

Maybe you already came by it while googling, but a short search gave me this which looks pretty promising: https://stackoverflow.com/questions/12016675/how-to-create-loading-screen-in-libgdx

Don't dream big, dream realistic.
beemelonstudio: Website | Twitter | Instagram
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1672 views)
2018-06-10 19:43:48

EgonOlsen (1710 views)
2018-06-10 19:43:44

EgonOlsen (1159 views)
2018-06-10 19:43:20

DesertCoockie (1585 views)
2018-05-13 18:23:11

nelsongames (1186 views)
2018-04-24 18:15:36

nelsongames (1710 views)
2018-04-24 18:14:32

ivj94 (2533 views)
2018-03-24 14:47:39

ivj94 (1759 views)
2018-03-24 14:46:31

ivj94 (2836 views)
2018-03-24 14:43:53

Solater (971 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!