1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-12-18 02:27:55 +01:00

Fixed MSVC warnings, added Windows build script.

This commit is contained in:
Muzychenko Andrey 2023-09-05 10:51:19 +03:00
parent 6ab7b3e772
commit 350651dae6
7 changed files with 27 additions and 6 deletions

2
.gitignore vendored
View file

@ -298,3 +298,5 @@ _deps
.ninja_deps
.ninja_log
build.ninja
# Build directory
/build

20
BuildForWindows.ps1 Normal file
View file

@ -0,0 +1,20 @@
#Run this script from Developer Command Prompt for VS *
$artefacts = ".\bin\Release\SpaceCadetPinball.exe", ".\bin\Release\SDL2.dll", ".\bin\Release\SDL2_mixer.dll"
#X86 build
Remove-Item -Path .\build\CMakeCache.txt -ErrorAction SilentlyContinue
cmake -S . -B build -A Win32 -DCMAKE_WIN32_EXECUTABLE:BOOL=1
cmake --build build --config Release
Compress-Archive -Path $artefacts -DestinationPath ".\bin\SpaceCadetPinballx86Win.zip" -Force
#X64 build
Remove-Item -Path .\build\CMakeCache.txt
cmake -S . -B build -A x64 -DCMAKE_WIN32_EXECUTABLE:BOOL=1
cmake --build build --config Release
Compress-Archive -Path $artefacts -DestinationPath ".\bin\SpaceCadetPinballx64Win.zip" -Force
#86 XP build, requires special XP MSVC toolset
Remove-Item -Path .\build\CMakeCache.txt
cmake -S . -B build -A Win32 -DCMAKE_WIN32_EXECUTABLE:BOOL=1 -T v141_xp
cmake --build build --config Release
Compress-Archive -Path $artefacts -DestinationPath ".\bin\SpaceCadetPinballx86WinXP.zip" -Force

View file

@ -245,7 +245,7 @@ int DatFile::field_size(int groupIndex, FieldTypes targetEntryType)
int DatFile::record_labeled(LPCSTR targetGroupName)
{
auto targetLength = strlen(targetGroupName);
for (int groupIndex = Groups.size() - 1; groupIndex >= 0; --groupIndex)
for (int groupIndex = static_cast<int>(Groups.size()) - 1; groupIndex >= 0; --groupIndex)
{
auto groupName = field(groupIndex, FieldTypes::GroupName);
if (!groupName)

View file

@ -53,7 +53,7 @@ void Sound::PlaySound(Mix_Chunk* wavePtr, int time, TPinballComponent* soundSour
return a.TimeStamp < b.TimeStamp;
};
auto min = std::min_element(Channels.begin(), Channels.end(), cmp);
auto oldestChannel = std::distance(Channels.begin(), min);
auto oldestChannel = static_cast<int>(std::distance(Channels.begin(), min));
Mix_HaltChannel(oldestChannel);
}

View file

@ -89,7 +89,7 @@ void TFlagSpinner::NextFrame()
{
BmpIndex += SpinDirection;
int bmpIndex = BmpIndex;
int bmpCount = ListBitmap->size();
int bmpCount = static_cast<int>(ListBitmap->size());
if (bmpIndex >= bmpCount)
BmpIndex = 0;
else if (bmpIndex < 0)

View file

@ -115,8 +115,7 @@ void TFlipper::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
void TFlipper::UpdateSprite()
{
int bmpCountSub1 = ListBitmap->size() - 1;
auto bmpCountSub1 = static_cast<int>(ListBitmap->size()) - 1;
auto newBmpIndex = static_cast<int>(floor(FlipperEdge->CurrentAngle / FlipperEdge->AngleMax * bmpCountSub1 + 0.5f));
newBmpIndex = Clamp(newBmpIndex, 0, bmpCountSub1);
if (BmpIndex == newBmpIndex)

View file

@ -1366,7 +1366,7 @@ void winmain::RenderFrameTimeDialog()
sprintf(overlay, "avg %.3fms, dev %.3fms", average, dev);
auto region = ImGui::GetContentRegionAvail();
ImGui::PlotLines("Lines", gfrDisplay.data(), gfrDisplay.size(),
ImGui::PlotLines("Lines", gfrDisplay.data(), static_cast<int>(gfrDisplay.size()),
scrollPlot ? gfrOffset : 0, overlay, 0, yMax, region);
}
}