merge
This commit is contained in:
11
Makefile
11
Makefile
@@ -1,7 +1,7 @@
|
||||
# Variable
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra $(shell pkg-config --cflags --libs sdl2)
|
||||
OBJ = main.o function.o
|
||||
OBJ = main.o function.o display.o
|
||||
TARGET = sokoban
|
||||
|
||||
all: $(TARGET)
|
||||
@@ -9,11 +9,14 @@ all: $(TARGET)
|
||||
$(TARGET): $(OBJ)
|
||||
$(CC) $(CFLAGS) $(OBJ) -o $(TARGET)
|
||||
|
||||
main.o : main.c
|
||||
main.o : main.c function.h
|
||||
$(CC) $(CFLAGS) -c main.c
|
||||
|
||||
function.o : function.c
|
||||
$(CC) $(CFLAGS) -c function
|
||||
function.o : function.c function.h
|
||||
$(CC) $(CFLAGS) -c function.c
|
||||
|
||||
display.o: display.c display.h
|
||||
$(CC) $(CFLAGS) -c display.c
|
||||
|
||||
clean :
|
||||
rm -f $(OBJ) $(TARGET)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include "display.h"
|
||||
|
||||
void screenDisplay( unsigned short int **tab,int size)
|
||||
{
|
||||
@@ -8,6 +9,7 @@ void screenDisplay( unsigned short int **tab,int size)
|
||||
{
|
||||
printf("%hu ",tab[i][j]);
|
||||
}
|
||||
puts("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
7
display.h
Normal file
7
display.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef DISPLAY_H
|
||||
#define DISPLAY_H
|
||||
|
||||
void screenDisplay( unsigned short int **tab,int size);
|
||||
|
||||
#endif // !DISPLAY_H
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
unsigned short int **creatArea2D(const unsigned int N)
|
||||
{
|
||||
unsigned short int **tab2d;
|
||||
tab2d = malloc(sizeof(unsigned short int* ) * N);
|
||||
tab2d = calloc(N, sizeof(unsigned short int* ));
|
||||
if (tab2d == NULL)
|
||||
{
|
||||
return NULL;
|
||||
@@ -18,7 +18,7 @@ unsigned short int **creatArea2D(const unsigned int N)
|
||||
int i;
|
||||
for (i = 0; i < N && !fail; ++i)
|
||||
{
|
||||
tab2d[i] = malloc(sizeof(unsigned short int) * N);
|
||||
tab2d[i] = calloc(N, sizeof(unsigned short int));
|
||||
if (tab2d[i] == NULL)
|
||||
{
|
||||
fail = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifdef FONCTION_H
|
||||
#ifndef FONCTION_H
|
||||
#define FONCTION_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
Reference in New Issue
Block a user