Browse Source

Expose puglGetTime as Application::getTime

pull/351/head
falkTX 3 years ago
parent
commit
d1892e151f
4 changed files with 24 additions and 0 deletions
  1. +9
    -0
      dgl/Application.hpp
  2. +5
    -0
      dgl/src/Application.cpp
  3. +7
    -0
      dgl/src/ApplicationPrivateData.cpp
  4. +3
    -0
      dgl/src/ApplicationPrivateData.hpp

+ 9
- 0
dgl/Application.hpp View File

@@ -80,6 +80,15 @@ public:
*/
bool isStandalone() const noexcept;

/**
Return the time in seconds.

This is a monotonically increasing clock with high resolution.@n
The returned time is only useful to compare against other times returned by this function,
its absolute value has no meaning.
*/
double getTime() const;

/**
Add a callback function to be triggered on every idle cycle.
You can add more than one, and remove them at anytime with removeIdleCallback().


+ 5
- 0
dgl/src/Application.cpp View File

@@ -56,6 +56,11 @@ bool Application::isStandalone() const noexcept
return pData->isStandalone;
}

double Application::getTime() const
{
return pData->getTime();
}

void Application::addIdleCallback(IdleCallback* const callback)
{
DISTRHO_SAFE_ASSERT_RETURN(callback != nullptr,)


+ 7
- 0
dgl/src/ApplicationPrivateData.cpp View File

@@ -152,6 +152,13 @@ void Application::PrivateData::quit()
#endif
}

double Application::PrivateData::getTime() const
{
DISTRHO_SAFE_ASSERT_RETURN(world != nullptr, 0.0);

return puglGetTime(world);
}

void Application::PrivateData::setClassName(const char* const name)
{
DISTRHO_SAFE_ASSERT_RETURN(world != nullptr,);


+ 3
- 0
dgl/src/ApplicationPrivateData.hpp View File

@@ -91,6 +91,9 @@ struct Application::PrivateData {
For standalone mode only. */
void quit();

/** Get time via pugl */
double getTime() const;

/** Set pugl world class name. */
void setClassName(const char* name);



Loading…
Cancel
Save