Is it considered poor programming to do this with xna components?
- by Rob
I created my own Menu System that is event driven.
In order to have a loading screen and multithreaded loading to work, I devised this sort of implementation:
//Let's check if the game is done loading.
if (_game != null)
{
_gameLoaded = _game.DoneLoading;
}
//This means the game is loading still,
//therefore the loading screen should be active.
if (!_gameLoaded && _gameActive)
{
_gameScreenList[2].UpdateMenu();
}
//The loading screen was selected.
if (_gameScreenList[2].CurrentState == GameScreen.State.Shown && !_gameActive)
{
Components.Add(_game = new ParadoxGame(this));
_game.Initialize(); //Initializes the Game so that the loading can begin.
_gameActive = true;
}
In the XNA Game Component that contains the actual game, in the LoadContent method I simply created a new Thread that calls another method ThreadLoad that has all the actual loading.
I also have a boolean variable called DoneLoading in the XNA Game Component that is set to true at the end of the ThreadLoad.
I am wondering if this is a poor implementation.