From 51e40764ce718283c89422cd5e3d02d324c7d16c Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 7 Sep 2015 15:28:36 -0400 Subject: Hey --- include/UIClass.h | 11 +++++++++++ include/common.h | 24 ++++++++++++++++++++++++ src/UIClass.cpp | 5 +++-- src/UIClass.h | 18 ------------------ src/gameHeader.h | 23 ----------------------- src/main.cpp | 17 +++++++---------- 6 files changed, 45 insertions(+), 53 deletions(-) create mode 100644 include/UIClass.h create mode 100644 include/common.h delete mode 100644 src/UIClass.h delete mode 100644 src/gameHeader.h 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 + +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 +#include +#include +#include +#include + +#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 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 -#include -#include -#include - -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 -#include -#include -#include - -#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 -#include -#include -#include +#include -#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 -- cgit v1.2.3