1+ #include <stdlib.h>
2+ #include <stdio.h>
3+ #include <SDL/SDL.h>
4+ #include <SDL/SDL_ttf.h>
5+ //#include <SDL/SDL_image.h>
6+ #include "funkey_prod_screens.h"
7+
8+ static int bright = 0 ;
9+
10+ /// -------------- FUNCTIONS IMPLEMENTATION --------------
11+ static int wait_event_loop (){
12+
13+ SDL_Event event ;
14+ int stop_menu_loop = 0 ;
15+ int prev_ms = 0 ;
16+ int res = EXIT_FAILURE ;
17+
18+ /// -------- Main loop ---------
19+ while (!stop_menu_loop )
20+ {
21+ /// -------- Handle Keyboard Events ---------
22+ while (SDL_PollEvent (& event ))
23+ switch (event .type )
24+ {
25+ case SDL_QUIT :
26+ stop_menu_loop = 1 ;
27+ break ;
28+ case SDL_KEYDOWN :
29+ switch (event .key .keysym .sym )
30+ {
31+
32+ case SDLK_m :
33+ stop_menu_loop = 1 ;
34+ res = ERROR_MANUAL_FAIL ;
35+ break ;
36+
37+ case SDLK_n :
38+ case SDLK_ESCAPE :
39+ stop_menu_loop = 1 ;
40+ res = 0 ;
41+ break ;
42+
43+ default :
44+ break ;
45+ }
46+ }
47+
48+ /* Fill screen random */
49+ SDL_Color current_color = {rand () % 128 + 128 * bright ,
50+ rand () % 256 + 128 * bright ,
51+ rand () % 256 + 128 * bright };
52+ SDL_FillRect (hw_surface , NULL , SDL_MapRGBA (hw_surface -> format ,
53+ current_color .r , current_color .g , current_color .b , 0 ) );
54+ bright = 1 - bright ;
55+
56+ /* To investigate but with Buildroot, we need this: */
57+ SDL_Flip (hw_surface );
58+
59+ /* Sleep for some time */
60+ //SDL_Delay(SLEEP_PERIOD_MS);
61+ }
62+
63+ return res ;
64+ }
65+
66+ int launch_prod_screen_tearingtest (int argc , char * argv []){
67+ SDL_Surface * text_surface = NULL ;
68+ SDL_Rect text_pos ;
69+
70+ /// Main loop
71+ int res = wait_event_loop ();
72+ return res ;
73+ }
0 commit comments