From a938dd14b52663b355e762feaed2ca3955009b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 20 Dec 2016 17:50:20 +0100 Subject: [PATCH] Move to GLFW timer as time source. --- include/vapp.h | 8 -------- lib/vermilion.cpp | 19 +------------------ 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/include/vapp.h b/include/vapp.h index 7e51ecc..f4a4037 100644 --- a/include/vapp.h +++ b/include/vapp.h @@ -1,8 +1,6 @@ #ifndef __VAPP_H__ #define __VAPP_H__ -#include - #include "vgl.h" class VermilionApplication @@ -14,12 +12,6 @@ class VermilionApplication static VermilionApplication * s_app; GLFWwindow* m_pWindow; -#ifdef _WIN32 - ULONGLONG m_appStartTime; -#else - struct timeval m_appStartTime; -#endif - static void window_size_callback(GLFWwindow* window, int width, int height); static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods); static void char_callback(GLFWwindow* window, unsigned int codepoint); diff --git a/lib/vermilion.cpp b/lib/vermilion.cpp index 54acb65..3c67fca 100644 --- a/lib/vermilion.cpp +++ b/lib/vermilion.cpp @@ -1,10 +1,5 @@ #include "vapp.h" -#include -#ifndef _WIN32 -#include -#endif - void VermilionApplication::window_size_callback(GLFWwindow* window, int width, int height) { VermilionApplication* pThis = (VermilionApplication*)glfwGetWindowUserPointer(window); @@ -28,23 +23,11 @@ void VermilionApplication::char_callback(GLFWwindow* window, unsigned int codepo unsigned int VermilionApplication::app_time() { -#ifdef _WIN32 - ULONGLONG currentTime = ::GetTickCount64(); - - return (unsigned int)(currentTime - m_appStartTime); -#else - return 0; -#endif + return (unsigned int) (glfwGetTime() * 1000.0); } void VermilionApplication::Initialize(const char * title) { -#ifdef _WIN32 - m_appStartTime = ::GetTickCount64(); -#else - gettimeofday(&m_appStartTime, nullptr); -#endif - glfwInit(); #ifdef _DEBUG