Implemented auto-incrementing project version numbers.

pull/28/head
sigonasr2 2 years ago
parent d099bdde84
commit 26aeb8d440
  1. 4
      Crawler/Crawler.cpp
  2. 1
      Crawler/Crawler.rc
  3. 13
      Crawler/Crawler.vcxproj
  4. 3
      Crawler/Crawler.vcxproj.filters
  5. 5
      Crawler/Version.h
  6. 10
      Crawler/update_version.ps1

@ -5,6 +5,7 @@
#include "Bullet.h" #include "Bullet.h"
#include "Ability.h" #include "Ability.h"
#include "Class.h" #include "Class.h"
#include "Version.h"
#include "DEFINES.h" #include "DEFINES.h"
//192x192 //192x192
@ -684,6 +685,9 @@ void Crawler::RenderHud(){
} }
} }
DrawStringPropDecal({20,3},text,WHITE,{2,2}); DrawStringPropDecal({20,3},text,WHITE,{2,2});
std::string versionStr("v" + std::to_string(VERSION_MAJOR) + "." + std::to_string(VERSION_MINOR) + "." + std::to_string(VERSION_PATCH) + "." + std::to_string(VERSION_BUILD));
DrawStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.6 - vf2d{ -1,0 }, versionStr, WHITE, { 0.6,0.6 });
DrawStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.6, versionStr, BLACK,{0.6,0.6});
} }
void Crawler::AddEffect(Effect foreground,Effect background){ void Crawler::AddEffect(Effect foreground,Effect background){

@ -1,5 +1,6 @@
// Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
// //
// ... other stuff
#include "resource.h" #include "resource.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (United States) resources // English (United States) resources

@ -81,6 +81,9 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PreBuildEvent>
<Command>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File update_version.ps1 "./version.h"</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
@ -97,6 +100,9 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PreBuildEvent>
<Command>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File update_version.ps1 "./version.h"</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
@ -110,6 +116,9 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PreBuildEvent>
<Command>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File update_version.ps1 "./version.h"</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
@ -127,6 +136,9 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PreBuildEvent>
<Command>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File update_version.ps1 "./version.h"</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Ability.h" /> <ClInclude Include="Ability.h" />
@ -147,6 +159,7 @@
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="resource1.h" /> <ClInclude Include="resource1.h" />
<ClInclude Include="State.h" /> <ClInclude Include="State.h" />
<ClInclude Include="Version.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Ability.cpp" /> <ClCompile Include="Ability.cpp" />

@ -72,6 +72,9 @@
<ClInclude Include="resource.h"> <ClInclude Include="resource.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Version.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Player.cpp"> <ClCompile Include="Player.cpp">

@ -0,0 +1,5 @@
#pragma once
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 10

@ -0,0 +1,10 @@
(Get-Content -path $args[0] -Raw) |
ForEach-Object {
$defstr="#define VERSION_BUILD ";
$regex="$defstr(?<BuildVersion>\d*)";
if($_ -match $regex) {
$_ = $_ -replace $regex,"$($defstr)$(([int]$matches["BuildVersion"])+1)"
}
$_
} |
Out-File $args[0] -encoding ascii -nonewline
Loading…
Cancel
Save