Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux and GLFW fixes #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Move to GLFW timer as time source.
elmindreda committed Dec 20, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7ef3ae7820453e2689ba7531d2c5fef57951d9db
8 changes: 0 additions & 8 deletions include/vapp.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef __VAPP_H__
#define __VAPP_H__

#include <time.h>

#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);
19 changes: 1 addition & 18 deletions lib/vermilion.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#include "vapp.h"

#include <time.h>
#ifndef _WIN32
#include <sys/time.h>
#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