From bec2261d1d18f850a35e4fbaf2473e48f826abb3 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Fri, 18 Nov 2016 19:43:52 -0700 Subject: [PATCH] whatever added include;src;whatever.h;updated makefile --- sdl/whatever/Makefile | 7 +++-- sdl/whatever/include/whatever.h | 44 +++++++++++++++++++++++++++++++ sdl/whatever/{ => src}/whatever.c | 40 +++------------------------- 3 files changed, 52 insertions(+), 39 deletions(-) create mode 100644 sdl/whatever/include/whatever.h rename sdl/whatever/{ => src}/whatever.c (89%) diff --git a/sdl/whatever/Makefile b/sdl/whatever/Makefile index 38ba9c3..a033e94 100644 --- a/sdl/whatever/Makefile +++ b/sdl/whatever/Makefile @@ -1,7 +1,7 @@ PREFIX=/usr #OBJS specifies which files to compile as part of the project -OBJS = whatever.c +OBJS = src/whatever.c #CC specifies which compiler to use CC = clang @@ -16,9 +16,12 @@ LINKER_FLAGS = -lSDL2 #OBJ_NAME specifies the name of our executable OBJ_NAME= whatever +#INCLUDES where the INCLUDE directory is +INCLUDES = -I./include + #This is the target that compiles our executable all : $(OBJS) - $(CC) $(OBJS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME) + $(CC) $(OBJS) $(COMPILER_FLAGS) $(INCLUDES) $(LINKER_FLAGS) -o $(OBJ_NAME) install : mkdir -p ${PREFIX}/share/${OBJ_NAME} cp ${OBJ_NAME} ${PREFIX}/share/${OBJ_NAME}/ diff --git a/sdl/whatever/include/whatever.h b/sdl/whatever/include/whatever.h new file mode 100644 index 0000000..861fd5c --- /dev/null +++ b/sdl/whatever/include/whatever.h @@ -0,0 +1,44 @@ +#ifndef WHATEVER_H +#define WHATEVER_H +/* start SDL and create a window */ +int init(); + +/* load the media durr */ +int loadMedia(); + +/* Free the surfaces and whatnot */ +void close_game(); + +/* Our main window */ +SDL_Window* gScreen; + +/* Our renderer */ +SDL_Renderer* gRenderer; + + +/*screen dimensions*/ +const int screen_width = 1024; +const int screen_height = 768; + +/* Surface for loading BMP */ +SDL_Surface* gTemp; + +/* Texture for background */ +SDL_Texture* gBackground_texture; + +/* Texture for characters */ +SDL_Texture* gPlayer; + +/* Player coors */ +SDL_Rect gPlayer_dest = { 0 }; + +/* Gamepads ! */ +SDL_Joystick* gGameController = NULL; + +/* deadzone, we don't want light taps to do anything */ +const int JOYSTICK_DEAD_ZONE = 8000; + + + + +#endif diff --git a/sdl/whatever/whatever.c b/sdl/whatever/src/whatever.c similarity index 89% rename from sdl/whatever/whatever.c rename to sdl/whatever/src/whatever.c index c1958fb..b60e308 100644 --- a/sdl/whatever/whatever.c +++ b/sdl/whatever/src/whatever.c @@ -1,46 +1,12 @@ #include "SDL2/SDL.h" + +#include "whatever.h" + //Write a function that moves an image based on which arrow keys are pressed. //something like //functionize, everything //void move_image(direction, image); -/* start SDL and create a window */ -int init(); - -/* load the media durr */ -int loadMedia(); - -/* Free the surfaces and whatnot */ -void close_game(); - -/* Our main window */ -SDL_Window* gScreen; - -/*screen dimensions*/ -const int screen_width = 1024; -const int screen_height = 768; - -/* Our renderer */ -SDL_Renderer* gRenderer; - -/* Surface for loading BMP */ -SDL_Surface* gTemp; - -/* Texture for background */ -SDL_Texture* gBackground_texture; - -/* Texture for characters */ -SDL_Texture* gPlayer; - -/* Player coors */ -SDL_Rect gPlayer_dest = { 0 }; - -/* Gamepads ! */ - SDL_Joystick* gGameController = NULL; - - /* deadzone, we don't want light taps to do anything */ - const int JOYSTICK_DEAD_ZONE = 8000; - int main ( int argc, char *argv[] ) { /* How fast our player moves */