Wednesday, 10 February 2010

HS: Neoforce "no skin loaded" bughunt

Neoforce threw up another problem late last night: no matter what I did, I could not manage to get it to run without throwing up a runtime error the first time I try adding a button to my game mode: "Control cannot be created. No skin loaded." - another user had the problem on the Neoforce forum, but no solution was identified there.

The only way I found to get the project to start correctly was to ensure I was using the 4-parm constructor for the Neoforce Manager class and setting the register parm to true. The downside to this is that the manager automatically registers itself with your game class and the base game class calls the manager's draw and update methods. This could be inconvenient for you, but seems to be working okay for me at the moment.

Since I am writing a game with a mode switcher, I added an Exit method to the IGameMode interface that gets called on the current mode whenever the GameModeManager is about to change mode. In the GameModeMenu's Exit method I call Dispose on the Neoforce manager and set my reference to the manager to null. Hopefully this is enough to release the manager to be garbage collected; I don't see a method in either Game or the Neoforce manager to deregister it.

No comments:

Post a Comment