Skip to content

Commit e5b09ef

Browse files
author
Themperror
authored
Merge pull request #137 from Themperror/main_local
Chapter reorder and content for "Basics" chapter
2 parents 4c08302 + 04d639f commit e5b09ef

File tree

251 files changed

+4901
-7488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+4901
-7488
lines changed

docs/1-introduction/1-1-getting-started/1-1-1-hello-window.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ I will show the whole code first, and then explain again what means what.
211211
```cpp
212212
#pragma once
213213
214-
#include <string_view>
214+
#include <string>
215215
#include <iostream>
216216
217217
struct GLFWwindow;
218218
219219
class Application
220220
{
221221
public:
222-
Application(const std::string_view title);
222+
Application(const std::string& title);
223223
virtual ~Application();
224224
void Run();
225225
@@ -244,7 +244,7 @@ private:
244244
#include "Application.hpp"
245245
#include <GLFW/glfw3.h>
246246

247-
Application::Application(const std::string_view title)
247+
Application::Application(const std::string& title)
248248
{
249249
_title = title;
250250
}
@@ -317,7 +317,7 @@ bool Application::Initialize()
317317
class HelloWindowApplication final : public Application
318318
{
319319
public:
320-
HelloWindowApplication(const std::string_view title);
320+
HelloWindowApplication(const std::string& title);
321321
322322
protected:
323323
bool Load() override;
@@ -331,7 +331,7 @@ protected:
331331
```cpp
332332
#include "HelloWindowApplication.hpp"
333333

334-
HelloWindowApplication::HelloWindowApplication(const std::string_view title)
334+
HelloWindowApplication::HelloWindowApplication(const std::string& title)
335335
: Application(title)
336336
{
337337
}

docs/1-introduction/1-1-getting-started/1-1-2-hello-d3d11.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ And the implementation side
8282
#pragma comment(lib, "winmm.lib")
8383
#pragma comment(lib, "dxguid.lib")
8484

85-
HelloD3D11Application::HelloD3D11Application(const std::string_view title)
85+
HelloD3D11Application::HelloD3D11Application(const std::string& title)
8686
: Application(title)
8787
{
8888
}

docs/1-introduction/1-1-getting-started/1-1-3-hello-triangle.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,16 @@ First, we will declare some functions that will help us compile our shaders more
210210

211211
```cpp
212212
bool CompileShader(
213-
const std::wstring_view fileName,
214-
const std::string_view entryPoint,
215-
const std::string_view profile,
213+
const std::wstring& fileName,
214+
const std::string& entryPoint,
215+
const std::string& profile,
216216
ComPtr<ID3DBlob>& shaderBlob) const;
217217

218218
[[nodiscard]] ComPtr<ID3D11VertexShader> CreateVertexShader(
219-
const std::wstring_view fileName,
219+
const std::wstring& fileName,
220220
ComPtr<ID3DBlob>& vertexShaderBlob) const;
221221

222-
[[nodiscard]] ComPtr<ID3D11PixelShader> CreatePixelShader(std::wstring_view fileName) const;
222+
[[nodiscard]] ComPtr<ID3D11PixelShader> CreatePixelShader(std::wstring& fileName) const;
223223
```
224224
225225
In order, we have:
@@ -257,9 +257,9 @@ First things first, let's see `CompileShader`:
257257
258258
```cpp
259259
bool HelloTriangleApplication::CompileShader(
260-
const std::wstring_view fileName,
261-
const std::string_view entryPoint,
262-
const std::string_view profile,
260+
const std::wstring& fileName,
261+
const std::string& entryPoint,
262+
const std::string& profile,
263263
ComPtr<ID3DBlob>& shaderBlob) const
264264
{
265265
constexpr UINT compileFlags = D3DCOMPILE_ENABLE_STRICTNESS;
@@ -325,7 +325,7 @@ Now let's see `CreateVertexShader` and `CreatePixelShader`:
325325

326326
```cpp
327327
HelloTriangleApplication::ComPtr<ID3D11VertexShader> HelloTriangleApplication::CreateVertexShader(
328-
const std::wstring_view fileName,
328+
const std::wstring& fileName,
329329
ComPtr<ID3DBlob>& vertexShaderBlob) const
330330
{
331331
if (!CompileShader(fileName, "Main", "vs_5_0", vertexShaderBlob))
@@ -364,7 +364,7 @@ And finally
364364
365365
```cpp
366366
HelloTriangleApplication::ComPtr<ID3D11PixelShader>
367-
HelloTriangleApplication::CreatePixelShader(const std::wstring_view fileName) const
367+
HelloTriangleApplication::CreatePixelShader(const std::wstring& fileName) const
368368
{
369369
ComPtr<ID3DBlob> pixelShaderBlob = nullptr;
370370
if (!CompileShader(fileName, "Main", "ps_5_0", pixelShaderBlob))

0 commit comments

Comments
 (0)