-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeyboardTester.c
39 lines (37 loc) · 991 Bytes
/
keyboardTester.c
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
/**
* @authors LOPES Marco, ISELI Cyril and RINGOT Gaëtan
* Purpose: Test keyboard manager
* Language: C
* Date : november 2016
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <pthread.h>
#include "keyboard.h"
#include "gfx.h"
/**
* Create SDL context and test keyboard manager
*
* @return EXIT_FAILURE or EXIT_SUCCESS
*/
int main() {
struct gfx_context_t *ctxt = gfx_create("Example", 2, 2);
if (!ctxt) {
fprintf(stderr, "Graphic mode initialization failed!\n");
return EXIT_FAILURE;
}
gfx_putpixel(ctxt, 0, 0, COLOR_RED);
gfx_present(ctxt);
bool end = false;
pthread_barrier_t displayInitialised;
pthread_barrier_init(&displayInitialised, NULL, 1);
paramsKeyboardSt paramsKeyboard;
paramsKeyboard.end = &end;
paramsKeyboard.displayInitialised = &displayInitialised;
printf("%d", end);
keyboard(¶msKeyboard);
printf("%d", end);
gfx_destroy(ctxt);
return EXIT_SUCCESS;
}