]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
no AA (linux can\'t)
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 17 Sep 2015 10:30:10 +0000 (06:30 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 17 Sep 2015 10:30:10 +0000 (06:30 -0400)
src/main.cpp

index 73b1918aa484500e9c812499543d2bf235218c66..a60d52c347ffe2c6a3ad0caa8bd8d8039df1694f 100644 (file)
@@ -37,38 +37,38 @@ unsigned int millis(void){
 
 int main(int argc, char *argv[]){
        //runs start-up procedures
-    if(!SDL_Init(SDL_INIT_VIDEO)){
-       atexit(SDL_Quit);
-       if(!(IMG_Init(IMG_INIT_PNG|IMG_INIT_JPG)&(IMG_INIT_PNG|IMG_INIT_JPG))){
-                       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);
-        //ANTIALIASING!!!
-        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
-               SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16);
-        //create the window
-        window = SDL_CreateWindow("Independent Study v.0.2 alpha", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL
-                                  #ifdef FULLSCREEN
-                                  | SDL_WINDOW_FULLSCREEN
-                                  #endif // FULLSCREEN
-                                  );
-        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{
+    if(SDL_Init(SDL_INIT_VIDEO)){
                std::cout << "SDL was not able to initialize! Error: " << SDL_GetError() << std::endl;
                return -1;
        }
+    atexit(SDL_Quit);
+    if(!(IMG_Init(IMG_INIT_PNG|IMG_INIT_JPG)&(IMG_INIT_PNG|IMG_INIT_JPG))){
+               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);
+    //ANTIALIASING!!!
+    //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
+       //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16);
+    //create the window
+    window = SDL_CreateWindow("Independent Study v.0.2 alpha", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL
+                              #ifdef FULLSCREEN
+                              | SDL_WINDOW_FULLSCREEN
+                              #endif // FULLSCREEN
+                              );
+    if(window==NULL){
+               std::cout << "The window failed to generate! Error: " << SDL_GetError() << std::endl;
+               std::cout << "Window address: "<<window<<std::endl;
+        return -1;
+    }
+    //set OpenGL context
+    mainGLContext = SDL_GL_CreateContext(window);
+    if(mainGLContext == NULL){
+               std::cout << "The OpenGL context failed to initialize! Error: " << SDL_GetError() << std::endl;
+        return -1;
+    }
 
        glViewport(0,0,SCREEN_WIDTH, SCREEN_HEIGHT);
        glClearColor(.3,.5,.8,0);