tidy project
This commit is contained in:
parent
24655f8de5
commit
f8db6f3550
4
Doxyfile
4
Doxyfile
|
|
@ -45,7 +45,9 @@ FILE_PATTERNS = *.c \
|
||||||
*.h++
|
*.h++
|
||||||
|
|
||||||
RECURSIVE = YES
|
RECURSIVE = YES
|
||||||
EXCLUDE = src/3rd-party
|
EXCLUDE = src/3rd-party \
|
||||||
|
src/kiwano/platform/win32 \
|
||||||
|
src/kiwano/renderer/win32
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the preprocessor
|
# Configuration options related to the preprocessor
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\audio-modules.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\libraries.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\AudioEngine.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\AudioEngine.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\kiwano-audio.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\kiwano-audio.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\Sound.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\Sound.h" />
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\audio-modules.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\libraries.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\AudioEngine.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\AudioEngine.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\Sound.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\Sound.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\SoundPlayer.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\SoundPlayer.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\kiwano-audio.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\kiwano-audio.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\AudioEngine.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\AudioEngine.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\audio-modules.h" />
|
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\Sound.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\Sound.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\SoundPlayer.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\SoundPlayer.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano-audio\Transcoder.h" />
|
<ClInclude Include="..\..\src\kiwano-audio\Transcoder.h" />
|
||||||
|
<ClInclude Include="..\..\src\kiwano-audio\libraries.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\AudioEngine.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\AudioEngine.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\audio-modules.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\Sound.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\Sound.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\SoundPlayer.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\SoundPlayer.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano-audio\Transcoder.cpp" />
|
<ClCompile Include="..\..\src\kiwano-audio\Transcoder.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\kiwano-audio\libraries.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\core\common.h" />
|
<ClInclude Include="..\..\src\kiwano\core\common.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\Event.h" />
|
<ClInclude Include="..\..\src\kiwano\core\Event.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\Library.h" />
|
<ClInclude Include="..\..\src\kiwano\core\Library.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\core\win32\ComPtr.hpp" />
|
|
||||||
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\config.h" />
|
<ClInclude Include="..\..\src\kiwano\config.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\macros.h" />
|
<ClInclude Include="..\..\src\kiwano\macros.h" />
|
||||||
|
|
@ -54,7 +53,9 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\Director.h" />
|
<ClInclude Include="..\..\src\kiwano\platform\Director.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\FileSystem.h" />
|
<ClInclude Include="..\..\src\kiwano\platform\FileSystem.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\Input.h" />
|
<ClInclude Include="..\..\src\kiwano\platform\Input.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\modules.h" />
|
<ClInclude Include="..\..\src\kiwano\platform\win32\ComPtr.hpp" />
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\win32\helper.h" />
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\win32\libraries.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\Window.h" />
|
<ClInclude Include="..\..\src\kiwano\platform\Window.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\renderer\Brush.h" />
|
<ClInclude Include="..\..\src\kiwano\renderer\Brush.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\renderer\Color.h" />
|
<ClInclude Include="..\..\src\kiwano\renderer\Color.h" />
|
||||||
|
|
@ -121,7 +122,7 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\Director.cpp" />
|
<ClCompile Include="..\..\src\kiwano\platform\Director.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\FileSystem.cpp" />
|
<ClCompile Include="..\..\src\kiwano\platform\FileSystem.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\Input.cpp" />
|
<ClCompile Include="..\..\src\kiwano\platform\Input.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\modules.cpp" />
|
<ClCompile Include="..\..\src\kiwano\platform\win32\libraries.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\Window.cpp" />
|
<ClCompile Include="..\..\src\kiwano\platform\Window.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\Brush.cpp" />
|
<ClCompile Include="..\..\src\kiwano\renderer\Brush.cpp" />
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\Color.cpp" />
|
<ClCompile Include="..\..\src\kiwano\renderer\Color.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
<Filter Include="renderer\win32">
|
<Filter Include="renderer\win32">
|
||||||
<UniqueIdentifier>{30333461-e9bc-4709-84bd-ce6e0e1a3079}</UniqueIdentifier>
|
<UniqueIdentifier>{30333461-e9bc-4709-84bd-ce6e0e1a3079}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="core\win32">
|
<Filter Include="platform\win32">
|
||||||
<UniqueIdentifier>{192a47a9-9df6-4f40-a7d3-888eb00c53ac}</UniqueIdentifier>
|
<UniqueIdentifier>{e84dcf9a-e650-473e-8c9c-193804ab9e76}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -78,9 +78,6 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\Application.h">
|
<ClInclude Include="..\..\src\kiwano\platform\Application.h">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\platform\modules.h">
|
|
||||||
<Filter>platform</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\kiwano\config.h" />
|
<ClInclude Include="..\..\src\kiwano\config.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\macros.h" />
|
<ClInclude Include="..\..\src\kiwano\macros.h" />
|
||||||
<ClInclude Include="..\..\src\kiwano\math\Vec2.hpp">
|
<ClInclude Include="..\..\src\kiwano\math\Vec2.hpp">
|
||||||
|
|
@ -222,9 +219,6 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\math\scalar.h">
|
<ClInclude Include="..\..\src\kiwano\math\scalar.h">
|
||||||
<Filter>math</Filter>
|
<Filter>math</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\kiwano\core\win32\ComPtr.hpp">
|
|
||||||
<Filter>core\win32</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h">
|
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h">
|
||||||
<Filter>utils</Filter>
|
<Filter>utils</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
@ -270,6 +264,15 @@
|
||||||
<ClInclude Include="..\..\src\kiwano\renderer\GeometrySink.h">
|
<ClInclude Include="..\..\src\kiwano\renderer\GeometrySink.h">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\win32\ComPtr.hpp">
|
||||||
|
<Filter>platform\win32</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\win32\libraries.h">
|
||||||
|
<Filter>platform\win32</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\kiwano\platform\win32\helper.h">
|
||||||
|
<Filter>platform\win32</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\kiwano\ui\Button.cpp">
|
<ClCompile Include="..\..\src\kiwano\ui\Button.cpp">
|
||||||
|
|
@ -305,9 +308,6 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp">
|
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp">
|
||||||
<Filter>platform</Filter>
|
<Filter>platform</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\kiwano\platform\modules.cpp">
|
|
||||||
<Filter>platform</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\kiwano\core\Timer.cpp">
|
<ClCompile Include="..\..\src\kiwano\core\Timer.cpp">
|
||||||
<Filter>core</Filter>
|
<Filter>core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -455,5 +455,8 @@
|
||||||
<ClCompile Include="..\..\src\kiwano\renderer\GeometrySink.cpp">
|
<ClCompile Include="..\..\src\kiwano\renderer\GeometrySink.cpp">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\kiwano\platform\win32\libraries.cpp">
|
||||||
|
<Filter>platform\win32</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -18,8 +18,9 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/renderer/win32/helper.h> // DX::ThrowIfFailed
|
#include <kiwano/platform/win32/helper.h> // win32::ThrowIfFailed
|
||||||
#include <kiwano-audio/audio-modules.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
#include <kiwano-audio/libraries.h>
|
||||||
#include <kiwano-audio/AudioEngine.h>
|
#include <kiwano-audio/AudioEngine.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -38,13 +39,13 @@ namespace kiwano
|
||||||
|
|
||||||
void AudioEngine::SetupComponent()
|
void AudioEngine::SetupComponent()
|
||||||
{
|
{
|
||||||
// KGE_SYS_LOG(L"Creating audio resources");
|
KGE_SYS_LOG(L"Creating audio resources");
|
||||||
|
|
||||||
HRESULT hr = modules::MediaFoundation::Get().MFStartup(MF_VERSION, MFSTARTUP_FULL);
|
HRESULT hr = dlls::MediaFoundation::Get().MFStartup(MF_VERSION, MFSTARTUP_FULL);
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = modules::XAudio2::Get().XAudio2Create(&x_audio2_, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
hr = dlls::XAudio2::Get().XAudio2Create(&x_audio2_, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
|
|
@ -52,12 +53,12 @@ namespace kiwano
|
||||||
hr = x_audio2_->CreateMasteringVoice(&mastering_voice_);
|
hr = x_audio2_->CreateMasteringVoice(&mastering_voice_);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioEngine::DestroyComponent()
|
void AudioEngine::DestroyComponent()
|
||||||
{
|
{
|
||||||
// KGE_SYS_LOG(L"Destroying audio resources");
|
KGE_SYS_LOG(L"Destroying audio resources");
|
||||||
|
|
||||||
if (mastering_voice_)
|
if (mastering_voice_)
|
||||||
{
|
{
|
||||||
|
|
@ -71,7 +72,7 @@ namespace kiwano
|
||||||
x_audio2_ = nullptr;
|
x_audio2_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
modules::MediaFoundation::Get().MFShutdown();
|
dlls::MediaFoundation::Get().MFShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AudioEngine::CreateVoice(IXAudio2SourceVoice** voice, const Transcoder::Buffer& buffer)
|
HRESULT AudioEngine::CreateVoice(IXAudio2SourceVoice** voice, const Transcoder::Buffer& buffer)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/common.h>
|
#include <kiwano/core/common.h>
|
||||||
#include <kiwano/core/Component.h>
|
#include <kiwano/core/Component.h>
|
||||||
#include <kiwano/core/win32/ComPtr.hpp>
|
|
||||||
#include <kiwano-audio/Transcoder.h>
|
#include <kiwano-audio/Transcoder.h>
|
||||||
#include <xaudio2.h>
|
#include <xaudio2.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
#include <kiwano/core/common.h>
|
#include <kiwano/core/common.h>
|
||||||
#include <kiwano/core/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
#include <kiwano/core/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano/core/win32/ComPtr.hpp>
|
#include <kiwano/platform/win32/ComPtr.hpp>
|
||||||
#include <kiwano/platform/modules.h>
|
#include <kiwano/platform/win32/libraries.h>
|
||||||
#include <kiwano-audio/audio-modules.h>
|
#include <kiwano-audio/libraries.h>
|
||||||
#include <kiwano-audio/Transcoder.h>
|
#include <kiwano-audio/Transcoder.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -76,7 +76,7 @@ namespace kiwano
|
||||||
|
|
||||||
ComPtr<IMFSourceReader> reader;
|
ComPtr<IMFSourceReader> reader;
|
||||||
|
|
||||||
hr = modules::MediaFoundation::Get().MFCreateSourceReaderFromURL(
|
hr = dlls::MediaFoundation::Get().MFCreateSourceReaderFromURL(
|
||||||
file_path.c_str(),
|
file_path.c_str(),
|
||||||
nullptr,
|
nullptr,
|
||||||
&reader
|
&reader
|
||||||
|
|
@ -101,7 +101,7 @@ namespace kiwano
|
||||||
Resource::Data data = res.GetData();
|
Resource::Data data = res.GetData();
|
||||||
if (!data) { return E_FAIL; }
|
if (!data) { return E_FAIL; }
|
||||||
|
|
||||||
stream = kiwano::modules::Shlwapi::Get().SHCreateMemStream(
|
stream = win32::dlls::Shlwapi::Get().SHCreateMemStream(
|
||||||
static_cast<const BYTE*>(data.buffer),
|
static_cast<const BYTE*>(data.buffer),
|
||||||
static_cast<uint32_t>(data.size)
|
static_cast<uint32_t>(data.size)
|
||||||
);
|
);
|
||||||
|
|
@ -114,12 +114,12 @@ namespace kiwano
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = modules::MediaFoundation::Get().MFCreateMFByteStreamOnStream(stream.get(), &byte_stream);
|
hr = dlls::MediaFoundation::Get().MFCreateMFByteStreamOnStream(stream.get(), &byte_stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = modules::MediaFoundation::Get().MFCreateSourceReaderFromByteStream(
|
hr = dlls::MediaFoundation::Get().MFCreateSourceReaderFromByteStream(
|
||||||
byte_stream.get(),
|
byte_stream.get(),
|
||||||
nullptr,
|
nullptr,
|
||||||
&reader
|
&reader
|
||||||
|
|
@ -142,7 +142,7 @@ namespace kiwano
|
||||||
ComPtr<IMFMediaType> partial_type;
|
ComPtr<IMFMediaType> partial_type;
|
||||||
ComPtr<IMFMediaType> uncompressed_type;
|
ComPtr<IMFMediaType> uncompressed_type;
|
||||||
|
|
||||||
hr = modules::MediaFoundation::Get().MFCreateMediaType(&partial_type);
|
hr = dlls::MediaFoundation::Get().MFCreateMediaType(&partial_type);
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
|
|
@ -186,7 +186,7 @@ namespace kiwano
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
hr = modules::MediaFoundation::Get().MFCreateWaveFormatExFromMFMediaType(
|
hr = dlls::MediaFoundation::Get().MFCreateWaveFormatExFromMFMediaType(
|
||||||
uncompressed_type.get(),
|
uncompressed_type.get(),
|
||||||
&wave_format_,
|
&wave_format_,
|
||||||
&size,
|
&size,
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/core/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
#include <kiwano-audio/audio-modules.h>
|
#include <kiwano-audio/libraries.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace audio
|
namespace audio
|
||||||
{
|
{
|
||||||
namespace modules
|
namespace dlls
|
||||||
{
|
{
|
||||||
XAudio2::XAudio2()
|
XAudio2::XAudio2()
|
||||||
: xaudio2()
|
: xaudio2()
|
||||||
|
|
@ -29,7 +29,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
namespace audio
|
namespace audio
|
||||||
{
|
{
|
||||||
namespace modules
|
namespace dlls
|
||||||
{
|
{
|
||||||
class KGE_API XAudio2
|
class KGE_API XAudio2
|
||||||
{
|
{
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
// dear imgui: Renderer for Kiwano (DirectX11)
|
// dear imgui: Renderer for Kiwano (DirectX11)
|
||||||
|
|
||||||
#include <kiwano/renderer/win32/helper.h>
|
|
||||||
#include <kiwano-imgui/imgui_impl_dx11.h>
|
#include <kiwano-imgui/imgui_impl_dx11.h>
|
||||||
|
|
||||||
// DirectX
|
// DirectX
|
||||||
|
|
@ -259,9 +258,7 @@ static void ImGui_ImplDX11_CreateFontsTexture()
|
||||||
subResource.pSysMem = pixels;
|
subResource.pSysMem = pixels;
|
||||||
subResource.SysMemPitch = desc.Width * 4;
|
subResource.SysMemPitch = desc.Width * 4;
|
||||||
subResource.SysMemSlicePitch = 0;
|
subResource.SysMemSlicePitch = 0;
|
||||||
kiwano::DX::ThrowIfFailed(
|
g_pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);
|
||||||
g_pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pTexture)
|
if (pTexture)
|
||||||
{
|
{
|
||||||
|
|
@ -272,9 +269,7 @@ static void ImGui_ImplDX11_CreateFontsTexture()
|
||||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||||
srvDesc.Texture2D.MipLevels = desc.MipLevels;
|
srvDesc.Texture2D.MipLevels = desc.MipLevels;
|
||||||
srvDesc.Texture2D.MostDetailedMip = 0;
|
srvDesc.Texture2D.MostDetailedMip = 0;
|
||||||
kiwano::DX::ThrowIfFailed(
|
g_pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &g_pFontTextureView);
|
||||||
g_pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &g_pFontTextureView)
|
|
||||||
);
|
|
||||||
|
|
||||||
pTexture->Release();
|
pTexture->Release();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -394,22 +394,40 @@ namespace kiwano
|
||||||
static void SetDefaultAnchor(float anchor_x, float anchor_y);
|
static void SetDefaultAnchor(float anchor_x, float anchor_y);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 更新自身和所有子节点
|
||||||
virtual void Update(Duration dt);
|
virtual void Update(Duration dt);
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 渲染自身和所有子节点
|
||||||
virtual void Render(RenderTarget* rt);
|
virtual void Render(RenderTarget* rt);
|
||||||
|
|
||||||
virtual void PrepareToRender(RenderTarget* rt);
|
/// \~chinese
|
||||||
|
/// @brief 绘制自身和所有子节点的边界
|
||||||
virtual void RenderBorder(RenderTarget* rt);
|
virtual void RenderBorder(RenderTarget* rt);
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 检查是否在渲染目标的视区内
|
||||||
virtual bool CheckVisibilty(RenderTarget* rt) const;
|
virtual bool CheckVisibilty(RenderTarget* rt) const;
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 渲染前初始化渲染目标状态,仅当 CheckVisibilty 返回真时调用该函数
|
||||||
|
virtual void PrepareToRender(RenderTarget* rt);
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 更新自己的二维变换,并通知所有子节点
|
||||||
void UpdateTransform() const;
|
void UpdateTransform() const;
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 更新自己和所有子节点的透明度
|
||||||
void UpdateOpacity();
|
void UpdateOpacity();
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 将所有子节点按Z轴顺序排序
|
||||||
void Reorder();
|
void Reorder();
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 设置节点所在舞台
|
||||||
void SetStage(Stage* stage);
|
void SetStage(Stage* stage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -136,20 +136,13 @@ namespace kiwano
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GifImage::DisposalType::Background:
|
case GifImage::DisposalType::Background:
|
||||||
{
|
|
||||||
ClearCurrentFrameArea();
|
ClearCurrentFrameArea();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case GifImage::DisposalType::Previous:
|
case GifImage::DisposalType::Previous:
|
||||||
{
|
|
||||||
RestoreSavedFrame();
|
RestoreSavedFrame();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
|
||||||
DX::ThrowIfFailed(E_FAIL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GifSprite::OverlayNextFrame()
|
void GifSprite::OverlayNextFrame()
|
||||||
|
|
@ -208,9 +201,7 @@ namespace kiwano
|
||||||
|
|
||||||
TexturePtr frame_to_be_saved = new Texture;
|
TexturePtr frame_to_be_saved = new Texture;
|
||||||
|
|
||||||
HRESULT hr = frame_rt_->GetOutput(*frame_to_be_saved) ? S_OK : E_FAIL;
|
if (frame_rt_->GetOutput(*frame_to_be_saved))
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
{
|
||||||
if (!saved_frame_)
|
if (!saved_frame_)
|
||||||
{
|
{
|
||||||
|
|
@ -218,35 +209,23 @@ namespace kiwano
|
||||||
frame_rt_->CreateTexture(*saved_frame_, frame_to_be_saved->GetSizeInPixels(), frame_to_be_saved->GetPixelFormat());
|
frame_rt_->CreateTexture(*saved_frame_, frame_to_be_saved->GetSizeInPixels(), frame_to_be_saved->GetPixelFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = saved_frame_ ? S_OK : E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
saved_frame_->CopyFrom(frame_to_be_saved);
|
saved_frame_->CopyFrom(frame_to_be_saved);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GifSprite::RestoreSavedFrame()
|
void GifSprite::RestoreSavedFrame()
|
||||||
{
|
{
|
||||||
KGE_ASSERT(frame_rt_);
|
KGE_ASSERT(frame_rt_);
|
||||||
HRESULT hr = saved_frame_ ? S_OK : E_FAIL;
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (saved_frame_)
|
||||||
{
|
{
|
||||||
TexturePtr frame_to_copy_to = new Texture;
|
TexturePtr frame_to_copy_to = new Texture;
|
||||||
|
|
||||||
hr = frame_rt_->GetOutput(*frame_to_copy_to) ? S_OK : E_FAIL;
|
if (frame_rt_->GetOutput(*frame_to_copy_to))
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
{
|
||||||
frame_to_copy_to->CopyFrom(saved_frame_);
|
frame_to_copy_to->CopyFrom(saved_frame_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GifSprite::ClearCurrentFrameArea()
|
void GifSprite::ClearCurrentFrameArea()
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ namespace kiwano
|
||||||
void SetBorderStrokeBrush(BrushPtr brush);
|
void SetBorderStrokeBrush(BrushPtr brush);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 绘制所有子节点的边界
|
||||||
void RenderBorder(RenderTarget* rt) override;
|
void RenderBorder(RenderTarget* rt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ namespace kiwano
|
||||||
class KGE_API ActionManager
|
class KGE_API ActionManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 动画列表
|
||||||
using Actions = IntrusiveList<ActionPtr>;
|
using Actions = IntrusiveList<ActionPtr>;
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ namespace kiwano
|
||||||
class KGE_API EventDispatcher
|
class KGE_API EventDispatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 监听器列表
|
||||||
using Listeners = IntrusiveList<EventListenerPtr>;
|
using Listeners = IntrusiveList<EventListenerPtr>;
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ namespace kiwano
|
||||||
class KGE_API TimerManager
|
class KGE_API TimerManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 定时器列表
|
||||||
using Timers = IntrusiveList<TimerPtr>;
|
using Timers = IntrusiveList<TimerPtr>;
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,6 @@
|
||||||
// platform
|
// platform
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <kiwano/platform/modules.h>
|
|
||||||
#include <kiwano/platform/FileSystem.h>
|
#include <kiwano/platform/FileSystem.h>
|
||||||
#include <kiwano/platform/Input.h>
|
#include <kiwano/platform/Input.h>
|
||||||
#include <kiwano/platform/Window.h>
|
#include <kiwano/platform/Window.h>
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,8 @@
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include <kiwano/platform/Application.h>
|
|
||||||
#include <kiwano/platform/modules.h>
|
|
||||||
#include <kiwano/core/Logger.h>
|
#include <kiwano/core/Logger.h>
|
||||||
|
#include <kiwano/platform/Application.h>
|
||||||
#include <kiwano/platform/Input.h>
|
#include <kiwano/platform/Input.h>
|
||||||
#include <kiwano/platform/Director.h>
|
#include <kiwano/platform/Director.h>
|
||||||
#include <kiwano/renderer/TextureCache.h>
|
#include <kiwano/renderer/TextureCache.h>
|
||||||
|
|
@ -67,7 +66,7 @@ namespace kiwano
|
||||||
, inited_(false)
|
, inited_(false)
|
||||||
, time_scale_(1.f)
|
, time_scale_(1.f)
|
||||||
{
|
{
|
||||||
DX::ThrowIfFailed(::CoInitialize(nullptr));
|
::CoInitialize(nullptr);
|
||||||
|
|
||||||
Use(&Renderer::instance());
|
Use(&Renderer::instance());
|
||||||
Use(&Input::instance());
|
Use(&Input::instance());
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/platform/FileSystem.h>
|
#include <kiwano/platform/FileSystem.h>
|
||||||
#include <kiwano/platform/modules.h>
|
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ namespace kiwano
|
||||||
if (handle_ == nullptr)
|
if (handle_ == nullptr)
|
||||||
{
|
{
|
||||||
::UnregisterClass(KGE_WND_CLASS_NAME, hinst);
|
::UnregisterClass(KGE_WND_CLASS_NAME, hinst);
|
||||||
DX::ThrowIfFailed(HRESULT_FROM_WIN32(GetLastError()));
|
win32::ThrowIfFailed(HRESULT_FROM_WIN32(GetLastError()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ namespace kiwano
|
||||||
// ComPtr<> is a smart pointer for COM
|
// ComPtr<> is a smart pointer for COM
|
||||||
template<
|
template<
|
||||||
typename _Ty,
|
typename _Ty,
|
||||||
typename = typename std::enable_if<std::is_base_of<IUnknown, _Ty>::value, int>::type>
|
typename = typename std::enable_if<std::is_base_of<IUnknown, _Ty>::value, int>::type
|
||||||
|
>
|
||||||
using ComPtr = IntrusivePtr<_Ty, ComPtrProxy>;
|
using ComPtr = IntrusivePtr<_Ty, ComPtrProxy>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,27 +18,24 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/platform/modules.h>
|
#pragma once
|
||||||
#include <kiwano/core/Logger.h>
|
#include <stdexcept>
|
||||||
|
#include <kiwano/macros.h>
|
||||||
|
#include <3rd-party/StackWalker/StackWalker.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace modules
|
namespace win32
|
||||||
{
|
{
|
||||||
Shlwapi::Shlwapi()
|
inline void ThrowIfFailed(HRESULT hr)
|
||||||
: shlwapi()
|
|
||||||
, PathFileExistsW(nullptr)
|
|
||||||
, SHCreateMemStream(nullptr)
|
|
||||||
{
|
{
|
||||||
if (shlwapi.Load(L"shlwapi.dll"))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
PathFileExistsW = shlwapi.GetProcess<PFN_PathFileExistsW>(L"PathFileExistsW");
|
StackWalker().ShowCallstack();
|
||||||
SHCreateMemStream = shlwapi.GetProcess<PFN_SHCreateMemStream>(L"SHCreateMemStream");
|
|
||||||
}
|
static char buffer[1024 + 1];
|
||||||
else
|
sprintf_s(buffer, "Failed with HRESULT of %08X", hr);
|
||||||
{
|
throw std::runtime_error(buffer);
|
||||||
KGE_ERROR(L"Load shlapi.dll failed");
|
|
||||||
throw std::runtime_error("Load shlapi.dll failed");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#include <kiwano/platform/win32/libraries.h>
|
||||||
|
#include <kiwano/core/Logger.h>
|
||||||
|
|
||||||
|
namespace kiwano
|
||||||
|
{
|
||||||
|
namespace win32
|
||||||
|
{
|
||||||
|
namespace dlls
|
||||||
|
{
|
||||||
|
Shlwapi::Shlwapi()
|
||||||
|
: shlwapi()
|
||||||
|
, PathFileExistsW(nullptr)
|
||||||
|
, SHCreateMemStream(nullptr)
|
||||||
|
{
|
||||||
|
if (shlwapi.Load(L"shlwapi.dll"))
|
||||||
|
{
|
||||||
|
PathFileExistsW = shlwapi.GetProcess<PFN_PathFileExistsW>(L"PathFileExistsW");
|
||||||
|
SHCreateMemStream = shlwapi.GetProcess<PFN_SHCreateMemStream>(L"SHCreateMemStream");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KGE_ERROR(L"Load shlapi.dll failed");
|
||||||
|
throw std::runtime_error("Load shlapi.dll failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,31 +24,34 @@
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
namespace modules
|
namespace win32
|
||||||
{
|
{
|
||||||
class KGE_API Shlwapi
|
namespace dlls
|
||||||
{
|
{
|
||||||
public:
|
class KGE_API Shlwapi
|
||||||
static inline Shlwapi& Get()
|
|
||||||
{
|
{
|
||||||
static Shlwapi instance;
|
public:
|
||||||
return instance;
|
static inline Shlwapi& Get()
|
||||||
}
|
{
|
||||||
|
static Shlwapi instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
// Shlwapi functions
|
// Shlwapi functions
|
||||||
typedef BOOL(WINAPI* PFN_PathFileExistsW)(LPCWSTR);
|
typedef BOOL(WINAPI* PFN_PathFileExistsW)(LPCWSTR);
|
||||||
typedef IStream* (WINAPI* PFN_SHCreateMemStream)(const BYTE*, UINT);
|
typedef IStream* (WINAPI* PFN_SHCreateMemStream)(const BYTE*, UINT);
|
||||||
|
|
||||||
PFN_PathFileExistsW PathFileExistsW;
|
PFN_PathFileExistsW PathFileExistsW;
|
||||||
PFN_SHCreateMemStream SHCreateMemStream;
|
PFN_SHCreateMemStream SHCreateMemStream;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Shlwapi();
|
Shlwapi();
|
||||||
|
|
||||||
Shlwapi(const Shlwapi&) = delete;
|
Shlwapi(const Shlwapi&) = delete;
|
||||||
Shlwapi& operator=(const Shlwapi&) = delete;
|
Shlwapi& operator=(const Shlwapi&) = delete;
|
||||||
|
|
||||||
Library shlwapi;
|
Library shlwapi;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/core/win32/ComPtr.hpp>
|
|
||||||
#include <kiwano/core/Resource.h>
|
#include <kiwano/core/Resource.h>
|
||||||
|
#include <kiwano/platform/win32/ComPtr.hpp>
|
||||||
#include <dwrite.h>
|
#include <dwrite.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace kiwano
|
||||||
path_geo_.reset();
|
path_geo_.reset();
|
||||||
Renderer::instance().CreateGeometrySink(*this);
|
Renderer::instance().CreateGeometrySink(*this);
|
||||||
|
|
||||||
DX::ThrowIfFailed(path_geo_->Open(&sink_));
|
win32::ThrowIfFailed(path_geo_->Open(&sink_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
if (IsOpened())
|
if (IsOpened())
|
||||||
{
|
{
|
||||||
DX::ThrowIfFailed(sink_->Close());
|
win32::ThrowIfFailed(sink_->Close());
|
||||||
sink_.reset();
|
sink_.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -75,7 +75,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
|
|
||||||
ComPtr<ID2D1Geometry> geo = input.geo_;
|
ComPtr<ID2D1Geometry> geo = input.geo_;
|
||||||
DX::ThrowIfFailed(
|
win32::ThrowIfFailed(
|
||||||
geo->Outline(
|
geo->Outline(
|
||||||
DX::ConvertToMatrix3x2F(input_matrix),
|
DX::ConvertToMatrix3x2F(input_matrix),
|
||||||
D2D1_DEFAULT_FLATTENING_TOLERANCE,
|
D2D1_DEFAULT_FLATTENING_TOLERANCE,
|
||||||
|
|
@ -164,7 +164,7 @@ namespace kiwano
|
||||||
|
|
||||||
ComPtr<ID2D1Geometry> geo_a_raw = geo_a.geo_;
|
ComPtr<ID2D1Geometry> geo_a_raw = geo_a.geo_;
|
||||||
ComPtr<ID2D1Geometry> geo_b_raw = geo_b.geo_;
|
ComPtr<ID2D1Geometry> geo_b_raw = geo_b.geo_;
|
||||||
DX::ThrowIfFailed(
|
win32::ThrowIfFailed(
|
||||||
geo_a_raw->CombineWithGeometry(
|
geo_a_raw->CombineWithGeometry(
|
||||||
geo_b_raw.get(),
|
geo_b_raw.get(),
|
||||||
D2D1_COMBINE_MODE(mode),
|
D2D1_COMBINE_MODE(mode),
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ namespace kiwano
|
||||||
|
|
||||||
void RenderTarget::EndDraw()
|
void RenderTarget::EndDraw()
|
||||||
{
|
{
|
||||||
DX::ThrowIfFailed( render_target_->EndDraw() );
|
win32::ThrowIfFailed( render_target_->EndDraw() );
|
||||||
|
|
||||||
if (collecting_status_)
|
if (collecting_status_)
|
||||||
{
|
{
|
||||||
|
|
@ -377,7 +377,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -410,7 +410,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <kiwano/core/time.h>
|
#include <kiwano/core/time.h>
|
||||||
#include <kiwano/core/ObjectBase.h>
|
#include <kiwano/core/ObjectBase.h>
|
||||||
#include <kiwano/core/win32/ComPtr.hpp>
|
|
||||||
#include <kiwano/renderer/Brush.h>
|
#include <kiwano/renderer/Brush.h>
|
||||||
#include <kiwano/renderer/Texture.h>
|
#include <kiwano/renderer/Texture.h>
|
||||||
#include <kiwano/renderer/Geometry.h>
|
#include <kiwano/renderer/Geometry.h>
|
||||||
|
|
|
||||||
|
|
@ -88,37 +88,37 @@ namespace kiwano
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IFontCollectionLoader::Create(&font_collection_loader_);
|
hr = IFontCollectionLoader::Create(&font_collection_loader_);
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = d2d_res_->GetDWriteFactory()->RegisterFontCollectionLoader(font_collection_loader_.get());
|
hr = d2d_res_->GetDWriteFactory()->RegisterFontCollectionLoader(font_collection_loader_.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceFontFileLoader and ResourceFontCollectionLoader
|
// ResourceFontFileLoader and ResourceFontCollectionLoader
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IResourceFontFileLoader::Create(&res_font_file_loader_);
|
hr = IResourceFontFileLoader::Create(&res_font_file_loader_);
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = d2d_res_->GetDWriteFactory()->RegisterFontFileLoader(res_font_file_loader_.get());
|
hr = d2d_res_->GetDWriteFactory()->RegisterFontFileLoader(res_font_file_loader_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IResourceFontCollectionLoader::Create(&res_font_collection_loader_, res_font_file_loader_.get());
|
hr = IResourceFontCollectionLoader::Create(&res_font_collection_loader_, res_font_file_loader_.get());
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = d2d_res_->GetDWriteFactory()->RegisterFontCollectionLoader(res_font_collection_loader_.get());
|
hr = d2d_res_->GetDWriteFactory()->RegisterFontCollectionLoader(res_font_collection_loader_.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::DestroyComponent()
|
void Renderer::DestroyComponent()
|
||||||
|
|
@ -150,7 +150,7 @@ namespace kiwano
|
||||||
BeginDraw();
|
BeginDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::AfterRender()
|
void Renderer::AfterRender()
|
||||||
|
|
@ -168,7 +168,7 @@ namespace kiwano
|
||||||
hr = HandleDeviceLost();
|
hr = HandleDeviceLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::HandleMessage(HWND hwnd, UINT32 msg, WPARAM wparam, LPARAM lparam)
|
void Renderer::HandleMessage(HWND hwnd, UINT32 msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
|
@ -596,7 +596,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateFontCollection(Font& font, Vector<Resource> const& res_arr)
|
void Renderer::CreateFontCollection(Font& font, Vector<Resource> const& res_arr)
|
||||||
|
|
@ -631,7 +631,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateTextFormat(TextLayout& layout)
|
void Renderer::CreateTextFormat(TextLayout& layout)
|
||||||
|
|
@ -663,7 +663,7 @@ namespace kiwano
|
||||||
layout.SetTextFormat(output);
|
layout.SetTextFormat(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateTextLayout(TextLayout& layout)
|
void Renderer::CreateTextLayout(TextLayout& layout)
|
||||||
|
|
@ -689,7 +689,7 @@ namespace kiwano
|
||||||
layout.SetTextLayout(output);
|
layout.SetTextLayout(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateLineGeometry(Geometry& geo, Point const& begin_pos, Point const& end_pos)
|
void Renderer::CreateLineGeometry(Geometry& geo, Point const& begin_pos, Point const& end_pos)
|
||||||
|
|
@ -725,7 +725,7 @@ namespace kiwano
|
||||||
geo.SetGeometry(path_geo);
|
geo.SetGeometry(path_geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateRectGeometry(Geometry& geo, Rect const& rect)
|
void Renderer::CreateRectGeometry(Geometry& geo, Rect const& rect)
|
||||||
|
|
@ -747,7 +747,7 @@ namespace kiwano
|
||||||
geo.SetGeometry(output);
|
geo.SetGeometry(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateRoundedRectGeometry(Geometry& geo, Rect const& rect, Vec2 const& radius)
|
void Renderer::CreateRoundedRectGeometry(Geometry& geo, Rect const& rect, Vec2 const& radius)
|
||||||
|
|
@ -775,7 +775,7 @@ namespace kiwano
|
||||||
geo.SetGeometry(output);
|
geo.SetGeometry(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateEllipseGeometry(Geometry& geo, Point const& center, Vec2 const& radius)
|
void Renderer::CreateEllipseGeometry(Geometry& geo, Point const& center, Vec2 const& radius)
|
||||||
|
|
@ -803,7 +803,7 @@ namespace kiwano
|
||||||
geo.SetGeometry(output);
|
geo.SetGeometry(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateGeometrySink(GeometrySink& sink)
|
void Renderer::CreateGeometrySink(GeometrySink& sink)
|
||||||
|
|
@ -825,7 +825,7 @@ namespace kiwano
|
||||||
sink.SetPathGeometry(output);
|
sink.SetPathGeometry(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateTextureRenderTarget(TextureRenderTargetPtr& render_target)
|
void Renderer::CreateTextureRenderTarget(TextureRenderTargetPtr& render_target)
|
||||||
|
|
@ -859,7 +859,7 @@ namespace kiwano
|
||||||
render_target = output;
|
render_target = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateSolidBrush(Brush& brush, Color const& color)
|
void Renderer::CreateSolidBrush(Brush& brush, Color const& color)
|
||||||
|
|
@ -881,7 +881,7 @@ namespace kiwano
|
||||||
brush.SetBrush(output, Brush::Type::SolidColor);
|
brush.SetBrush(output, Brush::Type::SolidColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateLinearGradientBrush(Brush& brush, Point const& begin, Point const& end, Vector<GradientStop> const& stops, GradientExtendMode extend_mode)
|
void Renderer::CreateLinearGradientBrush(Brush& brush, Point const& begin, Point const& end, Vector<GradientStop> const& stops, GradientExtendMode extend_mode)
|
||||||
|
|
@ -922,7 +922,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CreateRadialGradientBrush(Brush& brush, Point const& center, Vec2 const& offset, Vec2 const& radius,
|
void Renderer::CreateRadialGradientBrush(Brush& brush, Point const& center, Vec2 const& offset, Vec2 const& radius,
|
||||||
|
|
@ -966,7 +966,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetDpi(float dpi)
|
void Renderer::SetDpi(float dpi)
|
||||||
|
|
@ -979,7 +979,7 @@ namespace kiwano
|
||||||
hr = d2d_res_->SetDpi(dpi);
|
hr = d2d_res_->SetDpi(dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetVSyncEnabled(bool enabled)
|
void Renderer::SetVSyncEnabled(bool enabled)
|
||||||
|
|
@ -1016,7 +1016,7 @@ namespace kiwano
|
||||||
Resize(reinterpret_cast<const Size&>(GetRenderTarget()->GetSize()));
|
Resize(reinterpret_cast<const Size&>(GetRenderTarget()->GetSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ namespace kiwano
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
hr = text_layout_->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, line_spacing, line_spacing * 0.8f);
|
hr = text_layout_->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, line_spacing, line_spacing * 0.8f);
|
||||||
}
|
}
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,7 +211,7 @@ namespace kiwano
|
||||||
if (text_layout_)
|
if (text_layout_)
|
||||||
{
|
{
|
||||||
HRESULT hr = text_layout_->SetTextAlignment(DWRITE_TEXT_ALIGNMENT(align));
|
HRESULT hr = text_layout_->SetTextAlignment(DWRITE_TEXT_ALIGNMENT(align));
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +226,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
hr = text_layout_->SetUnderline(enable, { start, length });
|
hr = text_layout_->SetUnderline(enable, { start, length });
|
||||||
}
|
}
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextLayout::SetStrikethrough(bool enable, uint32_t start, uint32_t length)
|
void TextLayout::SetStrikethrough(bool enable, uint32_t start, uint32_t length)
|
||||||
|
|
@ -240,7 +240,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
hr = text_layout_->SetStrikethrough(enable, { start, length });
|
hr = text_layout_->SetStrikethrough(enable, { start, length });
|
||||||
}
|
}
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
HRESULT hr = bitmap_->CopyFromBitmap(nullptr, copy_from->GetBitmap().get(), nullptr);
|
HRESULT hr = bitmap_->CopyFromBitmap(nullptr, copy_from->GetBitmap().get(), nullptr);
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,7 +136,7 @@ namespace kiwano
|
||||||
uint32_t(src_rect.GetBottom()))
|
uint32_t(src_rect.GetBottom()))
|
||||||
);
|
);
|
||||||
|
|
||||||
DX::ThrowIfFailed(hr);
|
win32::ThrowIfFailed(hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#include <kiwano/core/win32/ComPtr.hpp>
|
|
||||||
#include <kiwano/renderer/win32/TextRenderer.h>
|
#include <kiwano/renderer/win32/TextRenderer.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,10 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdexcept>
|
|
||||||
#include <kiwano/math/math.h>
|
#include <kiwano/math/math.h>
|
||||||
#include <kiwano/core/win32/ComPtr.hpp>
|
#include <kiwano/platform/win32/ComPtr.hpp>
|
||||||
|
#include <kiwano/platform/win32/helper.h>
|
||||||
#include <kiwano/renderer/Color.h>
|
#include <kiwano/renderer/Color.h>
|
||||||
#include <3rd-party/StackWalker/StackWalker.h>
|
|
||||||
#include <d2d1.h>
|
#include <d2d1.h>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
|
|
@ -175,17 +174,5 @@ namespace kiwano
|
||||||
static const float dips_per_inch = 96.0f;
|
static const float dips_per_inch = 96.0f;
|
||||||
return math::Floor(dips * dpi / dips_per_inch + 0.5f); // Round to nearest integer.
|
return math::Floor(dips * dpi / dips_per_inch + 0.5f); // Round to nearest integer.
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ThrowIfFailed(HRESULT hr)
|
|
||||||
{
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
StackWalker().ShowCallstack();
|
|
||||||
|
|
||||||
static char buffer[1024 + 1];
|
|
||||||
sprintf_s(buffer, "Failed with HRESULT of %08X", hr);
|
|
||||||
throw std::runtime_error(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue