Skip to content

Commit

Permalink
[core] Create function to retrieve frame busy time (non-sleeping time)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmbkr authored Feb 4, 2024
1 parent c0c2e28 commit beee9ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/raylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ RLAPI Matrix GetCameraMatrix2D(Camera2D camera); // Get c
// Timing-related functions
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
RLAPI float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time)
RLAPI float GetFrameBusyTime(void); // Get the time spent actively updating and drawing a frame, excluding sleep time.
RLAPI double GetTime(void); // Get elapsed time in seconds since InitWindow()
RLAPI int GetFPS(void); // Get current FPS

Expand Down
7 changes: 7 additions & 0 deletions src/rcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,13 @@ float GetFrameTime(void)
return (float)CORE.Time.frame;
}


// Get the time spent actively updating and drawing a frame, excluding sleep time.
float GetFrameBusyTime(void)
{
return (float)(CORE.Time.update + CORE.Time.draw);
}

//----------------------------------------------------------------------------------
// Module Functions Definition: Custom frame control
//----------------------------------------------------------------------------------
Expand Down

0 comments on commit beee9ce

Please sign in to comment.