Comments (3)
The initial goal of splitting the screen creation into the constructor and the create() method was to allow deferring the initialization of screens. This can come in handy if you are using a loading screen to load your assets: At the start, you can create your screen (and do stuff in its constructor), even when your assets aren't loaded yet; create()
is then only called when your assets are already loaded (either via the loading screen calling ManagedScreen#initializeScreen()
(which internally calls create()
) or automatically when the screen is first shown (by default create()
is called right before the screen is first shown)).
As I've stated here, as the library has become bigger this has turned out to be somewhat confusing for new users and I'm not really sure whether this couldn't be handled in a better manner in future releases. Maybe it'd make sense to combine it with a dependency injection system (so you wouldn't have to hand over everything via the new screen's constructor), but that is a problem for another day.
To get back to your question: if your stuff was in libGDX's show()
method, it can stay there in libgdx-screenmanager's show()
method. Both of those are called whenever the screen is shown. On the other hand, libgdx-screenmanager's create()
method is only called once (!) and can be seen as a replacement for the screen's constructor.
All of this is also detailed here and here in the wiki, so be sure to check that out too.
from libgdx-screenmanager.
Is it required to call super.show() before the code block in show() in libgdx-screenmanager system?
After reading the code from ManagedScreen, I think it is required.
from libgdx-screenmanager.
Yes, you should.
from libgdx-screenmanager.
Related Issues (20)
- Inverted Y values
- Screenmanager.push() isnt working HOT 3
- Slicing Transitions with high slice counts are not working HOT 2
- Feature request: An event in ManagedScreen that is called each time a transition ends, on both involved screens HOT 3
- BUG: Does not work on Android HOT 3
- GWT build issue HOT 2
- Remove the libgdx-screenmanager-gwt extension
- crash when minimizing HOT 6
- unable to get dependancies for 0.6.8 HOT 6
- Adapter classes? HOT 2
- Help GLTransitionsShaderTransition HOT 3
- Can I add screen to screenmanager when it is required? HOT 3
- resize() should be after show() in life cycle. HOT 1
- Cannot access ManagedGame HOT 1
- The currently bound framebuffer (0) doesn't match this one HOT 5
- crash on ios HOT 3
- e: Supertypes of the following classes cannot be resolved.
- Inconsistencies between libgdxs implementation of setScreens() and screenmanager. HOT 3
- Little ideas HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libgdx-screenmanager.