Skip to content

Commit c43fc60

Browse files
committed
title
1 parent b17241b commit c43fc60

File tree

8 files changed

+26
-13
lines changed

8 files changed

+26
-13
lines changed

CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ macro(create_executable files)
2626
target_include_directories(h24w_23 PRIVATE include)
2727
target_include_directories(h24w_23 PRIVATE ThirdParty/aqua-engine-0.1.1/include)
2828
target_include_directories(h24w_23 PRIVATE $ENV{FBXSDK_DIR}/include)
29-
target_link_libraries(h24w_23 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/aqua-engine-0.1.1/lib/aqua-engine.lib)
30-
target_link_libraries(h24w_23 PRIVATE d2d1.lib)
31-
target_link_libraries(h24w_23 PRIVATE dwrite.lib)
32-
target_link_libraries(h24w_23 PRIVATE d3d12.lib)
33-
target_link_libraries(h24w_23 PRIVATE dxgi.lib)
34-
target_link_libraries(h24w_23 PRIVATE d3dcompiler.lib)
29+
target_link_libraries(h24w_23 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/aqua-engine-0.1.1/lib/aqua-engine.lib)
30+
target_link_libraries(h24w_23 PUBLIC d2d1.lib)
31+
target_link_libraries(h24w_23 PUBLIC dwrite.lib)
32+
target_link_libraries(h24w_23 PUBLIC d3d12.lib)
33+
target_link_libraries(h24w_23 PUBLIC dxgi.lib)
34+
target_link_libraries(h24w_23 PUBLIC d3dcompiler.lib)
35+
target_link_libraries(h24w_23 PUBLIC d3d11.lib)
3536
target_link_libraries(h24w_23 PUBLIC $ENV{FBXSDK_DIR}/lib/x64/debug/libfbxsdk-md.lib)
3637
target_link_libraries(h24w_23 PUBLIC $ENV{FBXSDK_DIR}/lib/x64/debug/libxml2-md.lib)
3738
target_link_libraries(h24w_23 PUBLIC $ENV{FBXSDK_DIR}/lib/x64/debug/zlib-md.lib)

include/2d/D2DEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class D2DEngine
2222
UINT back_buffer_count,
2323
const std::vector<ID3D12Resource*>& back_buffers
2424
);
25-
void RenderTItleText(UINT back_buffer_index);
25+
void RenderTitleText(UINT back_buffer_index);
2626

2727
private:
2828
void BeginRender(UINT back_buffer_index);

include/2d/Title.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#ifndef TITLE_H
22
#define TITLE_H
3-
#include <d2d1.h>
4-
#include <wrl/client.h>
53

6-
#include "D2DEngine.h"
4+
#include <d2d1_3.h>
5+
#include <wrl/client.h>
76

87
class Title
98
{

include/3d/Engine.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include <memory>
88

9+
#include "2d/D2DEngine.h"
10+
911
class Engine
1012
{
1113
public:
@@ -19,6 +21,8 @@ class Engine
1921
std::unique_ptr<AquaEngine::Command> m_command;
2022
std::unique_ptr<AquaEngine::Display> m_display;
2123

24+
std::unique_ptr<D2DEngine> m_d2dEngine;
25+
2226
HWND m_hwnd;
2327
RECT m_wr;
2428
};

src/2d/D2DEngine.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,11 @@ void D2DEngine::EndRender(UINT back_buffer_index)
166166
m_d3d11DeviceContext->Flush();
167167
}
168168

169-
void D2DEngine::RenderTItleText(UINT back_buffer_index)
169+
// clear the back buffer and render the title text
170+
void D2DEngine::RenderTitleText(UINT back_buffer_index)
170171
{
171172
BeginRender(back_buffer_index);
173+
m_d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::White));
172174
m_title.Render(m_d2dDeviceContext, m_d2dBlackBrush);
173175
EndRender(back_buffer_index);
174176
}

src/2d/Title.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "2d/Title.h"
22

3+
#include <DWrite.h>
4+
35
void Title::Init(
46
const Microsoft::WRL::ComPtr<IDWriteFactory>& dwriteFactory,
57
const D2D1_RECT_F& textRect

src/3d/Engine.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@ void Engine::Init()
2929
m_command = std::make_unique<AquaEngine::Command>();
3030
m_display = std::make_unique<AquaEngine::Display>(m_hwnd, m_wr, *m_command);
3131
m_display->SetBackgroundColor(1.0f, 1.0f, 0.0f, 1.0f);
32+
33+
m_d2dEngine = std::make_unique<D2DEngine>(m_hwnd, m_wr, m_command.get());
34+
auto desc = m_display->GetSwapChainDesc();
35+
m_d2dEngine->Init(desc.BufferCount, m_display->GetBackBufferResouces());
3236
}
3337

3438
void Engine::Render() const
3539
{
3640
m_display->BeginRender();
3741
m_display->SetViewports();
42+
3843
m_display->EndRender();
3944

4045
HRESULT hr = m_command->Execute();
@@ -44,5 +49,7 @@ void Engine::Render() const
4449
return;
4550
}
4651

52+
m_d2dEngine->RenderTitleText(m_display->GetCurrentBackBufferIndex());
53+
4754
m_display->Present();
4855
}

src/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ int WINAPI wWinMain(
1616
int nCmdShow
1717
)
1818
{
19-
MessageBox(nullptr, "Hello, Windows Desktop!", "Aqua Engine", MB_OK);
20-
2119
DialogBox(
2220
hInstance,
2321
MAKEINTRESOURCE(IDD_DIALOG1),

0 commit comments

Comments
 (0)