This commit is contained in:
2024-01-30 15:45:14 +01:00
parent d67394aaec
commit ca204d05af
17 changed files with 658 additions and 568 deletions
+36 -36
View File
@@ -1,37 +1,37 @@
# Prerequisites # Prerequisites
*.d *.d
# Compiled Object files # Compiled Object files
*.slo *.slo
*.lo *.lo
*.o *.o
*.obj *.obj
# Precompiled Headers # Precompiled Headers
*.gch *.gch
*.pch *.pch
# Compiled Dynamic libraries # Compiled Dynamic libraries
*.so *.so
*.dylib *.dylib
*.dll *.dll
# Fortran module files # Fortran module files
*.mod *.mod
*.smod *.smod
# Compiled Static libraries # Compiled Static libraries
*.lai *.lai
*.la *.la
*.a *.a
*.lib *.lib
# Executables # Executables
*.exe *.exe
*.out *.out
*.app *.app
# Visual Studio # Visual Studio
.vs .vs
vcpkg_installed vcpkg_installed
x64 x64
+31 -31
View File
@@ -1,31 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188 VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Space-Invader", "Space-Invader.vcxproj", "{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Space-Invader", "Space-Invader.vcxproj", "{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
Release|x64 = Release|x64 Release|x64 = Release|x64
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.ActiveCfg = Debug|x64 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.ActiveCfg = Debug|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.Build.0 = Debug|x64 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.Build.0 = Debug|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.ActiveCfg = Debug|Win32 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.ActiveCfg = Debug|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.Build.0 = Debug|Win32 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.Build.0 = Debug|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.ActiveCfg = Release|x64 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.ActiveCfg = Release|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.Build.0 = Release|x64 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.Build.0 = Release|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.ActiveCfg = Release|Win32 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.ActiveCfg = Release|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.Build.0 = Release|Win32 {77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC394877-8CB5-406D-846E-C6337AFC7323} SolutionGuid = {FC394877-8CB5-406D-846E-C6337AFC7323}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal
+160 -158
View File
@@ -1,159 +1,161 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64"> <ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion> <VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<ProjectGuid>{77e81a7a-9e66-4c14-8c8c-2d046feb7de8}</ProjectGuid> <ProjectGuid>{77e81a7a-9e66-4c14-8c8c-2d046feb7de8}</ProjectGuid>
<RootNamespace>SpaceInvader</RootNamespace> <RootNamespace>SpaceInvader</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="Shared"> <ImportGroup Label="Shared">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<CopyLocalDeploymentContent>true</CopyLocalDeploymentContent> <CopyLocalDeploymentContent>true</CopyLocalDeploymentContent>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<CopyLocalDeploymentContent>true</CopyLocalDeploymentContent> <CopyLocalDeploymentContent>true</CopyLocalDeploymentContent>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Vcpkg"> <PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest> <VcpkgEnableManifest>true</VcpkgEnableManifest>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<None Include="vcpkg.json" /> <None Include="vcpkg.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="lib\GameManager.cpp" /> <ClCompile Include="lib\Alien.cpp" />
<ClCompile Include="lib\Laser.cpp" /> <ClCompile Include="lib\GameManager.cpp" />
<ClCompile Include="lib\Shield.cpp" /> <ClCompile Include="lib\Laser.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="lib\Shield.cpp" />
<ClCompile Include="lib\Player.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> <ClCompile Include="lib\Player.cpp" />
<ItemGroup> </ItemGroup>
<ClInclude Include="include\GameManager.h" /> <ItemGroup>
<ClInclude Include="include\Laser.h" /> <ClInclude Include="include\Alien.h" />
<ClInclude Include="include\Player.h" /> <ClInclude Include="include\GameManager.h" />
<ClInclude Include="include\Shield.h" /> <ClInclude Include="include\Laser.h" />
</ItemGroup> <ClInclude Include="include\Player.h" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ClInclude Include="include\Shield.h" />
<ImportGroup Label="ExtensionTargets"> </ItemGroup>
</ImportGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project> </Project>
+56 -50
View File
@@ -1,51 +1,57 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Fichiers sources"> <Filter Include="Fichiers sources">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter> </Filter>
<Filter Include="Fichiers d%27en-tête"> <Filter Include="Fichiers d%27en-tête">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter> </Filter>
<Filter Include="Fichiers de ressources"> <Filter Include="Fichiers de ressources">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="vcpkg.json" /> <None Include="vcpkg.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="lib\Player.cpp"> <ClCompile Include="lib\Player.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="lib\Laser.cpp"> <ClCompile Include="lib\Laser.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="lib\GameManager.cpp"> <ClCompile Include="lib\GameManager.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="lib\Shield.cpp"> <ClCompile Include="lib\Shield.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
</ItemGroup> <ClCompile Include="lib\Alien.cpp">
<ItemGroup> <Filter>Fichiers sources</Filter>
<ClInclude Include="include\Player.h"> </ClCompile>
<Filter>Fichiers d%27en-tête</Filter> </ItemGroup>
</ClInclude> <ItemGroup>
<ClInclude Include="include\Laser.h"> <ClInclude Include="include\Player.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\GameManager.h"> <ClInclude Include="include\Laser.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\Shield.h"> <ClInclude Include="include\GameManager.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
</ItemGroup> <ClInclude Include="include\Shield.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="include\Alien.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup>
</Project> </Project>
+5 -5
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ShowAllFiles>true</ShowAllFiles> <ShowAllFiles>true</ShowAllFiles>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <iostream>
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
class Alien
{
public:
Alien(Vector2f& position);
RectangleShape& getShape() { return _shape; };
private:
RectangleShape _shape;
};
+36 -32
View File
@@ -1,32 +1,36 @@
#pragma once #pragma once
#include <cstdlib> #include <cstdlib>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include "Player.h" #include "Player.h"
#include "Laser.h" #include "Laser.h"
#include "Shield.h" #include "Shield.h"
#include "Alien.h"
using namespace std;
using namespace sf; using namespace std;
using namespace sf;
class GameManager
{ class GameManager
public: {
GameManager(); public:
GameManager();
void run();
void handleInputs(); void run();
void handleLasersCollision(); void handleInputs();
void handleLasersCollision();
private:
Clock _clock; private:
Clock _clock;
//RenderWindow _window{ VideoMode::getFullscreenModes()[0], "Space Invader", Style::Fullscreen };
RenderWindow _window{ VideoMode(1024, 800), "Space Invader", Style::Close | Style::Titlebar}; const int alienScreenMargin = 50;
Player _player = { _window.getSize() }; //RenderWindow _window{ VideoMode::getFullscreenModes()[0], "Space Invader", Style::Fullscreen };
RenderWindow _window{ VideoMode(1024, 800), "Space Invader", Style::Close | Style::Titlebar};
vector<Laser*> _lasers;
vector<Shield*> _shields; Player _player = { _window.getSize() };
};
vector<Laser*> _lasers;
vector<Shield*> _shields;
vector<Alien*> _aliens;
};
+21 -22
View File
@@ -1,22 +1,21 @@
#pragma once #pragma once
#include <iostream> #include <iostream>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
using namespace std; using namespace std;
using namespace sf; using namespace sf;
class Laser class Laser
{ {
public: public:
Laser() {}; Laser(Window& window);
Laser(Window& window);
RectangleShape& getShape() { return _laser; }
RectangleShape& getShape() { return _laser; }
void setInitialPosition(Vector2f position);
void setInitialPosition(Vector2f position);
private:
private: RectangleShape _laser;
RectangleShape _laser; };
};
+25 -25
View File
@@ -1,25 +1,25 @@
#pragma once #pragma once
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
using namespace std; using namespace std;
using namespace sf; using namespace sf;
class Player class Player
{ {
public: public:
Player(Vector2u screenSize); Player(Vector2u screenSize);
CircleShape& getShape() { return _shape; }; CircleShape& getShape() { return _shape; };
void move(int direction); void move(int direction);
private: private:
CircleShape _shape; CircleShape _shape;
int _screenWidth; int _screenWidth;
}; };
+24 -25
View File
@@ -1,26 +1,25 @@
#pragma once #pragma once
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
using namespace sf; using namespace sf;
using namespace std; using namespace std;
class Shield class Shield
{ {
public: public:
Shield() {}; Shield(Window& window);
Shield(Window& window);
void setPosition(Vector2f position);
void setPosition(Vector2f position);
RectangleShape& getShape() { return _shape; };
RectangleShape& getShape() { return _shape; };
int getLife() const { return _life; };
int getLife() const { return _life; }; void decreaseLife() { _life -= 1; };
void decreaseLife() { _life -= 1; };
private:
private: int _life = 10;
int _life = 10; RectangleShape _shape;
RectangleShape _shape;
}; };
+7
View File
@@ -0,0 +1,7 @@
#include "Alien.h"
Alien::Alien(Vector2f& position) {
_shape = RectangleShape(Vector2f(100, 50));
_shape.setFillColor(Color::Red);
_shape.setPosition(Vector2f(position.x - (_shape.getScale().x / 2.0), position.y));
}
+172 -117
View File
@@ -1,118 +1,173 @@
#include "GameManager.h"; #include "GameManager.h"
GameManager::GameManager() { GameManager::GameManager() {
_window.setVerticalSyncEnabled(true); _window.setVerticalSyncEnabled(true);
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
Shield* shield = new Shield(_window); Shield* shield = new Shield(_window);
shield->setPosition(Vector2f(_window.getSize().x / 4.25 * i, _window.getSize().y * 0.9)); shield->setPosition(Vector2f(_window.getSize().x / 4.25f * i, _window.getSize().y * 0.9f));
_shields.push_back(shield); _shields.push_back(shield);
} }
}
const int rows = 3;
void GameManager::run() { const int cols = 6;
while (_window.isOpen()) { const int distX = 135;
const int distY = 85;
Event event;
while (_window.pollEvent(event)) { for (int row = 0; row < rows; row++) {
if (event.type == Event::Closed) { for (int col = 0; col < cols; col++) {
_window.close(); Vector2f position(col * distX + alienScreenMargin + 1, row * distY + alienScreenMargin);
} Alien* alien = new Alien(position);
}
_aliens.push_back(alien);
// Handle user's inputs }
handleInputs(); }
}
_window.clear(Color::Black);
void GameManager::run() {
// Draw everything int alienDirection = 1;
_window.draw(_player.getShape()); const float alienXStep = 10;
const int moveDownStep = 5;
for (auto shield : _shields) { int moveDown = 0;
_window.draw(shield->getShape());
} Clock alienClock;
for (vector<Laser *>::iterator it = _lasers.begin(); it < _lasers.end();) { while (_window.isOpen()) {
_window.draw((*it)->getShape());
Event event;
(*it)->getShape().move(0, -5); while (_window.pollEvent(event)) {
if (event.type == Event::Closed) {
if ((*it)->getShape().getPosition().y < -(*it)->getShape().getScale().y) { _window.close();
delete* it; }
it = _lasers.erase(it); }
continue;
} // Handle user's inputs
handleInputs();
++it;
} _window.clear(Color::Black);
handleLasersCollision(); // Draw everything
_window.draw(_player.getShape());
_window.display();
} for (auto shield : _shields) {
} _window.draw(shield->getShape());
}
void GameManager::handleInputs() {
// Exit event for (Alien* alien : _aliens) {
if (Keyboard::isKeyPressed(Keyboard::Escape)) { const FloatRect bounds = alien->getShape().getGlobalBounds();
_window.close();
} if (bounds.left + bounds.width >= _window.getSize().x - alienScreenMargin || bounds.left <= alienScreenMargin) {
alienDirection *= -1;
// Player movements moveDown = moveDownStep;
if (Keyboard::isKeyPressed(Keyboard::Left) || Keyboard::isKeyPressed(Keyboard::Q)) { break;
_player.move(-1); }
} }
if (Keyboard::isKeyPressed(Keyboard::Right) || Keyboard::isKeyPressed(Keyboard::D)) { for (Alien* alien : _aliens) {
_player.move(1); _window.draw(alien->getShape());
} }
if (Keyboard::isKeyPressed(Keyboard::Space)) {
if (_clock.getElapsedTime().asMilliseconds() > 500) { if (alienClock.getElapsedTime().asMilliseconds() >= 500) {
const Vector2f playerPos = _player.getShape().getPosition(); for (Alien* alien : _aliens) {
const float playerRadius = _player.getShape().getRadius(); alien->getShape().move(alienXStep * alienDirection, moveDown);
}
Laser* laser = new Laser(_window); alienClock.restart();
laser->setInitialPosition(Vector2f(playerPos.x + playerRadius, playerPos.y - playerRadius)); }
moveDown = 0;
_lasers.push_back(laser);
_clock.restart(); for (vector<Laser *>::iterator it = _lasers.begin(); it < _lasers.end();) {
} _window.draw((*it)->getShape());
}
} (*it)->getShape().move(0, -5);
void GameManager::handleLasersCollision() { if ((*it)->getShape().getPosition().y < -(*it)->getShape().getScale().y) {
bool restartClock = false; delete* it;
for (vector<Laser*>::iterator laserIt = _lasers.begin(); laserIt < _lasers.end();) { it = _lasers.erase(it);
bool deleteLaser = false; continue;
for (vector<Shield*>::iterator shieldIt = _shields.begin(); shieldIt < _shields.end();) { }
if ((*laserIt)->getShape().getGlobalBounds().intersects((*shieldIt)->getShape().getGlobalBounds())) {
if ((*shieldIt)->getLife() - 1 == 0) { ++it;
delete* shieldIt; }
shieldIt = _shields.erase(shieldIt);
} handleLasersCollision();
(*shieldIt)->decreaseLife(); _window.display();
deleteLaser = true; }
break; }
}
++shieldIt; void GameManager::handleInputs() {
} // Exit event
if (Keyboard::isKeyPressed(Keyboard::Escape)) {
if (deleteLaser) { _window.close();
delete* laserIt; }
laserIt = _lasers.erase(laserIt);
// Player movements
restartClock = true; if (Keyboard::isKeyPressed(Keyboard::Left) || Keyboard::isKeyPressed(Keyboard::Q)) {
continue; _player.move(-1);
} }
++laserIt; if (Keyboard::isKeyPressed(Keyboard::Right) || Keyboard::isKeyPressed(Keyboard::D)) {
} _player.move(1);
}
if (restartClock) {
_clock.restart(); if (Keyboard::isKeyPressed(Keyboard::Space)) {
} if (_clock.getElapsedTime().asMilliseconds() > 500) {
const Vector2f playerPos = _player.getShape().getPosition();
const float playerRadius = _player.getShape().getRadius();
Laser* laser = new Laser(_window);
laser->setInitialPosition(Vector2f(playerPos.x + playerRadius, playerPos.y - playerRadius));
_lasers.push_back(laser);
_clock.restart();
}
}
}
void GameManager::handleLasersCollision() {
bool restartClock = false;
for (vector<Laser*>::iterator laserIt = _lasers.begin(); laserIt < _lasers.end();) {
bool deleteLaser = false;
for (vector<Shield*>::iterator shieldIt = _shields.begin(); shieldIt < _shields.end();) {
if ((*laserIt)->getShape().getGlobalBounds().intersects((*shieldIt)->getShape().getGlobalBounds())) {
if ((*shieldIt)->getLife() - 1 == 0) {
delete* shieldIt;
shieldIt = _shields.erase(shieldIt);
}
(*shieldIt)->decreaseLife();
deleteLaser = true;
break;
}
++shieldIt;
}
for (vector<Alien*>::iterator alienIt = _aliens.begin(); alienIt < _aliens.end();) {
if ((*laserIt)->getShape().getGlobalBounds().intersects((*alienIt)->getShape().getGlobalBounds())) {
delete* alienIt;
alienIt = _aliens.erase(alienIt);
deleteLaser = true;
break;
}
++alienIt;
}
if (deleteLaser) {
delete* laserIt;
laserIt = _lasers.erase(laserIt);
restartClock = true;
continue;
}
++laserIt;
}
if (restartClock) {
_clock.restart();
}
} }
+10 -10
View File
@@ -1,11 +1,11 @@
#include "Laser.h" #include "Laser.h"
Laser::Laser(Window& _window) Laser::Laser(Window& _window)
{ {
_laser = RectangleShape(Vector2f(_window.getSize().x / 600, _window.getSize().y / 30)); _laser = RectangleShape(Vector2f(_window.getSize().x / 600, _window.getSize().y / 30));
_laser.setFillColor(Color::White); _laser.setFillColor(Color::White);
} }
void Laser::setInitialPosition(Vector2f position) { void Laser::setInitialPosition(Vector2f position) {
_laser.setPosition(Vector2f(position.x - (_laser.getScale().x / 2), position.y)); _laser.setPosition(Vector2f(position.x - (_laser.getScale().x / 2), position.y));
} }
+21 -21
View File
@@ -1,22 +1,22 @@
#include "Player.h"; #include "Player.h";
Player::Player(Vector2u screenSize): _screenWidth(screenSize.x) { Player::Player(Vector2u screenSize): _screenWidth(screenSize.x) {
_shape = CircleShape(screenSize.x / 70, 3); _shape = CircleShape(screenSize.x / 70, 3);
_shape.setFillColor(Color(52, 252, 5)); _shape.setFillColor(Color(52, 252, 5));
float shapeHeight = _shape.getRadius() * 1.5; float shapeHeight = _shape.getRadius() * 1.5;
_shape.setPosition(_screenWidth / 2.f, screenSize.y - shapeHeight); _shape.setPosition(_screenWidth / 2.f, screenSize.y - shapeHeight);
} }
void Player::move(int direction) { void Player::move(int direction) {
float max = _screenWidth - (_shape.getRadius() * 2); float max = _screenWidth - (_shape.getRadius() * 2);
float result = (_screenWidth / 724.0)*direction; float result = (_screenWidth / 724.0)*direction;
// Prevent leaving the window // Prevent leaving the window
if (_shape.getPosition().x + result < 0 || _shape.getPosition().x + result > max) { if (_shape.getPosition().x + result < 0 || _shape.getPosition().x + result > max) {
result = 0; result = 0;
} }
_shape.move(result, 0); _shape.move(result, 0);
} }
+12 -12
View File
@@ -1,13 +1,13 @@
#include "Shield.h" #include "Shield.h"
Shield::Shield(Window& window) { Shield::Shield(Window& window) {
int shapeWidth = window.getSize().x / 10; int shapeWidth = window.getSize().x / 10;
int shapeHeight = window.getSize().y / 35; int shapeHeight = window.getSize().y / 35;
_shape = RectangleShape(Vector2f(shapeWidth, shapeHeight)); _shape = RectangleShape(Vector2f(shapeWidth, shapeHeight));
_shape.setFillColor(Color(Color(52, 252, 5))); _shape.setFillColor(Color(Color(52, 252, 5)));
} }
void Shield::setPosition(Vector2f position) { void Shield::setPosition(Vector2f position) {
_shape.setPosition(position.x + _shape.getSize().x, position.y - _shape.getScale().y); _shape.setPosition(position.x + _shape.getSize().x, position.y - _shape.getScale().y);
} }
+15 -15
View File
@@ -1,16 +1,16 @@
using namespace std; using namespace std;
#include <iostream> #include <iostream>
#include "GameManager.h" #include "GameManager.h"
int main() int main()
{ {
cout << "Starting game..." << endl; cout << "Starting game..." << endl;
GameManager gameManager; GameManager gameManager;
cout << "Game started." << endl; cout << "Game started." << endl;
gameManager.run(); gameManager.run();
return 0; return 0;
} }
+9 -9
View File
@@ -1,10 +1,10 @@
{ {
"name": "space-invader", "name": "space-invader",
"version": "0.0.0", "version": "0.0.0",
"description": "Space Invader Copy", "description": "Space Invader Copy",
"dependencies": [ "dependencies": [
{ {
"name": "sfml" "name": "sfml"
} }
] ]
} }