]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
switched to 32 bits
authorClyne Sullivan <tullivan99@gmail.com>
Mon, 7 Sep 2015 14:40:26 +0000 (10:40 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Mon, 7 Sep 2015 14:40:26 +0000 (10:40 -0400)
Makefile
src/main.cpp

index 28effccbc4f7be06b481cc732e51c2b140b9151d..51529c2f8bd9560bd7a96edcc32a99783daa844b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 FLAGS_LINUX = -lGL                 -lSDL_image
 FLAGS_WIN32 = -lopengl32 -lmingw32 -lSDL2_Image
-FLAGS = -Wall -Werror -lSDL2main -lSDL2
+FLAGS = -m32 -Wall -Werror -lSDL2main -lSDL2
 
 all:
        @g++ src/main.cpp -o main $(FLAGS_LINUX) $(FLAGS)
index 94e49343636889d8c03befdaf97a720dbdf3e073..54073892187b9b53381434a99c43e787b0b5d21a 100644 (file)
@@ -1,4 +1,5 @@
 #include <iostream>
+#include <cstdlib>
 #include <SDL2/SDL.h>
 #include <SDL2/SDL_opengl.h>
 
@@ -20,6 +21,7 @@ int main(int argc,char **argv){
     if(SDL_Init(SDL_INIT_VIDEO) < 0){
                std::cout << "SDL was not able to initialize! Error: " << SDL_GetError() << std::endl;
        }else{
+               atexit(SDL_Quit);
                //Turn on double Buffering
         SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
         //create the window
@@ -41,7 +43,7 @@ int main(int argc,char **argv){
                 //set renderer
                 gRenderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
                 if(gRenderer == NULL){
-                    std::cout << "The variable 'gRenderer' was not able to initialize! Error: " << SDL_GetError() << std::endl;\
+                    std::cout << "The variable 'gRenderer' was not able to initialize! Error: " << SDL_GetError() << std::endl;
                 }
                 //background white
                 SDL_FillRect(renderSurface, NULL, SDL_MapRGB(renderSurface->format, 0xFF, 0xFF, 0xFF));
@@ -53,6 +55,5 @@ int main(int argc,char **argv){
     //closes the window and frees resources
     SDL_GL_DeleteContext(mainGLContext);
     SDL_DestroyWindow(window);
-    SDL_Quit();
     return 0;
 }