From 3ace9435bfebb9fb1eee5f58bc27e96c1ba8b3ca Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 8 Sep 2023 18:54:16 -0400 Subject: [PATCH] Day 1 complete. --- .vscode/launch.json | 2 +- handmade-hero-notes | 2 +- project/handmade_win32.cpp | 2 ++ project/platform/win32.h | 6 ++++++ scripts/build.ps1 | 8 ++++++++ scripts/update_deps.ps1 | 8 ++++---- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 38fe1d4..f2191e2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "name" : "Debug handmade win32 msvc", "program": "${workspaceFolder}/build/handmade_win32.exe", "args": [], - "cwd": "${workspaceFolder}/project", + "cwd": "${workspaceFolder}/data", "visualizerFile": "${workspaceFolder}/scripts/handmade.natvis" } ] diff --git a/handmade-hero-notes b/handmade-hero-notes index 68369f5..0a6995a 160000 --- a/handmade-hero-notes +++ b/handmade-hero-notes @@ -1 +1 @@ -Subproject commit 68369f571a33e32679f3878d266de64bc9ef7f84 +Subproject commit 0a6995a2cb6217d01b463bb4416c5d30c075333b diff --git a/project/handmade_win32.cpp b/project/handmade_win32.cpp index 31261fb..8b25d37 100644 --- a/project/handmade_win32.cpp +++ b/project/handmade_win32.cpp @@ -7,5 +7,7 @@ int CALLBACK WinMain( int nShowCmd ) { + MessageBox( 0, L"First message!", L"Handmade Hero", MB_OK | MB_ICONINFORMATION ); + return 0; } diff --git a/project/platform/win32.h b/project/platform/win32.h index 7c670f9..e4c48d3 100644 --- a/project/platform/win32.h +++ b/project/platform/win32.h @@ -3,4 +3,10 @@ Alternative header for windows.h */ #include "windows/windows_base.h" +#include "windows/window.h" +#ifdef UNICODE +constexpr auto MessageBox = MessageBoxW; +#else +constexpr auto MessageBox = MessageBoxA; +#endif // !UNICODE diff --git a/scripts/build.ps1 b/scripts/build.ps1 index da725c2..d67f04a 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -47,6 +47,11 @@ function run-compiler { param( $compiler, $unit, $compiler_args ) + $compiler_args += @( + ($flag_define + 'UNICODE'), + ($flag_define + '_UNICODE') + ) + write-host "`Compiling $unit" write-host "Compiler config:" $compiler_args | ForEach-Object { @@ -330,12 +335,15 @@ if ( $false ) { #region Handmade Runtime +$lib_user32 = 'User32.lib' + $unit = Join-Path $path_project 'handmade_win32.cpp' $executable = Join-Path $path_build 'handmade_win32.exe' $compiler_args = @() $linker_args = @( + $lib_user32, $flag_link_win_subsystem_windows ) diff --git a/scripts/update_deps.ps1 b/scripts/update_deps.ps1 index a3edc98..b55cd35 100644 --- a/scripts/update_deps.ps1 +++ b/scripts/update_deps.ps1 @@ -19,13 +19,13 @@ if (-not (Test-Path $path_temp)) { New-Item -ItemType Directory -Path $path_temp } -#pragma region gencpp +#region gencpp Invoke-WebRequest -Uri $url -OutFile $destinationZip Expand-Archive -Path $destinationZip -DestinationPath $path_temp Move-Item -Path (Join-Path $path_temp "gen.hpp") -Destination $path_deps -Force -#pragma endregion gencpp +#endregion gencpp -#pragma region windows modular headers +#region windows modular headers $repo = 'https://github.com/Leandros/WindowsHModular.git' Push-Location $path_temp @@ -37,6 +37,6 @@ if ( -not(test-path $path_deps_windows)) { Copy-Item -Recurse .\WindowsHModular\include\win32\* $path_deps_windows Remove-Item (Get-ChildItem -Path $path_deps_windows -Exclude '*.h' -Recurse -Force) Pop-Location -#pragma endregion windows modular headers +#endregion windows modular headers Remove-Item $path_temp -Recurse -Force