aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2015-09-08 19:25:17 -0400
committerClyne Sullivan <tullivan99@gmail.com>2015-09-08 19:25:17 -0400
commit8dffb66d4aaddbf769f0fc3c40393f07ca10d0fb (patch)
treebb67908dc8f46cedf6faa492d6ca3c5b2cd57ac9 /src/main.cpp
parent3a7cab119abf27f3beebfa3f20df85bff798ff73 (diff)
Init'd SDL_image
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 27cc080..71b6595 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -11,11 +11,13 @@ Window win;
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
@@ -24,17 +26,20 @@ int main(int argc,char **argv){
| 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;
+ }
/**************************