Debut SAE DEV
This commit is contained in:
parent
5d7833b366
commit
5bc110a71c
32
APL1.1/SAE11_2021/Makefile
Normal file
32
APL1.1/SAE11_2021/Makefile
Normal file
@ -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
|
48
APL1.1/SAE11_2021/graph_sup.c
Normal file
48
APL1.1/SAE11_2021/graph_sup.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include "utils.h"
|
||||
#include <graph.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
10
APL1.1/SAE11_2021/graph_sup.h
Normal file
10
APL1.1/SAE11_2021/graph_sup.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef _GRAPH_SUP_H
|
||||
#define _GRAPH_SUP_H
|
||||
|
||||
int RegisterInputs(char * screen);
|
||||
|
||||
int DrawNextFrame(void);
|
||||
|
||||
void DrawGraphics(char * screen);
|
||||
|
||||
#endif
|
0
APL1.1/SAE11_2021/lib_menu/menu.c
Normal file
0
APL1.1/SAE11_2021/lib_menu/menu.c
Normal file
4
APL1.1/SAE11_2021/lib_menu/menu.h
Normal file
4
APL1.1/SAE11_2021/lib_menu/menu.h
Normal file
@ -0,0 +1,4 @@
|
||||
#ifndef _MENU_H
|
||||
#define _MENU_H
|
||||
|
||||
#endif
|
0
APL1.1/SAE11_2021/lib_menu/menu_graphique.c
Normal file
0
APL1.1/SAE11_2021/lib_menu/menu_graphique.c
Normal file
4
APL1.1/SAE11_2021/lib_menu/menu_graphique.h
Normal file
4
APL1.1/SAE11_2021/lib_menu/menu_graphique.h
Normal file
@ -0,0 +1,4 @@
|
||||
#ifndef _MENU_GRAPHIQUE_H
|
||||
#define _MENU_GRAPHIQUE_H
|
||||
|
||||
#endif
|
4
APL1.1/SAE11_2021/lib_menu/menu_logique.c
Normal file
4
APL1.1/SAE11_2021/lib_menu/menu_logique.c
Normal file
@ -0,0 +1,4 @@
|
||||
#ifndef _MENU_LOGIQUE_H
|
||||
#define _MENU_LOGIQUE_H
|
||||
|
||||
#endif
|
0
APL1.1/SAE11_2021/lib_menu/menu_logique.h
Normal file
0
APL1.1/SAE11_2021/lib_menu/menu_logique.h
Normal file
6
APL1.1/SAE11_2021/lib_taquin/taquin.c
Normal file
6
APL1.1/SAE11_2021/lib_taquin/taquin.c
Normal file
@ -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) {
|
||||
|
||||
}
|
6
APL1.1/SAE11_2021/lib_taquin/taquin.h
Normal file
6
APL1.1/SAE11_2021/lib_taquin/taquin.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _TAQUIN_H
|
||||
#define _TAQUIN_H
|
||||
|
||||
void CreateTaquin(char * filename, int rows, int columns);
|
||||
|
||||
#endif
|
0
APL1.1/SAE11_2021/lib_taquin/taquin_graphique.c
Normal file
0
APL1.1/SAE11_2021/lib_taquin/taquin_graphique.c
Normal file
6
APL1.1/SAE11_2021/lib_taquin/taquin_graphique.h
Normal file
6
APL1.1/SAE11_2021/lib_taquin/taquin_graphique.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _TAQUIN_GRAPHIQUE_H
|
||||
#define _TAQUIN_GRAPHIQUE_H
|
||||
|
||||
|
||||
|
||||
#endif
|
0
APL1.1/SAE11_2021/lib_taquin/taquin_logique.c
Normal file
0
APL1.1/SAE11_2021/lib_taquin/taquin_logique.c
Normal file
6
APL1.1/SAE11_2021/lib_taquin/taquin_logique.h
Normal file
6
APL1.1/SAE11_2021/lib_taquin/taquin_logique.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _TAQUIN_LOGIQUE_H
|
||||
#define _TAQUIN_LOGIQUE_H
|
||||
|
||||
|
||||
|
||||
#endif
|
24
APL1.1/SAE11_2021/main.c
Normal file
24
APL1.1/SAE11_2021/main.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <graph.h>
|
||||
#include <time.h>
|
||||
#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;
|
||||
}
|
6
APL1.1/SAE11_2021/main.h
Normal file
6
APL1.1/SAE11_2021/main.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _MAIN_H
|
||||
#define _MAIN_H
|
||||
|
||||
|
||||
|
||||
#endif
|
5
APL1.1/SAE11_2021/utils.c
Normal file
5
APL1.1/SAE11_2021/utils.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <math.h>
|
||||
|
||||
double lerpf(double a, double b, double t) {
|
||||
return a + (b - a) * t;
|
||||
}
|
6
APL1.1/SAE11_2021/utils.h
Normal file
6
APL1.1/SAE11_2021/utils.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _UTILS_H
|
||||
#define _UTILS_H
|
||||
|
||||
double lerpf(double a, double b, double t);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user