display.h + fix screendisply

This commit is contained in:
2024-12-12 12:05:08 +01:00
parent 0d2079da68
commit a242ad81d0
5 changed files with 20 additions and 5 deletions

View File

@@ -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)

View File

@@ -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
View File

@@ -0,0 +1,7 @@
#ifndef DISPLAY_H
#define DISPLAY_H
void screenDisplay( unsigned short int **tab,int size);
#endif // !DISPLAY_H

View File

@@ -1,4 +1,4 @@
#ifdef FONCTION_H
#ifndef FONCTION_H
#define FONCTION_H
#include <stdlib.h>

3
main.c
View File

@@ -1,8 +1,11 @@
#include <stdio.h>
#include "function.h"
#include "display.h"
int main()
{
unsigned short int **tab2d = creatArea2D(5);
screenDisplay(tab2d, 5);
printf("main\n");
return 0;
}