Skip to content

Commit 6e711b5

Browse files
authored
Renaming projects and synchronizing the layout with the documentation (#41)
* more renaming * even more renaming * general formatting fixes and improvements
1 parent 9154020 commit 6e711b5

Some content is hidden

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

51 files changed

+593
-595
lines changed

src/Cpp/1-getting-started/12-HelloGLFWWindow/12-HelloGLFWWindow.vcxproj src/Cpp/1-getting-started/1-1-HelloGLFWWindow/1-1-HelloGLFWWindow.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<PropertyGroup Label="Globals">
1414
<VCProjectVersion>16.0</VCProjectVersion>
1515
<Keyword>Win32Proj</Keyword>
16-
<ProjectGuid>{b346866b-007c-46c1-9596-70381d63ac1f}</ProjectGuid>
17-
<RootNamespace>My12HelloGLFWWindow</RootNamespace>
16+
<ProjectGuid>{d117bf69-ad4e-426d-8835-2e2e849e46d1}</ProjectGuid>
17+
<RootNamespace>My11HelloGLFWWindow</RootNamespace>
1818
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
1919
</PropertyGroup>
2020
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

src/Cpp/1-getting-started/12-HelloGLFWWindow/Main.cpp src/Cpp/1-getting-started/1-1-HelloGLFWWindow/Main.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ int main(int argc, char* argv[])
3232

3333
const int32_t windowLeft = videoMode->width / 2 - width / 2;
3434
const int32_t windowTop = videoMode->height / 2 - height / 2;
35-
glfwSetWindowPos(window, windowLeft, windowTop);
35+
glfwSetWindowPos(
36+
window,
37+
windowLeft,
38+
windowTop);
3639

3740
while (!glfwWindowShouldClose(window))
3841
{

src/Cpp/1-getting-started/11-HelloWin32Window/11-HelloWin32Window.vcxproj src/Cpp/1-getting-started/1-1-HelloWin32Window/1-1-HelloWin32Window.vcxproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<PropertyGroup Label="Globals">
1414
<VCProjectVersion>16.0</VCProjectVersion>
1515
<Keyword>Win32Proj</Keyword>
16-
<ProjectGuid>{770b0840-9342-4aed-9c9b-80f5b53e0bf2}</ProjectGuid>
16+
<ProjectGuid>{b950214c-0583-4447-8a53-aa36b1402459}</ProjectGuid>
1717
<RootNamespace>My11HelloWin32Window</RootNamespace>
1818
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
1919
</PropertyGroup>
@@ -60,7 +60,6 @@
6060
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
6161
<ConformanceMode>true</ConformanceMode>
6262
<LanguageStandard>stdcpp17</LanguageStandard>
63-
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
6463
</ClCompile>
6564
<Link>
6665
<SubSystem>Console</SubSystem>

src/Cpp/1-getting-started/11-HelloWin32Window/Main.cpp src/Cpp/1-getting-started/1-1-HelloWin32Window/Main.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33

44
#include <iostream>
55

6-
LRESULT CALLBACK WindowCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
6+
LRESULT CALLBACK WindowCallback(
7+
HWND hWnd,
8+
UINT uMsg,
9+
WPARAM wParam,
10+
LPARAM lParam)
711
{
812
return DefWindowProc(hWnd, uMsg, wParam, lParam);
913
}
1014

11-
12-
1315
int main(int argc, char* argv[])
1416
{
1517
const int32_t monitorWidth = GetSystemMetrics(SM_CXSCREEN);

src/Cpp/1-getting-started/1-HelloWindow/1-HelloWindow.vcxproj src/Cpp/1-getting-started/1-1-HelloWindow/1-1-HelloWindow.vcxproj

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<ProjectGuid>{de211e5c-4a95-4a67-9aa7-0a6ddba68d55}</ProjectGuid>
1717
<RootNamespace>HelloWindow</RootNamespace>
1818
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
19+
<ProjectName>1-1-HelloWindow</ProjectName>
1920
</PropertyGroup>
2021
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2122
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

src/Cpp/1-getting-started/1-HelloWindow/Application.cpp src/Cpp/1-getting-started/1-1-HelloWindow/Application.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ bool Application::Initialize()
5050
return false;
5151
}
5252

53-
const auto primaryMonitor = glfwGetPrimaryMonitor();
54-
const auto videoMode = glfwGetVideoMode(primaryMonitor);
53+
GLFWmonitor* primaryMonitor = glfwGetPrimaryMonitor();
54+
const GLFWvidmode* videoMode = glfwGetVideoMode(primaryMonitor);
5555
_width = static_cast<int32_t>(videoMode->width * 0.9f);
5656
_height = static_cast<int32_t>(videoMode->height * 0.9f);
5757

5858
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
5959
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
60-
_window = glfwCreateWindow(_width, _height, _title.data(), nullptr, nullptr);
60+
_window = glfwCreateWindow(
61+
_width,
62+
_height,
63+
_title.data(),
64+
nullptr,
65+
nullptr);
6166
if (_window == nullptr)
6267
{
6368
Cleanup();
@@ -67,7 +72,10 @@ bool Application::Initialize()
6772

6873
const int32_t windowLeft = videoMode->width / 2 - _width / 2;
6974
const int32_t windowTop = videoMode->height / 2 - _height / 2;
70-
glfwSetWindowPos(_window, windowLeft, windowTop);
75+
glfwSetWindowPos(
76+
_window,
77+
windowLeft,
78+
windowTop);
7179

7280
return true;
7381
}

src/Cpp/1-getting-started/13-HelloD3D11/13-HelloD3D11.vcxproj src/Cpp/1-getting-started/1-2-HelloD3D11/1-2-HelloD3D11.vcxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<PropertyGroup Label="Globals">
1414
<VCProjectVersion>16.0</VCProjectVersion>
1515
<Keyword>Win32Proj</Keyword>
16-
<ProjectGuid>{95c49c81-9a68-4535-956f-0b6bc09cb77d}</ProjectGuid>
17-
<RootNamespace>My13HelloD3D11</RootNamespace>
16+
<ProjectGuid>{9c3191a6-5486-4f91-a467-19d407c44a83}</ProjectGuid>
17+
<RootNamespace>My12HelloD3D11</RootNamespace>
1818
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
1919
</PropertyGroup>
2020
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -52,10 +52,10 @@
5252
</PropertyGroup>
5353
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
5454
<LinkIncremental>false</LinkIncremental>
55-
<OutDir>bin\$(Configuration)\</OutDir>
56-
<IntDir>obj\$(Configuration)\</IntDir>
5755
<IncludePath>$(SolutionDir)..\lib\glfw-3.3.6\include\;$(IncludePath)</IncludePath>
5856
<LibraryPath>$(SolutionDir)..\lib\glfw-3.3.6\lib-vc2022\;$(LibraryPath)</LibraryPath>
57+
<OutDir>bin\$(Configuration)\</OutDir>
58+
<IntDir>obj\$(Configuration)\</IntDir>
5959
</PropertyGroup>
6060
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
6161
<ClCompile>

src/Cpp/1-getting-started/13-HelloD3D11/Application.cpp src/Cpp/1-getting-started/1-2-HelloD3D11/Application.cpp

+24-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ bool Application::Initialize()
1919
return false;
2020
}
2121

22-
GLFWmonitor* primaryMonitor = glfwGetPrimaryMonitor();
23-
const GLFWvidmode* videoMode = glfwGetVideoMode(primaryMonitor);
22+
GLFWmonitor* primaryMonitor = glfwGetPrimaryMonitor();
23+
const GLFWvidmode* videoMode = glfwGetVideoMode(primaryMonitor);
2424
_width = static_cast<int32_t>(videoMode->width * 0.9f);
2525
_height = static_cast<int32_t>(videoMode->height * 0.9f);
2626

@@ -32,25 +32,36 @@ bool Application::Initialize()
3232
_title.data(),
3333
nullptr,
3434
nullptr);
35+
3536
if (_window == nullptr)
3637
{
3738
Cleanup();
3839
return false;
3940
}
4041

4142
const int32_t windowLeft = videoMode->width / 2 - _width / 2;
42-
const int32_t windowTop = videoMode->height / 2 - _height / 2;
43+
const int32_t windowTop = videoMode->height / 2 - _height / 2;
4344
glfwSetWindowPos(_window, windowLeft, windowTop);
45+
46+
glfwSetWindowUserPointer(_window, this);
47+
glfwSetFramebufferSizeCallback(_window, HandleResize);
4448
return true;
4549
}
4650

51+
void Application::OnResize(
52+
const int32_t width,
53+
const int32_t height)
54+
{
55+
_width = width;
56+
_height = height;
57+
}
58+
4759
void Application::Cleanup()
4860
{
4961
glfwDestroyWindow(_window);
5062
glfwTerminate();
5163
}
5264

53-
5465
void Application::Run()
5566
{
5667
if (!Initialize())
@@ -66,6 +77,15 @@ void Application::Run()
6677
}
6778
}
6879

80+
void Application::HandleResize(
81+
GLFWwindow* window,
82+
const int32_t width,
83+
const int32_t height)
84+
{
85+
Application& application = *static_cast<Application*>(glfwGetWindowUserPointer(window));
86+
application.OnResize(width, height);
87+
}
88+
6989
GLFWwindow* Application::GetWindow() const
7090
{
7191
return _window;

src/Cpp/1-getting-started/14-HelloCOM/Application.hpp src/Cpp/1-getting-started/1-2-HelloD3D11/Application.hpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <cstdint>
55

66
struct GLFWwindow;
7+
78
class Application
89
{
910
public:
@@ -14,11 +15,11 @@ class Application
1415
protected:
1516
static void HandleResize(
1617
GLFWwindow* window,
17-
int32_t width,
18-
int32_t height);
18+
const int32_t width,
19+
const int32_t height);
1920
virtual void OnResize(
20-
int32_t width,
21-
int32_t height);
21+
const int32_t width,
22+
const int32_t height);
2223

2324
virtual bool Initialize();
2425
virtual void Cleanup();

0 commit comments

Comments
 (0)