Well the game I set my gameloop up I need the vector to be in main.
Code:
while(done!=TRUE) // Loop That Runs While done=FALSE
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting?
{
if (msg.message==WM_QUIT) // Have We Received A Quit Message?
{
done=TRUE; // If So done=TRUE
}
else // If Not, Deal With Window Messages
{
TranslateMessage(&msg); // Translate The Message
DispatchMessage(&msg); // Dispatch The Message
}
}
else // If There Are No Messages
{
if(resize==true){
States.back()->resize();
resize=false;
}
ElapsedTime = timeGetTime()- LastTime;
if(ElapsedTime < DesiredFrameLength)
{
Sleep(DesiredFrameLength - ElapsedTime);
ElapsedTime = DesiredFrameLength;
}
LastTime = timeGetTime();
// Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene()
if ((active && States.back()->run(States)) || keys[VK_ESCAPE]) // Active? Was There A Quit Received?
{
done=TRUE; // ESC or DrawGLScene Signalled A Quit
}
else // Not Time To Quit, Update Screen
{
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
}
This way I can always add any new class onto the vector and not have to change anything in the gameloop.
edit: Now that I think about it I could make a class to handle the other classes I suppose and use that in my gameloop. Was that what you guys were getting at?