-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfpstest.c
31 lines (29 loc) · 834 Bytes
/
fpstest.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
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdint.h>
#include <libdragon.h>
int framecounter = 0;
int framedisplay = 0;
void frameratecalc(int ovfl) {
framedisplay = framecounter;
framecounter = 0;
}
int main() {
surface_t *_dsp;
char buffer[15];
debug_init(DEBUG_FEATURE_LOG_ISVIEWER);
display_init(RESOLUTION_256x240, DEPTH_16_BPP, 2, GAMMA_NONE, FILTERS_RESAMPLE);
controller_init();
timer_init();
new_timer(TIMER_TICKS(1000000), TF_CONTINUOUS, frameratecalc);
uint32_t color = graphics_make_color(0, 0, 0, 255);
while(true) {
sprintf(buffer, "FPS: %d", framedisplay);
_dsp = display_get();
graphics_fill_screen(_dsp, color);
graphics_draw_text(_dsp, 10, 10, buffer);
display_show(_dsp);
framecounter++;
}
}