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