summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2021-06-22 20:26:59 +0200
committerRay <[email protected]>2021-06-22 20:26:59 +0200
commit429c5a9a9add32b470115e8cd9e38aa811546e69 (patch)
tree8ce203c254120bee2d2e36c3333858f7cd2fd05e
parent7f2a071c5168daf0bf8c7ebbf73d75ba1833bb38 (diff)
downloadraylib-429c5a9a9add32b470115e8cd9e38aa811546e69.tar.gz
raylib-429c5a9a9add32b470115e8cd9e38aa811546e69.zip
Review and un-expose InitTimer()
Actually it's not required for SUPPORT_CUSTOM_FRAME_CONTROL
-rw-r--r--src/core.c11
-rw-r--r--src/raylib.h3
2 files changed, 9 insertions, 5 deletions
diff --git a/src/core.c b/src/core.c
index 41ef4b4f..38e6a5e7 100644
--- a/src/core.c
+++ b/src/core.c
@@ -599,6 +599,7 @@ extern void UnloadFontDefault(void); // [Module: text] Unloads default fo
//----------------------------------------------------------------------------------
// Module specific Functions Declaration
//----------------------------------------------------------------------------------
+static void InitTimer(void); // Initialize timer (hi-resolution if available)
static bool InitGraphicsDevice(int width, int height); // Initialize graphics device
static void SetupFramebuffer(int width, int height); // Setup main framebuffer
static void SetupViewport(int width, int height); // Set viewport for a provided width and height
@@ -839,6 +840,9 @@ void InitWindow(int width, int height, const char *title)
// Init hi-res timer
InitTimer();
+
+ // Initialize random seed
+ srand((unsigned int)time(NULL));
#if defined(SUPPORT_DEFAULT_FONT)
// Load default font
@@ -4679,10 +4683,8 @@ static void SetupFramebuffer(int width, int height)
}
// Initialize hi-resolution timer
-void InitTimer(void)
+static void InitTimer(void)
{
- srand((unsigned int)time(NULL)); // Initialize random seed
-
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
// High resolutions can also prevent the CPU power management system from entering power-saving modes.
@@ -5424,6 +5426,9 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
// Init hi-res timer
InitTimer();
+
+ // Initialize random seed
+ srand((unsigned int)time(NULL));
#if defined(SUPPORT_DEFAULT_FONT)
// Load default font
diff --git a/src/raylib.h b/src/raylib.h
index 020af527..ea3dc693 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -964,10 +964,9 @@ RLAPI const char *GetClipboardText(void); // Get clipboa
// NOTE: Those functions are intended for advance users that want full control over the frame processing
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents()
// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
-RLAPI void InitTimer(void); // Initialize timer (hi-resolution if available)
-RLAPI void WaitTime(float ms); // Wait for some milliseconds (halt program execution)
RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
RLAPI void PollInputEvents(void); // Register all input events
+RLAPI void WaitTime(float ms); // Wait for some milliseconds (halt program execution)
// Cursor-related functions
RLAPI void ShowCursor(void); // Shows cursor