• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Razakhel / RaZ / 8146310840

04 Mar 2024 08:05PM UTC coverage: 79.232% (-0.002%) from 79.234%
8146310840

push

github

Razakhel
[Application] The Application now holds a FrameTimeInfo directly

- The callback given to Application::run() receives the whole FrameTimeInfo object instead of just the delta time

20 of 23 new or added lines in 4 files covered. (86.96%)

7981 of 10073 relevant lines covered (79.23%)

2081.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/RaZ/Application.cpp
1
#include "RaZ/Application.hpp"
2
#include "RaZ/Utils/Logger.hpp"
3

4
#if defined(RAZ_PLATFORM_EMSCRIPTEN)
5
#include <emscripten.h>
6
#endif
7

8
namespace Raz {
9

10
Application::Application(std::size_t worldCount) {
2✔
11
  m_worlds.reserve(worldCount);
2✔
12
}
2✔
13

14
void Application::run() {
1✔
15
  Logger::debug("[Application] Running...");
1✔
16

17
#if defined(RAZ_PLATFORM_EMSCRIPTEN)
18
  emscripten_set_main_loop_arg([] (void* instance) {
19
    static_cast<decltype(this)>(instance)->runOnce();
20
  }, this, 0, 1);
21
#else
22
  while (runOnce());
1✔
23
#endif
24

25
  Logger::debug("[Application] Exiting...");
1✔
26
}
1✔
27

28
bool Application::runOnce() {
3✔
29
  const auto currentTime = std::chrono::system_clock::now();
3✔
30
  m_timeInfo.deltaTime   = std::chrono::duration<float>(currentTime - m_lastFrameTime).count();
3✔
31
  m_timeInfo.globalTime += m_timeInfo.deltaTime;
3✔
32
  m_lastFrameTime        = currentTime;
3✔
33

34
  m_timeInfo.substepCount = 0;
3✔
35
  m_remainingTime        += m_timeInfo.deltaTime;
3✔
36

37
  while (m_remainingTime >= m_timeInfo.substepTime) {
3✔
NEW
38
    ++m_timeInfo.substepCount;
×
NEW
39
    m_remainingTime -= m_timeInfo.substepTime;
×
40
  }
41

42
  for (std::size_t worldIndex = 0; worldIndex < m_worlds.size(); ++worldIndex) {
6✔
43
    if (!m_activeWorlds[worldIndex])
3✔
44
      continue;
2✔
45

46
    if (!m_worlds[worldIndex]->update(m_timeInfo))
1✔
47
      m_activeWorlds.setBit(worldIndex, false);
1✔
48
  }
49

50
  return (m_isRunning && !m_activeWorlds.isEmpty());
3✔
51
}
52

53
} // namespace Raz
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc