A
A
Anton Borisenko2017-02-07 15:44:01
Android
Anton Borisenko, 2017-02-07 15:44:01

How to understand this behavior of LibGDX?

I am writing a game for mobile devices in Java with the libgdx framework. After passing, the screen changes and when the player clicks on the "Next Level" button, the inscription loading the level is first displayed, then the level is loaded and then it starts. That is,
drawing();
loadLevel();
setScreen();
In fact, the level is loaded first (loadLevel()), then the inscription pops up for a moment and the level begins. No matter how I tried to change the algorithm, the level is loaded first (it looks like everything is hanging).
Switched to Java recently from JavaScript, what am I missing?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2017-02-07
@tonymontano

Learn the concept of "message loop". Between drawing() and loadLevel() force the processing of window messages.
As far as I understand (I don’t know the framework), Display.processMessages();

A
Anton Borisenko, 2017-02-07
@tonymontano

No, it's just calling the functions one by one. I have a message so far just in the form of a changing picture. Like "click" - "level is loading"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question