Is it considered poor programming to do this with xna components?

Posted by Rob on Game Development See other posts from Game Development or by Rob
Published on 2012-07-24T19:27:21Z Indexed on 2012/09/07 3:49 UTC
Read the original article Hit count: 269

Filed under:
|

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.

© Game Development or respective owner

Related posts about c#

Related posts about XNA