From 5bc110a71c178dbe4e8eb753d7c9320ac28b3fab Mon Sep 17 00:00:00 2001 From: HORVILLE Ewen Date: Mon, 22 Nov 2021 17:29:33 +0100 Subject: [PATCH] Debut SAE DEV --- APL1.1/SAE11_2021/Makefile | 32 +++++++++++++ APL1.1/SAE11_2021/graph_sup.c | 48 +++++++++++++++++++ APL1.1/SAE11_2021/graph_sup.h | 10 ++++ APL1.1/SAE11_2021/lib_menu/menu.c | 0 APL1.1/SAE11_2021/lib_menu/menu.h | 4 ++ APL1.1/SAE11_2021/lib_menu/menu_graphique.c | 0 APL1.1/SAE11_2021/lib_menu/menu_graphique.h | 4 ++ APL1.1/SAE11_2021/lib_menu/menu_logique.c | 4 ++ APL1.1/SAE11_2021/lib_menu/menu_logique.h | 0 APL1.1/SAE11_2021/lib_taquin/taquin.c | 6 +++ APL1.1/SAE11_2021/lib_taquin/taquin.h | 6 +++ .../SAE11_2021/lib_taquin/taquin_graphique.c | 0 .../SAE11_2021/lib_taquin/taquin_graphique.h | 6 +++ APL1.1/SAE11_2021/lib_taquin/taquin_logique.c | 0 APL1.1/SAE11_2021/lib_taquin/taquin_logique.h | 6 +++ APL1.1/SAE11_2021/main.c | 24 ++++++++++ APL1.1/SAE11_2021/main.h | 6 +++ APL1.1/SAE11_2021/utils.c | 5 ++ APL1.1/SAE11_2021/utils.h | 6 +++ 19 files changed, 167 insertions(+) create mode 100644 APL1.1/SAE11_2021/Makefile create mode 100644 APL1.1/SAE11_2021/graph_sup.c create mode 100644 APL1.1/SAE11_2021/graph_sup.h create mode 100644 APL1.1/SAE11_2021/lib_menu/menu.c create mode 100644 APL1.1/SAE11_2021/lib_menu/menu.h create mode 100644 APL1.1/SAE11_2021/lib_menu/menu_graphique.c create mode 100644 APL1.1/SAE11_2021/lib_menu/menu_graphique.h create mode 100644 APL1.1/SAE11_2021/lib_menu/menu_logique.c create mode 100644 APL1.1/SAE11_2021/lib_menu/menu_logique.h create mode 100644 APL1.1/SAE11_2021/lib_taquin/taquin.c create mode 100644 APL1.1/SAE11_2021/lib_taquin/taquin.h create mode 100644 APL1.1/SAE11_2021/lib_taquin/taquin_graphique.c create mode 100644 APL1.1/SAE11_2021/lib_taquin/taquin_graphique.h create mode 100644 APL1.1/SAE11_2021/lib_taquin/taquin_logique.c create mode 100644 APL1.1/SAE11_2021/lib_taquin/taquin_logique.h create mode 100644 APL1.1/SAE11_2021/main.c create mode 100644 APL1.1/SAE11_2021/main.h create mode 100644 APL1.1/SAE11_2021/utils.c create mode 100644 APL1.1/SAE11_2021/utils.h diff --git a/APL1.1/SAE11_2021/Makefile b/APL1.1/SAE11_2021/Makefile new file mode 100644 index 0000000..5e12079 --- /dev/null +++ b/APL1.1/SAE11_2021/Makefile @@ -0,0 +1,32 @@ +taquin : main.o taquin.o utils.o graph_sup.o + gcc -o taquin.out main.o taquin.o utils.o graph_sup.o -lgraph -lm + +main.o : main.c main.h + gcc -c main.c + +utils.o : utils.c utils.h + gcc -c utils.c + +graph_sup.o : graph_sup.c graph_sup.h + gcc -c graph_sup.c + +taquin.o : lib_taquin/taquin.c lib_taquin/taquin.h + gcc -c lib_taquin/taquin.c + +menu.o : lib_menu/menu.c lib_menu/menu.h + gcc -c lib_menu/menu.c + +taquin_graphique.o : lib_taquin/taquin_graphique.c lib_taquin/taquin_graphique.h + gcc -c lib_taquin/taquin_graphique.c + +taquin_logique.o : lib_taquin/taquin_logique.c lib_taquin/taquin_logique.h + gcc -c lib_taquin/taquin_logique.c + +menu_graphique.o : lib_menu/menu_graphique.c lib_menu/menu_graphique.h + gcc -c lib_menu/menu_graphique.c + +menu_logique.o : lib_menu/menu_logique.c lib_menu/menu_logique.h + gcc -c lib_menu/menu_logique.c + +clean : + rm -f *.o \ No newline at end of file diff --git a/APL1.1/SAE11_2021/graph_sup.c b/APL1.1/SAE11_2021/graph_sup.c new file mode 100644 index 0000000..96124f2 --- /dev/null +++ b/APL1.1/SAE11_2021/graph_sup.c @@ -0,0 +1,48 @@ +#include "utils.h" +#include +#include +#include + +#define FPS 60.0 + +int RegisterInputs(char * screen) { + if (ToucheEnAttente() > 0) { + int key = Touche(); + + if (key == XK_Escape) return -1; + + if (screen == "main_menu") { + + } else if (screen == "taquin") { + + } + } + + return 0; +} + +double delta = (1/FPS)*1000000; +unsigned long suivant = (1/FPS)*1000000; + +int DrawNextFrame() { + if (Microsecondes() >= suivant) { + suivant = Microsecondes() + delta; + return 1; + } + + return 0; +} + +double a = 0; +void DrawGraphics(char * screen) { + couleur black = CouleurParNom("black"); + couleur white = CouleurParNom("white"); + if (strcmp(screen, "main_menu") == 0) { + a += 1/FPS; + EffacerEcran(white); + ChoisirCouleurDessin(black); + char str[20]; + sprintf(str, "Temps : %f", a); + EcrireTexte(100, 100, str, 2); + } +} \ No newline at end of file diff --git a/APL1.1/SAE11_2021/graph_sup.h b/APL1.1/SAE11_2021/graph_sup.h new file mode 100644 index 0000000..6411c77 --- /dev/null +++ b/APL1.1/SAE11_2021/graph_sup.h @@ -0,0 +1,10 @@ +#ifndef _GRAPH_SUP_H +#define _GRAPH_SUP_H + +int RegisterInputs(char * screen); + +int DrawNextFrame(void); + +void DrawGraphics(char * screen); + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/lib_menu/menu.c b/APL1.1/SAE11_2021/lib_menu/menu.c new file mode 100644 index 0000000..e69de29 diff --git a/APL1.1/SAE11_2021/lib_menu/menu.h b/APL1.1/SAE11_2021/lib_menu/menu.h new file mode 100644 index 0000000..78acc9e --- /dev/null +++ b/APL1.1/SAE11_2021/lib_menu/menu.h @@ -0,0 +1,4 @@ +#ifndef _MENU_H +#define _MENU_H + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/lib_menu/menu_graphique.c b/APL1.1/SAE11_2021/lib_menu/menu_graphique.c new file mode 100644 index 0000000..e69de29 diff --git a/APL1.1/SAE11_2021/lib_menu/menu_graphique.h b/APL1.1/SAE11_2021/lib_menu/menu_graphique.h new file mode 100644 index 0000000..d1460a1 --- /dev/null +++ b/APL1.1/SAE11_2021/lib_menu/menu_graphique.h @@ -0,0 +1,4 @@ +#ifndef _MENU_GRAPHIQUE_H +#define _MENU_GRAPHIQUE_H + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/lib_menu/menu_logique.c b/APL1.1/SAE11_2021/lib_menu/menu_logique.c new file mode 100644 index 0000000..b2728d9 --- /dev/null +++ b/APL1.1/SAE11_2021/lib_menu/menu_logique.c @@ -0,0 +1,4 @@ +#ifndef _MENU_LOGIQUE_H +#define _MENU_LOGIQUE_H + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/lib_menu/menu_logique.h b/APL1.1/SAE11_2021/lib_menu/menu_logique.h new file mode 100644 index 0000000..e69de29 diff --git a/APL1.1/SAE11_2021/lib_taquin/taquin.c b/APL1.1/SAE11_2021/lib_taquin/taquin.c new file mode 100644 index 0000000..3a2cb6b --- /dev/null +++ b/APL1.1/SAE11_2021/lib_taquin/taquin.c @@ -0,0 +1,6 @@ +#include "utils.h" + +//Initialise le Taquin, la fonction appelle la création graphique et logique du Taquin. +void CreateTaquin(char * filename, int rows, int columns) { + +} \ No newline at end of file diff --git a/APL1.1/SAE11_2021/lib_taquin/taquin.h b/APL1.1/SAE11_2021/lib_taquin/taquin.h new file mode 100644 index 0000000..0f52bc5 --- /dev/null +++ b/APL1.1/SAE11_2021/lib_taquin/taquin.h @@ -0,0 +1,6 @@ +#ifndef _TAQUIN_H +#define _TAQUIN_H + +void CreateTaquin(char * filename, int rows, int columns); + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/lib_taquin/taquin_graphique.c b/APL1.1/SAE11_2021/lib_taquin/taquin_graphique.c new file mode 100644 index 0000000..e69de29 diff --git a/APL1.1/SAE11_2021/lib_taquin/taquin_graphique.h b/APL1.1/SAE11_2021/lib_taquin/taquin_graphique.h new file mode 100644 index 0000000..0af202d --- /dev/null +++ b/APL1.1/SAE11_2021/lib_taquin/taquin_graphique.h @@ -0,0 +1,6 @@ +#ifndef _TAQUIN_GRAPHIQUE_H +#define _TAQUIN_GRAPHIQUE_H + + + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/lib_taquin/taquin_logique.c b/APL1.1/SAE11_2021/lib_taquin/taquin_logique.c new file mode 100644 index 0000000..e69de29 diff --git a/APL1.1/SAE11_2021/lib_taquin/taquin_logique.h b/APL1.1/SAE11_2021/lib_taquin/taquin_logique.h new file mode 100644 index 0000000..31a035f --- /dev/null +++ b/APL1.1/SAE11_2021/lib_taquin/taquin_logique.h @@ -0,0 +1,6 @@ +#ifndef _TAQUIN_LOGIQUE_H +#define _TAQUIN_LOGIQUE_H + + + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/main.c b/APL1.1/SAE11_2021/main.c new file mode 100644 index 0000000..aa12107 --- /dev/null +++ b/APL1.1/SAE11_2021/main.c @@ -0,0 +1,24 @@ +#include +#include +#include +#include +#include "utils.h" +#include "graph_sup.h" + +#include "lib_taquin/taquin.h" +#include "lib_menu/menu.h" + +int main(void) { + InitialiserGraphique(); + CreerFenetre(100, 100, 1200, 700); + while (1) { + if (RegisterInputs("main_menu") == -1) return EXIT_SUCCESS; + + int can_draw = DrawNextFrame(); + if (can_draw == 1) { + DrawGraphics("main_menu"); + } + } + FermerGraphique(); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/APL1.1/SAE11_2021/main.h b/APL1.1/SAE11_2021/main.h new file mode 100644 index 0000000..a03f327 --- /dev/null +++ b/APL1.1/SAE11_2021/main.h @@ -0,0 +1,6 @@ +#ifndef _MAIN_H +#define _MAIN_H + + + +#endif \ No newline at end of file diff --git a/APL1.1/SAE11_2021/utils.c b/APL1.1/SAE11_2021/utils.c new file mode 100644 index 0000000..e70e3c4 --- /dev/null +++ b/APL1.1/SAE11_2021/utils.c @@ -0,0 +1,5 @@ +#include + +double lerpf(double a, double b, double t) { + return a + (b - a) * t; +} \ No newline at end of file diff --git a/APL1.1/SAE11_2021/utils.h b/APL1.1/SAE11_2021/utils.h new file mode 100644 index 0000000..36a37b0 --- /dev/null +++ b/APL1.1/SAE11_2021/utils.h @@ -0,0 +1,6 @@ +#ifndef _UTILS_H +#define _UTILS_H + +double lerpf(double a, double b, double t); + +#endif \ No newline at end of file