-
Notifications
You must be signed in to change notification settings - Fork 0
/
fts.cpp
80 lines (73 loc) · 2.1 KB
/
fts.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// ************************************************************************** //
// //
// ::: :::::::: //
// fts.cpp :+: :+: :+: //
// +:+ +:+ +:+ //
// By: jmoiroux <jmoiroux@student.42.fr> +#+ +:+ +#+ //
// +#+#+#+#+#+ +#+ //
// Created: 2015/01/31 16:09:57 by jmoiroux #+# #+# //
// Updated: 2015/01/31 16:09:58 by jmoiroux ### ########.fr //
// //
// ************************************************************************** //
#include "main.hpp"
#include "Map.class.hpp"
void keyboard(unsigned char touche, int x, int y)
{
(void)x;
(void)y;
t_data * d = getData();
while (42)
{
if ( touche == 'q' || touche == 27 ) {
d->map->delData(d);
if ( true == DEBUGG) {
d->debug << "\t!!!! Exit Success !!!! from 'ECHAP' 'Q'" << std::endl;
}
d->debug.close();
std::free( d );
exit(0);
}
else if ( touche == 32 ) {
if ( true == DEBUGG) {
d->debug << "\t!!!! Keyboard Pause == " << d->pause << std::endl;
}
if ( false == d->pause )
d->pause = true;
else
d->pause = false;
glutPostRedisplay();
return;
}
else if ( touche == 's' ) {
if ( true == DEBUGG) {
d->debug << "\t!!!! Keyboard 'S' == START" << std::endl;
}
d->pause = false;
glutPostRedisplay();
return;
}
else {
d->map->delData( d );
if ( true == DEBUGG ) {
d->debug << "\t!!!! ELSE Exit Success !!!! from keyboard" << std::endl;
}
d->debug.close();
std::free( d );
exit(0);
}
}
}
void timer(int extra) {
glutPostRedisplay();
glutTimerFunc(0, timer, 0);
}
t_data * getData( void ) {
static t_data * d = NULL;
if ( d == NULL ) {
d = new t_data;
if ( d == NULL)
return NULL;
return d;
}
return d;
}