diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-07 15:28:36 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-07 15:28:36 -0400 |
commit | 51e40764ce718283c89422cd5e3d02d324c7d16c (patch) | |
tree | 74643c465b7d39f2a22840c6523c2aad77edcde4 | |
parent | ebf6608e077c8d76d7f189c93a40e9f55ce630ff (diff) |
Hey
-rw-r--r-- | include/UIClass.h | 11 | ||||
-rw-r--r-- | include/common.h | 24 | ||||
-rw-r--r-- | src/UIClass.cpp | 5 | ||||
-rw-r--r-- | src/UIClass.h | 18 | ||||
-rw-r--r-- | src/gameHeader.h | 23 | ||||
-rw-r--r-- | src/main.cpp | 17 |
6 files changed, 45 insertions, 53 deletions
diff --git a/include/UIClass.h b/include/UIClass.h new file mode 100644 index 0000000..c5d74c3 --- /dev/null +++ b/include/UIClass.h @@ -0,0 +1,11 @@ +#ifndef UICLASS_H +#define UICLASS_H + +#include <common.h> + +class UIClass { + public: + void handleEvents(); +}; + +#endif // UICLASS_H diff --git a/include/common.h b/include/common.h new file mode 100644 index 0000000..db0824b --- /dev/null +++ b/include/common.h @@ -0,0 +1,24 @@ +#ifndef COMMON_H +#define COMMON_H + +///THIS FILE IS USED FOR VARIABLES THAT WILL BE ACCESED BY MULTIPLE CLASSES/FILES + +#include <iostream> +#include <cstdlib> +#include <SDL2/SDL.h> +#include <SDL2/SDL_opengl.h> +#include <UIClass.h> + +#define SCREEN_WIDTH 1280 +#define SCREEN_HEIGHT 720 +//#define FULLSCREEN + +//SDL VARIABLES +extern SDL_Window *window; +extern SDL_Surface *renderSurface; +extern SDL_GLContext mainGLContext; + +//WINODWS VARIABLES +extern bool gameRunning; + +#endif // COMMON_H diff --git a/src/UIClass.cpp b/src/UIClass.cpp index 711440a..9cdf735 100644 --- a/src/UIClass.cpp +++ b/src/UIClass.cpp @@ -1,6 +1,7 @@ -#include "UIClass.h" +#include <UIClass.h> void UIClass::handleEvents(){ + SDL_Event e; while(SDL_PollEvent(&e)){ switch(e.type){ case SDL_QUIT: @@ -18,4 +19,4 @@ void UIClass::handleEvents(){ break; } } -}
\ No newline at end of file +} diff --git a/src/UIClass.h b/src/UIClass.h deleted file mode 100644 index 956dbb8..0000000 --- a/src/UIClass.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef UICLASS_H -#define UICLASS_H - -#include <iostream> -#include <cstdlib> -#include <SDL2/SDL.h> -#include <SDL2/SDL_opengl.h> - -extern SDL_Event e; -extern bool gameRunning; - -class UIClass{ - public: - void handleEvents(); - -}; - -#endif //UICLASS_H
\ No newline at end of file diff --git a/src/gameHeader.h b/src/gameHeader.h deleted file mode 100644 index f289527..0000000 --- a/src/gameHeader.h +++ /dev/null @@ -1,23 +0,0 @@ -///THIS FILE IS USED FOR VARIABLES THAT WILL BE ACCESED BY MULTIPLE CLASSES/FILES -#include <iostream> -#include <cstdlib> -#include <SDL2/SDL.h> -#include <SDL2/SDL_opengl.h> - -#include "UIClass.h" //This can access SDL_Event e, if it won't compile for you, move it down to right above the ui object definition I guess :P - -//SDL VARIABLES -SDL_Window *window = NULL; -SDL_Surface *renderSurface = NULL; -SDL_GLContext mainGLContext = NULL; - -//WINODWS VARIABLES -const float sh = SCREEN_HEIGHT; -const float sw = SCREEN_WIDTH; -bool gameRunning = true; -SDL_Event e; - -//OTHER VARIABLES -UIClass ui; - -//FUNCTIONS diff --git a/src/main.cpp b/src/main.cpp index f152963..78163db 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,15 +1,12 @@ -#include <iostream> -#include <cstdlib> -#include <SDL2/SDL.h> -#include <SDL2/SDL_opengl.h> +#include <common.h> -#define SCREEN_WIDTH 1280 -#define SCREEN_HEIGHT 720 -//#define FULLSCREEN +SDL_Window *window = NULL; +SDL_Surface *renderSurface = NULL; +SDL_GLContext mainGLContext = NULL; +bool gameRunning = true; -#include "gameHeader.h" - +UIClass ui; int main(int argc,char **argv){ //runs start-up procedures @@ -20,7 +17,7 @@ int main(int argc,char **argv){ //Turn on double Buffering SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); //create the window - window = SDL_CreateWindow("Independent Study v. Alpha -1.0", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL + window = SDL_CreateWindow("Independent Study v.0.1 alpha", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL #ifdef FULLSCREEN | SDL_WINDOW_FULLSCREEN #endif // FULLSCREEN |