diff --git a/doc/helianthus-doc-ru.odt b/doc/helianthus-doc-ru.odt index 62893e6..424cc17 100644 Binary files a/doc/helianthus-doc-ru.odt and b/doc/helianthus-doc-ru.odt differ diff --git a/src/window.c b/src/window.c index 77639a9..ff3155c 100644 --- a/src/window.c +++ b/src/window.c @@ -20,6 +20,9 @@ static unsigned long long elapsedTimeUs; static unsigned long long elapsedTimeSinceLastFrameUs; static unsigned int prevFrameTimeMs; +static unsigned long long monotonicMs; +static unsigned int prevMonotonicMs; + HeliDialog dialog; static Callback initCallback; @@ -292,6 +295,16 @@ int windowGetFrameCount() double windowGetSeconds() { return started ? elapsedTimeUs*1e-6 : 0.0; } +unsigned long long windowGetMonotonicMilliseconds() { + unsigned int ms = SDL_GetTicks(); + monotonicMs += ms - prevMonotonicMs; + prevMonotonicMs = ms; + return monotonicMs; +} + +double windowGetMonotonicSeconds() + { return started ? monotonicMs*1e-3 : 0.0; } + void windowSetInit(Callback init) { initCallback = init; } void windowSetDraw(Callback draw) @@ -436,6 +449,9 @@ static void draw() { static void deinit() { + monotonicMs = 0; + prevMonotonicMs = 0; + heliGLStencilOpSeparatePtr = NULL; if (context) SDL_GL_DeleteContext(context); @@ -518,6 +534,9 @@ static int init() { glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, (int*)&heliGLWindowFramebufferReadId); glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (int*)&heliGLWindowFramebufferDrawId); + monotonicMs = 0; + prevMonotonicMs = SDL_GetTicks(); + return TRUE; } diff --git a/src/window.h b/src/window.h index c6baaa6..5dd029e 100644 --- a/src/window.h +++ b/src/window.h @@ -67,6 +67,8 @@ double windowGetFrameTime(); int windowGetFrameCount(); double windowGetSeconds(); +double windowGetMonotonicSeconds(); +unsigned long long windowGetMonotonicMilliseconds(); void windowSetInit(Callback init); void windowSetDraw(Callback draw);