48 lines
836 B
C
48 lines
836 B
C
|
#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);
|
||
|
}
|
||
|
}
|