I’m trying to understand how to organize my code to build a simulation. It will have several layers of data that should be easy to toggle off and on.
I read about AppStates and Controls so my questions are:
- Should each layer off data be a method on a general AppState?
- Is there any way to separate each layer into a dedicated object while still having access to the global objects like rootNode or assetManager?
Thanks in advance
These are basic java / object oriented programming questions. I suggest you first work on small applications as you’ll have to learn both programming and game programming at the same time. Yu can use other objects by passing a reference via e.g. the constructor and assigning that to a field in the other object class.
I probably didn’t state my questions properly.
I was asking more like is there supposed to be only one AppState enable at a time or can you organize the code into several AppStates that then are toggle on and off as needed.
I’ll give an example: I want to see the data I collected on top of a map and also a vehicle. But I want to be able to see it in any combination (just the map and the vehicle or just the data, etc). Is a good use of the AppState to have one for the data, another for the map and another for the vehicle?
I know that from a basic java / object oriented programming I should do this (it’s why I’m asking in the first place) but I didn’t understand if you can have several states enabled at a time.
Well I would use a appstate for main menu, settings ect and one for visualisation
The different object then would be nodes, wich i simply toggle vie cullhint.always invisible if not needed.
(Assuming that it makes no difference when I hit visible/hide for your logical layers)
You’re totally right. Thanks
The answer remains the same, an AppState is just a callback class, how you use it is up to you.