Commit 8def9aac by Geoff Lang

Simplify the creation of OS-specific windows and timers in the samples.

BUG=angle:521 Change-Id: I9550269e9cd67fc24246853bec3c1f67cb16da2a Reviewed-on: https://chromium-review.googlesource.com/211130Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b8c0a832
......@@ -6,13 +6,6 @@
#include "SampleApplication.h"
#ifdef _WIN32
#include "win32/Win32Timer.h"
#include "win32/Win32Window.h"
#else
#error unsupported OS.
#endif
SampleApplication::SampleApplication(const std::string& name, size_t width, size_t height,
EGLint glesMajorVersion, EGLint requestedRenderer)
: mSurface(EGL_NO_SURFACE),
......@@ -24,10 +17,8 @@ SampleApplication::SampleApplication(const std::string& name, size_t width, size
mHeight(height),
mName(name),
mRunning(false),
#ifdef _WIN32
mTimer(new Win32Timer()),
mWindow(new Win32Window())
#endif
mTimer(CreateTimer()),
mWindow(CreateSampleWindow())
{
}
......
......@@ -15,4 +15,6 @@ class Timer
virtual double getElapsedTime() const = 0;
};
Timer *CreateTimer();
#endif // SAMPLE_UTIL_TIMER_H
......@@ -40,4 +40,6 @@ class Window
std::list<Event> mEvents;
};
Window *CreateSampleWindow();
#endif // SAMPLE_UTIL_WINDOW_H
......@@ -51,3 +51,8 @@ double Win32Timer::getElapsedTime() const
return static_cast<double>(endTime - mStartTime) / mFrequency;
}
Timer *CreateTimer()
{
return new Win32Timer();
}
......@@ -469,3 +469,8 @@ void Win32Window::setMousePosition(int x, int y)
SetCursorPos(topLeft.x + x, topLeft.y + y);
}
Window *CreateSampleWindow()
{
return new Win32Window();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment