From 0268c79ebcd41e092b3fcadaa7fbdc213addda9e Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sat, 26 May 2018 22:42:25 +0200 Subject: [PATCH] Begin arena simulation --- IAEngine.c | 2 ++ arenaEngine.c | 18 ++++++++++++++++++ arenaEngine.h | 24 ++++++++++++++++++++++++ arenaGUI.c | 3 +++ arenaGUI.h | 6 ++++++ fileHandler.c | 15 +++++++++++++++ fileHandler.h | 6 ++++++ main.c | 10 ++++++++++ menuGUI.c | 25 +++++++++++++++++++++++++ menuGUI.h | 6 ++++++ playerInterface.c | 6 ++++++ playerInterface.h | 3 +++ 12 files changed, 124 insertions(+) create mode 100644 IAEngine.c create mode 100644 arenaEngine.c create mode 100644 arenaEngine.h create mode 100644 arenaGUI.c create mode 100644 arenaGUI.h create mode 100644 fileHandler.c create mode 100644 fileHandler.h create mode 100644 menuGUI.c create mode 100644 menuGUI.h diff --git a/IAEngine.c b/IAEngine.c new file mode 100644 index 0000000..2ab72ab --- /dev/null +++ b/IAEngine.c @@ -0,0 +1,2 @@ +#include +#include diff --git a/arenaEngine.c b/arenaEngine.c new file mode 100644 index 0000000..ff5695b --- /dev/null +++ b/arenaEngine.c @@ -0,0 +1,18 @@ +#include "arenaEngine.h" +#include +#include +#include "fileHandler.h" +#include +#include + +int initResources(tilesList) { + resOpen(); + + return 0; +} + +void genNewArena(int w, int h, ARENA_TILE* a[][]) { + a = malloc(sizeof(ARENA_TILE) * w * h); + + for +} diff --git a/arenaEngine.h b/arenaEngine.h new file mode 100644 index 0000000..d7729f7 --- /dev/null +++ b/arenaEngine.h @@ -0,0 +1,24 @@ +#ifndef ARENAENGINE_H_ +#define ARENAENGINE_H_ + + + +/* +typedef struct items{ + int type_id; + //texture? + int isFlat; + int minedId; + struct items; +}ITEMS; +*/ + +typedef struct a_tile{ + int type_id; + //texture? + int isFlat; + int canBeMined; + //struct a_tile nextTile; +}ARENA_TILE; + +#endif diff --git a/arenaGUI.c b/arenaGUI.c new file mode 100644 index 0000000..7382c56 --- /dev/null +++ b/arenaGUI.c @@ -0,0 +1,3 @@ +#include +#include +#include "SDL2/SDL.h" diff --git a/arenaGUI.h b/arenaGUI.h new file mode 100644 index 0000000..6a473a5 --- /dev/null +++ b/arenaGUI.h @@ -0,0 +1,6 @@ +#ifndef ARENAGUI_H_ +#define ARENAGUI_H_ + + + +#endif diff --git a/fileHandler.c b/fileHandler.c new file mode 100644 index 0000000..535eace --- /dev/null +++ b/fileHandler.c @@ -0,0 +1,15 @@ +#include +#include +#include + +int resOpen(char* filename, FILE* f) { + char fLoc[128]; + + strcpy(fLoc, "resources/"); + strcat(fLoc, filename); + f = fopen(fLoc, "rb"); + + if (f != NULL) return 0; + + return -1; +} diff --git a/fileHandler.h b/fileHandler.h new file mode 100644 index 0000000..7dfc698 --- /dev/null +++ b/fileHandler.h @@ -0,0 +1,6 @@ +#ifndef FILEHANDLER_H_ +#define FILEHANDLER_H_ + +int resOpen(char* filename); + +#endif diff --git a/main.c b/main.c index 60482f8..e94628a 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,16 @@ #include +#include +#include "logHelper.h" #include "SDL2/SDL.h" +#include "arenaEngine.h" + +#define A_WIDTH 100 //Real value is A_X + 1 +#define A_LENGHT 100 int main(int argc, char *argv[]) { + int arena[A_WIDTH][A_LENGHT]; + + + return EXIT_SUCCESS; } diff --git a/menuGUI.c b/menuGUI.c new file mode 100644 index 0000000..0545de3 --- /dev/null +++ b/menuGUI.c @@ -0,0 +1,25 @@ +#include +#include +#include "SDL2/SDL.h" + +void initDisplayLib() { + if (SDL_Init(SDL_INIT_VIDEO) != 0) { + printf("Erreur chargement librairie SDL ! %s\n",SDL_GetError()); + exit(EXIT_FAILURE); + } +} + +int createMainWindows() { + if (SDL_Init(SDL_INIT_VIDEO) != 0) { + printf("Erreur chargement librairie SDL ! %s\n",SDL_GetError()); + exit(EXIT_FAILURE); + } + + SDL_Window *main_test; + main_test = SDL_CreateWindow("My test windows", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 320, 140, SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS); + SDL_Delay(5000); + SDL_DestroyWindow(main_test); + + SDL_Quit(); + return EXIT_SUCCESS; +} diff --git a/menuGUI.h b/menuGUI.h new file mode 100644 index 0000000..cf4bccb --- /dev/null +++ b/menuGUI.h @@ -0,0 +1,6 @@ +#ifndef MENUGUI_H_ +#define MENUGUI_H_ + + + +#endif diff --git a/playerInterface.c b/playerInterface.c index c848f48..1760300 100644 --- a/playerInterface.c +++ b/playerInterface.c @@ -1,3 +1,7 @@ +#include "playerInterface.h" +#include +#include +#include "logHelper.h" #include "SDL2/SDL.h" void initDisplayLib() { @@ -16,3 +20,5 @@ void displayScreen(int scr_id) { SDL_Quit(); //return EXIT_SUCCESS; } + +void refreshScreen() {} diff --git a/playerInterface.h b/playerInterface.h index 99701f1..421be3b 100644 --- a/playerInterface.h +++ b/playerInterface.h @@ -1,7 +1,10 @@ #ifndef PLAYERINTERFACE_H_ #define PLAYERINTERFACE_H_ +enum scr_id{ARENA,MAIN_MENU,GAME_OVER}; + void initDisplayLib(); void displayScreen(int scr_id); +void refreshScreen(); #endif