If I remember correctly, this is based on SDL, which requires manual initialization of the various components. How did you manage that? I don't mind opening and closing libraries when it's something related to graphics, it kind of makes sense, especially if you want to send parameters over to the video initialization thing.