Skip to content

Commit

Permalink
title
Browse files Browse the repository at this point in the history
  • Loading branch information
kavos113 committed Jan 20, 2025
1 parent b17241b commit c43fc60
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 13 deletions.
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ macro(create_executable files)
target_include_directories(h24w_23 PRIVATE include)
target_include_directories(h24w_23 PRIVATE ThirdParty/aqua-engine-0.1.1/include)
target_include_directories(h24w_23 PRIVATE $ENV{FBXSDK_DIR}/include)
target_link_libraries(h24w_23 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/aqua-engine-0.1.1/lib/aqua-engine.lib)
target_link_libraries(h24w_23 PRIVATE d2d1.lib)
target_link_libraries(h24w_23 PRIVATE dwrite.lib)
target_link_libraries(h24w_23 PRIVATE d3d12.lib)
target_link_libraries(h24w_23 PRIVATE dxgi.lib)
target_link_libraries(h24w_23 PRIVATE d3dcompiler.lib)
target_link_libraries(h24w_23 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/aqua-engine-0.1.1/lib/aqua-engine.lib)
target_link_libraries(h24w_23 PUBLIC d2d1.lib)
target_link_libraries(h24w_23 PUBLIC dwrite.lib)
target_link_libraries(h24w_23 PUBLIC d3d12.lib)
target_link_libraries(h24w_23 PUBLIC dxgi.lib)
target_link_libraries(h24w_23 PUBLIC d3dcompiler.lib)
target_link_libraries(h24w_23 PUBLIC d3d11.lib)
target_link_libraries(h24w_23 PUBLIC $ENV{FBXSDK_DIR}/lib/x64/debug/libfbxsdk-md.lib)
target_link_libraries(h24w_23 PUBLIC $ENV{FBXSDK_DIR}/lib/x64/debug/libxml2-md.lib)
target_link_libraries(h24w_23 PUBLIC $ENV{FBXSDK_DIR}/lib/x64/debug/zlib-md.lib)
Expand Down
2 changes: 1 addition & 1 deletion include/2d/D2DEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class D2DEngine
UINT back_buffer_count,
const std::vector<ID3D12Resource*>& back_buffers
);
void RenderTItleText(UINT back_buffer_index);
void RenderTitleText(UINT back_buffer_index);

private:
void BeginRender(UINT back_buffer_index);
Expand Down
5 changes: 2 additions & 3 deletions include/2d/Title.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#ifndef TITLE_H
#define TITLE_H
#include <d2d1.h>
#include <wrl/client.h>

#include "D2DEngine.h"
#include <d2d1_3.h>
#include <wrl/client.h>

class Title
{
Expand Down
4 changes: 4 additions & 0 deletions include/3d/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <memory>

#include "2d/D2DEngine.h"

class Engine
{
public:
Expand All @@ -19,6 +21,8 @@ class Engine
std::unique_ptr<AquaEngine::Command> m_command;
std::unique_ptr<AquaEngine::Display> m_display;

std::unique_ptr<D2DEngine> m_d2dEngine;

HWND m_hwnd;
RECT m_wr;
};
Expand Down
4 changes: 3 additions & 1 deletion src/2d/D2DEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ void D2DEngine::EndRender(UINT back_buffer_index)
m_d3d11DeviceContext->Flush();
}

void D2DEngine::RenderTItleText(UINT back_buffer_index)
// clear the back buffer and render the title text
void D2DEngine::RenderTitleText(UINT back_buffer_index)
{
BeginRender(back_buffer_index);
m_d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::White));
m_title.Render(m_d2dDeviceContext, m_d2dBlackBrush);
EndRender(back_buffer_index);
}
2 changes: 2 additions & 0 deletions src/2d/Title.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "2d/Title.h"

#include <DWrite.h>

void Title::Init(
const Microsoft::WRL::ComPtr<IDWriteFactory>& dwriteFactory,
const D2D1_RECT_F& textRect
Expand Down
7 changes: 7 additions & 0 deletions src/3d/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ void Engine::Init()
m_command = std::make_unique<AquaEngine::Command>();
m_display = std::make_unique<AquaEngine::Display>(m_hwnd, m_wr, *m_command);
m_display->SetBackgroundColor(1.0f, 1.0f, 0.0f, 1.0f);

m_d2dEngine = std::make_unique<D2DEngine>(m_hwnd, m_wr, m_command.get());
auto desc = m_display->GetSwapChainDesc();
m_d2dEngine->Init(desc.BufferCount, m_display->GetBackBufferResouces());
}

void Engine::Render() const
{
m_display->BeginRender();
m_display->SetViewports();

m_display->EndRender();

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

m_d2dEngine->RenderTitleText(m_display->GetCurrentBackBufferIndex());

m_display->Present();
}
2 changes: 0 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ int WINAPI wWinMain(
int nCmdShow
)
{
MessageBox(nullptr, "Hello, Windows Desktop!", "Aqua Engine", MB_OK);

DialogBox(
hInstance,
MAKEINTRESOURCE(IDD_DIALOG1),
Expand Down

0 comments on commit c43fc60

Please sign in to comment.