int main(int argc,char **argv){
//runs start-up procedures
- if(SDL_Init(SDL_INIT_VIDEO) < 0){
- std::cout << "SDL was not able to initialize! Error: " << SDL_GetError() << std::endl;
- return -1;
- }else{
- atexit(SDL_Quit);
+ if(!SDL_Init(SDL_INIT_VIDEO)){
+ atexit(SDL_Quit);
+ if(!(IMG_Init(IMG_INIT_PNG)&IMG_INIT_PNG)){
+ std::cout<<"Could not init image libraries!\n"<<std::endl;
+ return -1;
+ }
+ atexit(IMG_Quit);
//Turn on double Buffering
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
//create the window
| SDL_WINDOW_FULLSCREEN
#endif // FULLSCREEN
);
- if(window == NULL){
- std::cout << "The window failed to generate! Error: " << SDL_GetError() << std::endl;
- return -1;
- }else{
- //set OpenGL context
+ if(window){
+ //set OpenGL context
mainGLContext = SDL_GL_CreateContext(window);
if(mainGLContext == NULL){
std::cout << "The OpenGL context failed to initialize! Error: " << SDL_GetError() << std::endl;
}
- }
- }
+ }else{
+ std::cout << "The window failed to generate! Error: " << SDL_GetError() << std::endl;
+ return -1;
+ }
+ }else{
+ std::cout << "SDL was not able to initialize! Error: " << SDL_GetError() << std::endl;
+ return -1;
+ }
/**************************