- [NEW] system.fps()
This commit is contained in:
14
mini.cpp
14
mini.cpp
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user