MCPcopy Create free account
hub / github.com/RobLoach/raylib-cpp / LoadDataThread

Function LoadDataThread

examples/core/core_loading_thread.cpp:130–150  ·  view source on GitHub ↗

Loading data thread function definition

Source from the content-addressed store, hash-verified

128
129// Loading data thread function definition
130static void LoadDataThread()
131{
132 using namespace std::chrono;
133 int timeCounter = 0; // Time counted in ms
134
135 auto prevTime = steady_clock::now();
136
137 // We simulate data loading with a time counter for 5 seconds
138 while (timeCounter < 5000)
139 {
140 auto currentTime = steady_clock::now() - prevTime;
141 timeCounter = duration_cast<milliseconds>(currentTime).count();
142
143 // We accumulate time over a global variable to be used in
144 // main thread as a progress bar
145 dataProgress = timeCounter/10;
146 }
147
148 // When data has finished loading, we set global variable
149 dataLoaded = true;
150}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected