Skip to content

Commit

Permalink
Fix to build to Visual Studio 2019
Browse files Browse the repository at this point in the history
- Use nuget version of allegro
- Remove custom round function
  • Loading branch information
nikolauska committed Dec 24, 2020
1 parent 2a7cdaf commit 64a796a
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ local.properties
*.suo
*.user
*.sln.docstates
/.vs/
/packages/

# Build results

Expand Down
2 changes: 1 addition & 1 deletion Laamapeli/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void Draw::menu(int menu, int selection, int WIDTH, int HEIGHT, int FPS, int Vol
}
case(4):{
text1 = "Volume: " + to_string(Volume);
text2 = "Pan: " + round(Pan);
text2 = "Pan: " + to_string(round(Pan));
text3 = "Back";
break;
}
Expand Down
3 changes: 0 additions & 3 deletions Laamapeli/Draw.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef drawDEF
#define drawDEF

string round(float);


class Draw{
private:
int WIDTH;
Expand Down
9 changes: 4 additions & 5 deletions Laamapeli/Events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ void startTimer(int);
int initialize();
void destroy();
void groundVectorDestroy();
string round(float);
void iniWrite(string, string, string);


Expand Down Expand Up @@ -158,15 +157,15 @@ bool keyPressEvent(ALLEGRO_EVENT ev){
case(1):{ // top
// Save values currently shown in screen to ini file and initialize game again
iniWrite("Audio", "Volume", to_string(tempVolume));
iniWrite("Audio", "Pan", round(tempPan));
iniWrite("Audio", "Pan", to_string(round(tempPan)));
destroy();
initialize();
break;
}
case(2):{ // middle
// Save values currently shown in screen to ini file and initialize game again
iniWrite("Audio", "Volume", to_string(tempVolume));
iniWrite("Audio", "Pan", round(tempPan));
iniWrite("Audio", "Pan", to_string(round(tempPan)));
destroy();
initialize();
break;
Expand Down Expand Up @@ -319,7 +318,7 @@ bool mouseEvent(ALLEGRO_EVENT ev){
case(4):{ // audio menu
// Save values to ini and reinitialize game
iniWrite("Audio", "Volume", to_string(tempVolume));
iniWrite("Audio", "Pan", round(tempPan));
iniWrite("Audio", "Pan", to_string(round(tempPan)));
destroy();
initialize();
break;
Expand Down Expand Up @@ -348,7 +347,7 @@ bool mouseEvent(ALLEGRO_EVENT ev){
case(4):{ // audio menu
// Save values to ini and reinitialize game
iniWrite("Audio", "Volume", to_string(tempVolume));
iniWrite("Audio", "Pan", round(tempPan));
iniWrite("Audio", "Pan", to_string(round(tempPan)));
destroy();
initialize();
break;
Expand Down
2 changes: 0 additions & 2 deletions Laamapeli/Include.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef headerDEF
#define headerDEF

#define ALLEGRO_STATICLINK

#include <allegro5\allegro.h>
#include <allegro5\allegro_font.h>
#include <allegro5\allegro_ttf.h>
Expand Down
9 changes: 0 additions & 9 deletions Laamapeli/Ini_other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,3 @@ void getResPos(){

}
}

// return rounded float as a string (example 0,100000 to 0,1)
string round(float x) {
stringstream ss;
ss << fixed;
ss.precision(1); // set # places after decimal
ss << x;
return ss.str();
}
52 changes: 43 additions & 9 deletions Laamapeli/Laamapeli.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{57FEB4E7-8751-4D7C-98CA-68693E2270D2}</ProjectGuid>
<RootNamespace>Laamapeli</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110_xp</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand All @@ -38,18 +39,37 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Allegro_LibraryType>DynamicDebug</Allegro_LibraryType>
<Allegro_AddonImage>true</Allegro_AddonImage>
<Allegro_AddonAudio>true</Allegro_AddonAudio>
<Allegro_AddonFont>true</Allegro_AddonFont>
<Allegro_AddonTTF>true</Allegro_AddonTTF>
<Allegro_AddonAcodec>true</Allegro_AddonAcodec>
<Allegro_AddonDialog>true</Allegro_AddonDialog>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Allegro_AddonImage>true</Allegro_AddonImage>
<Allegro_AddonTTF>true</Allegro_AddonTTF>
<Allegro_AddonAudio>true</Allegro_AddonAudio>
<Allegro_AddonAcodec>true</Allegro_AddonAcodec>
<Allegro_AddonDialog>true</Allegro_AddonDialog>
<Allegro_AddonFont>true</Allegro_AddonFont>
<Allegro_LibraryType>DynamicRelease</Allegro_LibraryType>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>c:\allegro\include;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>c:\allegro\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>allegro-5.0.10-monolith-mt-debug.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -59,14 +79,16 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>c:\allegro\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>c:\allegro\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>allegro-5.0.10-monolith-mt.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand All @@ -89,7 +111,19 @@
<ClCompile Include="Player.cpp" />
<ClCompile Include="Timers.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\AllegroDeps.1.11.0\build\native\AllegroDeps.targets" Condition="Exists('..\packages\AllegroDeps.1.11.0\build\native\AllegroDeps.targets')" />
<Import Project="..\packages\Allegro.5.2.6\build\native\Allegro.targets" Condition="Exists('..\packages\Allegro.5.2.6\build\native\Allegro.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\AllegroDeps.1.11.0\build\native\AllegroDeps.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AllegroDeps.1.11.0\build\native\AllegroDeps.targets'))" />
<Error Condition="!Exists('..\packages\Allegro.5.2.6\build\native\Allegro.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Allegro.5.2.6\build\native\Allegro.targets'))" />
</Target>
</Project>
3 changes: 3 additions & 0 deletions Laamapeli/Laamapeli.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions Laamapeli/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Allegro" version="5.2.6" targetFramework="native" />
<package id="AllegroDeps" version="1.11.0" targetFramework="native" />
</packages>

0 comments on commit 64a796a

Please sign in to comment.