I figured some SDL guru's lurked around these areas...
I'm writing a... well, I fear saying 'game engine', because when I start to make stuff official, it starts to fail, but for the purposes of argument, a game engine. I'm using SDL to give me a windowing context at the current moment. Here's what I have:
main.h:
Code:
int SW;
int SH;
int BPP;
class SGE
{
public:
SGE();
~SGE();
void startWindow(int screenWidth, int screenHeight, int bitsPerPixel);
void stopWindow();
private:
};
SGE::SGE()
{
}
SGE::~SGE()
{
}
void SGE::startWindow(int screenWidth, int screenHeight, int bitsPerPixel)
{
screenWidth = SW;
screenHeight = SH;
bitsPerPixel = BPP;
// Initialize SDL
SDL_Init(SDL_INIT_EVERYTHING);
// Set the SDL Video Mode
SDL_SetVideoMode(SW, SH, BPP, SDL_OPENGL);
// Set Window Caption
SDL_WM_SetCaption("SGT Engine", NULL);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapBuffers();
}
void SGE::stopWindow()
{
SDL_Quit();
}
main.cpp:
Code:
int main(int argc, char *argv[])
{
SGE engineInstance;
engineInstance.startWindow(20, 20, 32);
engineInstance.stopWindow();
}
I've taken some other (nothing that could cause the problem) stuff from my posted code, but this is it for the window stuff...
Thing is, when I run it, I just get a quick window that opens, and then it closes almost instantaneously. What is causing this sudden termination? Or, if worded wrong, what do I need to do to keep it open?
Thanks so much!
FlyingIsFun1217