- [NEW] system.fps()

This commit is contained in:
2025-05-30 17:43:43 +02:00
parent 3d14c33971
commit b6e5dca277
3 changed files with 20 additions and 1 deletions

View File

@@ -23,7 +23,9 @@ struct surface_t {
uint32_t size;
};
int fps=0;
int fps_counter=0;
uint32_t fps_timer=0;
char window_title[256];
char config_folder[256];
uint16_t screen_width = 160;
@@ -475,6 +477,12 @@ int main(int argc,char*argv[]){
SDL_UnlockTexture(mini_bak);
SDL_RenderCopy(mini_ren, mini_bak, NULL, NULL);
SDL_RenderPresent(mini_ren);
fps_counter++;
if (SDL_GetTicks()>=(fps_timer+1000)) {
fps = fps_counter;
fps_counter=0;
fps_timer = SDL_GetTicks();
}
}
lua_quit();
quitaudio();
@@ -1146,6 +1154,10 @@ int rnd(int x) {
return rand()%x;
}
int getfps() {
return fps;
}
void playmusic(const char *filename, const int loop) {
int size;
char *buffer = file_getfilebuffer(filename, size);