Show profiling information on key press

This commit is contained in:
2014-07-01 01:43:54 +02:00
committed by Valeriano A.R
parent 8a61c17d5c
commit 6f77d71e86
3 changed files with 25 additions and 9 deletions

View File

@@ -378,6 +378,26 @@ void GameLib_DrawLoop(float f){
t_draw+=Time_GetTime()-time;
fdraw_count++;
if(Input_GetKey(InputKey_DumpProfiling)==InputKey_Pressed){
printf("Profiling:::::::::\n");
if(fproc_count>0){
printf("t_proc.....:%6lld\n",t_proc/fproc_count);
printf("t_col......:%6lld\n",t_col/fproc_count);
printf("t_over.....:%6lld\n",t_over/fproc_count);
printf("t_postproc.:%6lld\n",t_postproc/fproc_count);
}
if(fdraw_count>0){
printf("t_draw.....:%6lld\n",t_draw/fdraw_count);
}
t_proc=0;
t_col=0;
t_over=0;
t_postproc=0;
t_draw=0;
fproc_count=0;
fdraw_count=0;
}
}
@@ -405,15 +425,6 @@ void GameLib_Loop(
fproc_count=0;
fdraw_count=0;
Draw_Loop(GameLib_ProcLoop,GameLib_DrawLoop);
if (gamelib_debug) {
printf("Profiling:::::::::\n");
printf("t_proc.....:%6lld\n",t_proc/fproc_count);
printf("t_col......:%6lld\n",t_col/fproc_count);
printf("t_over.....:%6lld\n",t_over/fproc_count);
printf("t_postproc.:%6lld\n",t_postproc/fproc_count);
printf("t_draw.....:%6lld\n",t_draw/fdraw_count);
}
}

View File

@@ -66,6 +66,8 @@ void Input_Frame(){
Input_SetKey(InputKey_Right,keys[SDLK_RIGHT]);
Input_SetKey(InputKey_Jump,keys[SDLK_SPACE]);
Input_SetKey(InputKey_Continue,keys[SDLK_RETURN]|keys[SDLK_KP_ENTER]);
Input_SetKey(InputKey_DumpProfiling,keys[SDLK_p]);
}

View File

@@ -33,6 +33,9 @@ typedef enum {
InputKey_Right,
InputKey_Jump,
InputKey_Continue,
InputKey_DumpProfiling,
InputKey_Max
} InputKey;