720ee7f6 |
1 | #include <stdio.h>\r |
2 | #include <stdlib.h>\r |
3 | #include <unistd.h>\r |
4 | #include <sys/time.h>\r |
5 | #include "gp2x.h"\r |
6 | \r |
7 | void spend_cycles(int c);\r |
8 | \r |
9 | int main(void)\r |
10 | {\r |
11 | struct timeval tval; // timing\r |
12 | int thissec = 0, frames_done = 0;\r |
13 | \r |
14 | gp2x_init();\r |
15 | \r |
16 | for (;;)\r |
17 | {\r |
18 | gettimeofday(&tval, 0);\r |
19 | \r |
20 | if(thissec != tval.tv_sec)\r |
21 | {\r |
22 | thissec = tval.tv_sec;\r |
23 | \r |
24 | printf("frames_done: %i\n", frames_done);\r |
25 | frames_done = 0;\r |
26 | }\r |
27 | \r |
28 | \r |
29 | //gp2x_video_wait_vsync();\r |
30 | //usleep(1); // sleeps a minimum of ~20ms\r |
31 | //gp2x_video_flip(); // can be called ~430000 times/sec\r |
32 | spend_cycles(1000);\r |
33 | frames_done++;\r |
34 | }\r |
35 | \r |
36 | }\r |
37 | \r |