Help my program wont open.
Code:
#include "SDL.h"
#include "SDL_opengl.h"
#include <iostream>
#include <string>
int main(int argc, char* args[])
{
SDL_Init(SDL_INIT_EVERYTHING);
//Opengl memory usage
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, 32);
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,1);
SDL_WM_SetCaption( "My first game", NULL );
SDL_SetVideoMode(600,400,32, SDL_OPENGL );
glClearColor(1,1,1,1);
glViewport(0,0,600,400);
//Use this model
glShadeModel(GL_SMOOTH);
//glprojection=2D
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//not 3d
glDisable(GL_DEPTH_TEST);
std::cout << "OpenGL is running\n";
std::cout << "Main loop has started\n";
bool isRunning = true;
SDL_Event event;
while ( isRunning )
{
while ( SDL_PollEvent(&event) )
{
if ( event.type == SDL_QUIT )
{
isRunning = false;
}
}
}
std::cin.ignore();
std::cin.get();
SDL_Quit();
return 0;
}
It is suppose to open as a window but when i run it nothing happens. I see it in task manager as a open process but not window or command prompt open. SDL_Delay and cin.get dont work. Can anyone see my problem? This is my first program in c++. Im usung code blocks with mingw compiler