Skip to content

Commit

Permalink
Merge pull request #1 from Grave18/experemental
Browse files Browse the repository at this point in the history
Experemental
  • Loading branch information
Grave18 authored Jul 13, 2021
2 parents 36b6f1a + dc2aa61 commit c5adfd0
Show file tree
Hide file tree
Showing 18 changed files with 374 additions and 163 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Tetris
Игра Тетрис, сделанная с помощью RayLib 3.8

Для работы программы вам понадобится библиотека raylib.dll, которая должна находиться рядом с Tetris.exe
Для сборки программы вам понадобится набор заголовочных файлов и скомпилированных библиотек из этого репозитория:
https://github.com/raysan5/raylib
62 changes: 36 additions & 26 deletions Tetris.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ClCompile Include="src\Core\figure.cpp" />
<ClCompile Include="src\Core\figures.cpp" />
<ClCompile Include="src\Core\player.cpp" />
<ClCompile Include="src\Core\random_number.cpp" />
<ClCompile Include="src\Core\rectangle.cpp" />
<ClCompile Include="src\Core\world.cpp" />
<ClCompile Include="src\Game.cpp" />
Expand All @@ -32,6 +33,7 @@
<ClInclude Include="src\Core\figures.h" />
<ClInclude Include="src\Core\figure_enum.h" />
<ClInclude Include="src\Core\player.h" />
<ClInclude Include="src\Core\random_number.h" />
<ClInclude Include="src\Core\rectangle.h" />
<ClInclude Include="src\Core\world.h" />
<ClInclude Include="src\Game.h" />
Expand Down Expand Up @@ -91,106 +93,114 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Programs\Visual Studio\Ode\ode-0.16.2\include;C:\Programs\Visual Studio\RayLib 3.7.0\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\Programs\Visual Studio\Ode\build\Debug;C:\Programs\Visual Studio\RayLib 3.7.0\projects\VS2019\build\raylib\bin\x64\Debug.DLL;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
<IncludePath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\projects\VS2019\build\raylib\bin\x64\Debug.DLL;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
<OutDir>$(SolutionDir)bin\$(ProjectName)\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)bin\$(ProjectName)\intermediates\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\Programs\Visual Studio\Ode\ode-0.16.2\include;C:\Programs\Visual Studio\RayLib 3.7.0\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\Programs\Visual Studio\Ode\build\Debug;C:\Programs\Visual Studio\RayLib 3.7.0\projects\VS2019\build\raylib\bin\x64\Debug.DLL;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
<IncludePath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\projects\VS2019\build\raylib\bin\x64\Release.DLL;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
<OutDir>$(SolutionDir)bin\$(ProjectName)\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)bin\$(ProjectName)\intermediates\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Programs\Visual Studio\Ode\ode-0.16.2\include;C:\Programs\Visual Studio\RayLib 3.7.0\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\Programs\Visual Studio\Ode\build\Debug;C:\Programs\Visual Studio\RayLib 3.7.0\projects\VS2019\build\raylib\bin\x64\Debug.DLL;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<IncludePath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\projects\VS2019\build\raylib\bin\x64\Debug.DLL;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<OutDir>$(SolutionDir)bin\$(ProjectName)\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)bin\$(ProjectName)\intermediates\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\Programs\Visual Studio\Ode\ode-0.16.2\include;C:\Programs\Visual Studio\RayLib 3.7.0\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\Programs\Visual Studio\Ode\build\Debug;C:\Programs\Visual Studio\RayLib 3.7.0\projects\VS2019\build\raylib\bin\x64\Debug.DLL;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<IncludePath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\src;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\dev\dependencies\raylib\raylib 3.8.0 dev\projects\VS2019\build\raylib\bin\x64\Release.DLL;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<OutDir>$(SolutionDir)bin\$(ProjectName)\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)bin\$(ProjectName)\intermediates\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level2</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;dIDEDOUBLE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<DisableSpecificWarnings>4996;26812;4068;26495</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;26812;4068;26495;26451</DisableSpecificWarnings>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ode_doubled.lib;raylib.lib;winmm.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>
<AdditionalDependencies>raylib.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level2</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;dIDEDOUBLE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<DisableSpecificWarnings>4996;26812;4068;26495</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;26812;4068;26495;26451</DisableSpecificWarnings>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ode_doubled.lib;raylib.lib;winmm.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>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>raylib.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/SUBSYSTEM:WINDOWS
/ENTRY:mainCRTStartup %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level2</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;dIDEDOUBLE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<DisableSpecificWarnings>4996;26812;4068;26495</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;26812;4068;26495;26451</DisableSpecificWarnings>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ode_doubled.lib;raylib.lib;winmm.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>
<AdditionalDependencies>raylib.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level2</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;dIDEDOUBLE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<DisableSpecificWarnings>4996;26812;4068;26495</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;26812;4068;26495;26451</DisableSpecificWarnings>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ode_doubled.lib;raylib.lib;winmm.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>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>raylib.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/SUBSYSTEM:WINDOWS
/ENTRY:mainCRTStartup %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion src/Core/core.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Ñîäåðæèò âñå çàãîëîâî÷íûå ôàéëû, íà äàííûé ìîìåíò
* содержит все заголовочные файлы, на данный момент
*/

#pragma once
Expand Down
14 changes: 12 additions & 2 deletions src/Core/figure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Figure::Figure()
: recs{ 0 } {}

Figure::Figure(std::vector<Rec> rectangles, Color color, Color outline_color) //Color color = BLACK, Color outline_color = BLACK
: recs{ rectangles }
Figure::Figure(std::vector<Rec> rectangles, FigureEnum type, Color color, Color outline_color) //color = BLACK, outline_color = BLACK
: recs{ rectangles }, figure_type{ type }
{
size = recs.size();

Expand All @@ -13,4 +13,14 @@ Figure::Figure(std::vector<Rec> rectangles, Color color, Color outline_color) //
recs[i].color = color;
recs[i].outline_color = outline_color;
}
}

Rec& Figure::operator[](unsigned int index)
{
return recs[index];
}

const Rec& Figure::operator[](unsigned int index) const
{
return recs[index];
}
14 changes: 11 additions & 3 deletions src/Core/figure.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
#include <vector>

#include "rectangle.h"
#include "figure_enum.h"

// Ïðåäñòàâëÿåò ôèãóðó
// Представляет собой фигуру, которой управляет игрок
class Figure
{
public:
std::vector<Rec> recs;
int size;
FigureEnum figure_type;

private:
std::vector<Rec> recs;

public:
Figure();

Figure(std::vector<Rec> rectangles, Color color = BLACK, Color outline_color = BLACK);
Figure(std::vector<Rec> rectangles, FigureEnum type, Color color = BLACK, Color outline_color = BLACK);

Rec& operator[](unsigned int index);
const Rec& operator[](unsigned int index) const;
};
4 changes: 2 additions & 2 deletions src/Core/figure_enum.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

// Перечисление всех возможных фигур
// Перечисление всех возможных фигур
enum class FigureEnum
{
O, I, S, Z, L, J, T
O, I, S, Z, L, J, T, MAX_ELEMENT
};
14 changes: 7 additions & 7 deletions src/Core/figures.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "figures.h"

Figure Figures::o{ std::vector<Rec>{ { 0, 0 }, { 0, 1 }, { 1, 0 }, { 1, 1 } }, YELLOW };
Figure Figures::i{ std::vector<Rec>{ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 } }, SKYBLUE };
Figure Figures::s{ std::vector<Rec>{ { 0, 1 }, { 1, 0 }, { 1, 1 }, { 2, 0 } }, RED };
Figure Figures::z{ std::vector<Rec>{ { 0, 0 }, { 1, 0 }, { 1, 1 }, { 2, 1 } }, GREEN };
Figure Figures::l{ std::vector<Rec>{ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 2 } }, ORANGE };
Figure Figures::j{ std::vector<Rec>{ { 0, 2 }, { 1, 0 }, { 1, 1 }, { 1, 2 } }, PINK };
Figure Figures::t{ std::vector<Rec>{ { 0, 0 }, { 1, 0 }, { 2, 0}, { 1, 1 } }, PURPLE };
Figure Figures::o{ std::vector<Rec>{ { 0, 0 }, { 0, 1 }, { 1, 0 }, { 1, 1 } }, FigureEnum::O, YELLOW };
Figure Figures::i{ std::vector<Rec>{ { 0,-2 }, { 0,-1 }, { 0, 0 }, { 0, 1 } }, FigureEnum::I, SKYBLUE };
Figure Figures::s{ std::vector<Rec>{ {-1, 0 }, { 0,-1 }, { 0, 0 }, { 1,-1 } }, FigureEnum::S, RED };
Figure Figures::z{ std::vector<Rec>{ {-1,-1 }, { 0,-1 }, { 0, 0 }, { 1, 0 } }, FigureEnum::Z, GREEN };
Figure Figures::l{ std::vector<Rec>{ { 0,-1 }, { 0, 0 }, { 0, 1 }, { 1, 1 } }, FigureEnum::L, ORANGE };
Figure Figures::j{ std::vector<Rec>{ {-1, 1 }, { 0,-1 }, { 0, 0 }, { 0, 1 } }, FigureEnum::J, PINK };
Figure Figures::t{ std::vector<Rec>{ {-1, 0 }, { 0,-1 }, { 0, 0 }, { 1, 0 } }, FigureEnum::T, PURPLE };
2 changes: 1 addition & 1 deletion src/Core/figures.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "figure.h"

// Ïðåäñòàâëÿåò íàáð ïðåäîïðåäåëåííûõ ôèãóð
// Представляет собой предзаготовленные фигуры
struct Figures
{
static Figure o;
Expand Down
Loading

0 comments on commit c5adfd0

Please sign in to comment.