mirror of
https://github.com/yawut/SDL.git
synced 2026-09-12 11:06:49 -05:00
WinRT: removed an unneeded class created by MSVC 11's Direct3D template app
This commit is contained in:
@@ -238,7 +238,6 @@
|
||||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\windowsrt\BasicTimer.h" />
|
||||
<ClInclude Include="..\..\src\video\windowsrt\CubeRenderer.h" />
|
||||
<ClInclude Include="..\..\src\video\windowsrt\Direct3DBase.h" />
|
||||
<ClInclude Include="..\..\src\video\windowsrt\DirectXHelper.h" />
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <wrl.h>
|
||||
|
||||
// Helper class for basic timing.
|
||||
ref class BasicTimer sealed
|
||||
{
|
||||
public:
|
||||
// Initializes internal timer values.
|
||||
BasicTimer()
|
||||
{
|
||||
if (!QueryPerformanceFrequency(&m_frequency))
|
||||
{
|
||||
throw ref new Platform::FailureException();
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
// Reset the timer to initial values.
|
||||
void Reset()
|
||||
{
|
||||
Update();
|
||||
m_startTime = m_currentTime;
|
||||
m_total = 0.0f;
|
||||
m_delta = 1.0f / 60.0f;
|
||||
}
|
||||
|
||||
// Update the timer's internal values.
|
||||
void Update()
|
||||
{
|
||||
if (!QueryPerformanceCounter(&m_currentTime))
|
||||
{
|
||||
throw ref new Platform::FailureException();
|
||||
}
|
||||
|
||||
m_total = static_cast<float>(
|
||||
static_cast<double>(m_currentTime.QuadPart - m_startTime.QuadPart) /
|
||||
static_cast<double>(m_frequency.QuadPart)
|
||||
);
|
||||
|
||||
if (m_lastTime.QuadPart == m_startTime.QuadPart)
|
||||
{
|
||||
// If the timer was just reset, report a time delta equivalent to 60Hz frame time.
|
||||
m_delta = 1.0f / 60.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_delta = static_cast<float>(
|
||||
static_cast<double>(m_currentTime.QuadPart - m_lastTime.QuadPart) /
|
||||
static_cast<double>(m_frequency.QuadPart)
|
||||
);
|
||||
}
|
||||
|
||||
m_lastTime = m_currentTime;
|
||||
}
|
||||
|
||||
// Duration in seconds between the last call to Reset() and the last call to Update().
|
||||
property float Total
|
||||
{
|
||||
float get() { return m_total; }
|
||||
}
|
||||
|
||||
// Duration in seconds between the previous two calls to Update().
|
||||
property float Delta
|
||||
{
|
||||
float get() { return m_delta; }
|
||||
}
|
||||
|
||||
private:
|
||||
LARGE_INTEGER m_frequency;
|
||||
LARGE_INTEGER m_currentTime;
|
||||
LARGE_INTEGER m_startTime;
|
||||
LARGE_INTEGER m_lastTime;
|
||||
float m_total;
|
||||
float m_delta;
|
||||
};
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "SDLmain_WinRT_common.h"
|
||||
#include "SDL_WinRTApp.h"
|
||||
#include "BasicTimer.h"
|
||||
|
||||
extern "C" {
|
||||
#include "SDL_assert.h"
|
||||
@@ -90,15 +89,12 @@ void SDL_WinRTApp::Run()
|
||||
SDL_WinRT_main(argc, argv);
|
||||
}
|
||||
|
||||
BasicTimer^ timer = ref new BasicTimer();
|
||||
|
||||
while (!m_windowClosed)
|
||||
{
|
||||
if (m_windowVisible)
|
||||
{
|
||||
timer->Update();
|
||||
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
||||
m_renderer->Update(timer->Total, timer->Delta);
|
||||
m_renderer->Update(0.0f, 0.0f);
|
||||
m_renderer->Render();
|
||||
m_renderer->Present(); // This call is synchronized to the display frame rate.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user