Update compilation instruction

This commit is contained in:
JackCarterSmith 2021-01-10 13:11:02 +01:00
parent ff7924a197
commit 1c2c47bb1f
Signed by: JackCarterSmith
GPG Key ID: DB362B740828F843
3 changed files with 33 additions and 23 deletions

View File

@ -14,10 +14,23 @@ The game can do following:
## Compiling ## Compiling
Before compiling, you need to install both build suite (GCC/MSVC) with CMake and SDL2 libs. Before compiling, you need to install both build suite (GCC/MSVC) with CMake and SDL2 libs:
TODO... ```shell
apt update
apt install build-essential cmake libsdl2-dev libsdl2-image-dev
```
Clone the repo with submodules updated and launch cmake to prepare compile:
```shell
cd AST
mkdir build && cd build
cp -R ../data .
cmake ..
make
```
## Running ## Running
Simply run the program with "data" folder or use the launch script. Simply run the program with `data` folder (required) and `logs` folder (optional) or use the launch script.

View File

@ -3,12 +3,6 @@
#include <string.h> #include <string.h>
#include "arenaEngine.h" #include "arenaEngine.h"
#ifdef _WIN32
#define DATA_PATH(p) "data\\p"
#else
#define DATA_PATH(p) "data/p"
#endif
/* /*
* Arena generate functions * Arena generate functions
*/ */
@ -23,37 +17,39 @@ TILE *createTileList(void) {
tile_5 = calloc(1,sizeof(TILE)); tile_5 = calloc(1,sizeof(TILE));
tile_0->type_id = 0; tile_0->type_id = 0;
tile_0->texture = IMG_Load(DATA_PATH("tile_grass.png")); tile_0->texture = IMG_Load("data/tile_grass.png");
tile_0->canBeMined = 0; tile_0->canBeMined = 0;
tile_0->isGround = 1; tile_0->isGround = 1;
tile_0->nextTile = tile_1; tile_0->nextTile = tile_1;
if (!tile_0->texture) addLogWarn("GRASS tex failed!");
tile_1->type_id = 1; tile_1->type_id = 1;
tile_1->texture = IMG_Load(DATA_PATH("tile_rock.png")); tile_1->texture = IMG_Load("data/tile_rock.png");
tile_1->canBeMined = 0; tile_1->canBeMined = 0;
tile_1->isGround = 1; tile_1->isGround = 1;
tile_1->nextTile = tile_2; tile_1->nextTile = tile_2;
tile_2->type_id = 2; tile_2->type_id = 2;
tile_2->texture = IMG_Load(DATA_PATH("tile_tree.png")); tile_2->texture = IMG_Load("data/tile_tree.png");
tile_2->canBeMined = 0; tile_2->canBeMined = 0;
tile_2->isGround = 0; tile_2->isGround = 0;
tile_2->nextTile = tile_3; tile_2->nextTile = tile_3;
tile_3->type_id = 3; tile_3->type_id = 3;
tile_3->texture = IMG_Load(DATA_PATH("tile_water.png")); tile_3->texture = IMG_Load("data/tile_water.png");
tile_3->canBeMined = 0; tile_3->canBeMined = 0;
tile_3->isGround = 0; tile_3->isGround = 0;
tile_3->nextTile = tile_4; tile_3->nextTile = tile_4;
tile_4->type_id = 4; tile_4->type_id = 4;
tile_4->texture = IMG_Load(DATA_PATH("tile_gold.png")); tile_4->texture = IMG_Load("data/tile_gold.png");
tile_4->canBeMined = 1; tile_4->canBeMined = 1;
tile_4->isGround = 1; tile_4->isGround = 1;
tile_4->nextTile = tile_5; tile_4->nextTile = tile_5;
tile_5->type_id = 5; tile_5->type_id = 5;
tile_5->texture = IMG_Load(DATA_PATH("tile_spawn.png")); tile_5->texture = IMG_Load("data/tile_spawn.png");
tile_5->canBeMined = 0; tile_5->canBeMined = 0;
tile_5->isGround = 1; tile_5->isGround = 1;
tile_5->nextTile = NULL; tile_5->nextTile = NULL;
@ -73,10 +69,10 @@ PLAYER *createPlayerList(void) {
p0->Id = 0; p0->Id = 0;
p0->PositionX = 0; p0->PositionX = 0;
p0->PositionY = 0; p0->PositionY = 0;
p0->texture[DOWN] = IMG_Load(DATA_PATH("sprite_player_0.png")); p0->texture[DOWN] = IMG_Load("data/sprite_player_0.png");
p0->texture[UP] = IMG_Load(DATA_PATH("sprite_player_1.png")); p0->texture[UP] = IMG_Load("data/sprite_player_1.png");
p0->texture[LEFT] = IMG_Load(DATA_PATH("sprite_player_2.png")); p0->texture[LEFT] = IMG_Load("data/sprite_player_2.png");
p0->texture[RIGHT] = IMG_Load(DATA_PATH("sprite_player_3.png")); p0->texture[RIGHT] = IMG_Load("data/sprite_player_3.png");
p0->suiv = p1; p0->suiv = p1;
printf("Entrer le nom du joueur\n"); printf("Entrer le nom du joueur\n");
scanf("%s",p0->Name); scanf("%s",p0->Name);
@ -110,10 +106,10 @@ PLAYER *createPlayerList(void) {
p1->Id = 1; p1->Id = 1;
p1->PositionX = A_WIDTH-1; p1->PositionX = A_WIDTH-1;
p1->PositionY = A_HEIGHT-1; p1->PositionY = A_HEIGHT-1;
p1->texture[DOWN] = IMG_Load(DATA_PATH("sprite_ia_0.png")); p1->texture[DOWN] = IMG_Load("data/sprite_ia_0.png");
p1->texture[UP] = IMG_Load(DATA_PATH("sprite_ia_1.png")); p1->texture[UP] = IMG_Load("data/sprite_ia_1.png");
p1->texture[LEFT] = IMG_Load(DATA_PATH("sprite_ia_2.png")); p1->texture[LEFT] = IMG_Load("data/sprite_ia_2.png");
p1->texture[RIGHT] = IMG_Load(DATA_PATH("sprite_ia_3.png")); p1->texture[RIGHT] = IMG_Load("data/sprite_ia_3.png");
p1->suiv = p2; p1->suiv = p2;
strcpy(p1->Name,"SKY-NUT"); strcpy(p1->Name,"SKY-NUT");
p1->Race = random_lim(3)+1; p1->Race = random_lim(3)+1;

View File

@ -52,6 +52,7 @@ int main(int argc, char *argv[]) {
addLogInfo("Successfully created arena."); addLogInfo("Successfully created arena.");
addLogInfo("Display arena GUI..."); addLogInfo("Display arena GUI...");
//IMG_Init(IMG_INIT_JPG & IMG_INIT_PNG);
displayArena(arena, gameWindows, tile_ressources, A_HEIGHT, A_WIDTH, TILE_SIZE); displayArena(arena, gameWindows, tile_ressources, A_HEIGHT, A_WIDTH, TILE_SIZE);
while (updateArena(gameWindows,arena,tile_ressources,player_ressources)!=0) {} while (updateArena(gameWindows,arena,tile_ressources,player_ressources)!=0) {}