Skip to content

Commit 1c5ce2e

Browse files
committed
Vector2 class completed
1 parent cdc06a4 commit 1c5ce2e

File tree

117 files changed

+623
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+623
-0
lines changed

NullX.sdf

64 KB
Binary file not shown.

NullX.sln

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.24720.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NullX", "NullX\NullX.vcxproj", "{9A08611A-3ABD-496C-B236-5897A31CC573}"
7+
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Testing", "Testing\Testing.vcxproj", "{B232150F-C475-4AB8-BFDD-5924766AAB7A}"
9+
ProjectSection(ProjectDependencies) = postProject
10+
{9A08611A-3ABD-496C-B236-5897A31CC573} = {9A08611A-3ABD-496C-B236-5897A31CC573}
11+
EndProjectSection
12+
EndProject
13+
Global
14+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+
Debug|x64 = Debug|x64
16+
Debug|x86 = Debug|x86
17+
Release|x64 = Release|x64
18+
Release|x86 = Release|x86
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Debug|x64.ActiveCfg = Debug|x64
22+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Debug|x64.Build.0 = Debug|x64
23+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Debug|x86.ActiveCfg = Debug|Win32
24+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Debug|x86.Build.0 = Debug|Win32
25+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Release|x64.ActiveCfg = Release|x64
26+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Release|x64.Build.0 = Release|x64
27+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Release|x86.ActiveCfg = Release|Win32
28+
{9A08611A-3ABD-496C-B236-5897A31CC573}.Release|x86.Build.0 = Release|Win32
29+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Debug|x64.ActiveCfg = Debug|x64
30+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Debug|x64.Build.0 = Debug|x64
31+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Debug|x86.ActiveCfg = Debug|Win32
32+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Debug|x86.Build.0 = Debug|Win32
33+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Release|x64.ActiveCfg = Release|x64
34+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Release|x64.Build.0 = Release|x64
35+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Release|x86.ActiveCfg = Release|Win32
36+
{B232150F-C475-4AB8-BFDD-5924766AAB7A}.Release|x86.Build.0 = Release|Win32
37+
EndGlobalSection
38+
GlobalSection(SolutionProperties) = preSolution
39+
HideSolutionNode = FALSE
40+
EndGlobalSection
41+
EndGlobal

NullX/NullX.vcxproj

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<ProjectGuid>{9A08611A-3ABD-496C-B236-5897A31CC573}</ProjectGuid>
23+
<RootNamespace>NullX</RootNamespace>
24+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
25+
</PropertyGroup>
26+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
28+
<ConfigurationType>StaticLibrary</ConfigurationType>
29+
<UseDebugLibraries>true</UseDebugLibraries>
30+
<PlatformToolset>v140</PlatformToolset>
31+
<CharacterSet>MultiByte</CharacterSet>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
34+
<ConfigurationType>StaticLibrary</ConfigurationType>
35+
<UseDebugLibraries>false</UseDebugLibraries>
36+
<PlatformToolset>v140</PlatformToolset>
37+
<WholeProgramOptimization>true</WholeProgramOptimization>
38+
<CharacterSet>MultiByte</CharacterSet>
39+
</PropertyGroup>
40+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
41+
<ConfigurationType>StaticLibrary</ConfigurationType>
42+
<UseDebugLibraries>true</UseDebugLibraries>
43+
<PlatformToolset>v140</PlatformToolset>
44+
<CharacterSet>MultiByte</CharacterSet>
45+
</PropertyGroup>
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
47+
<ConfigurationType>StaticLibrary</ConfigurationType>
48+
<UseDebugLibraries>false</UseDebugLibraries>
49+
<PlatformToolset>v140</PlatformToolset>
50+
<WholeProgramOptimization>true</WholeProgramOptimization>
51+
<CharacterSet>MultiByte</CharacterSet>
52+
</PropertyGroup>
53+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
54+
<ImportGroup Label="ExtensionSettings">
55+
</ImportGroup>
56+
<ImportGroup Label="Shared">
57+
</ImportGroup>
58+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
59+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
60+
</ImportGroup>
61+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
62+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
63+
</ImportGroup>
64+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
65+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
66+
</ImportGroup>
67+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
68+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
69+
</ImportGroup>
70+
<PropertyGroup Label="UserMacros" />
71+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
72+
<OutDir>$(ProjectDir)build\Debug\</OutDir>
73+
<IntDir>$(ProjectDir)debug\Debug\</IntDir>
74+
<TargetName>$(ProjectName)32</TargetName>
75+
<TargetExt>.lib</TargetExt>
76+
<IncludePath>$(ProjectDir)include\;$(IncludePath)</IncludePath>
77+
<SourcePath>$(ProjectDir)src\;$(SourcePath)</SourcePath>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
80+
<IncludePath>$(ProjectDir)include\;$(IncludePath)</IncludePath>
81+
<SourcePath>$(ProjectDir)src\;$(SourcePath)</SourcePath>
82+
<OutDir>$(ProjectDir)build\Release\</OutDir>
83+
<IntDir>$(ProjectDir)debug\Release\</IntDir>
84+
<TargetName>$(ProjectName)32</TargetName>
85+
<TargetExt>.lib</TargetExt>
86+
</PropertyGroup>
87+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
88+
<IncludePath>$(ProjectDir)include\;$(IncludePath)</IncludePath>
89+
<SourcePath>$(ProjectDir)src\;$(SourcePath)</SourcePath>
90+
<OutDir>$(ProjectDir)build\Debug\</OutDir>
91+
<IntDir>$(ProjectDir)\debug\x64\Debug\</IntDir>
92+
<TargetExt>.lib</TargetExt>
93+
</PropertyGroup>
94+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
95+
<IncludePath>$(ProjectDir)include\;$(IncludePath)</IncludePath>
96+
<SourcePath>$(ProjectDir)src\;$(SourcePath)</SourcePath>
97+
<OutDir>$(ProjectDir)build\Release\</OutDir>
98+
<IntDir>$(ProjectDir)debug\x64\Release\</IntDir>
99+
<TargetExt>.lib</TargetExt>
100+
</PropertyGroup>
101+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
102+
<ClCompile>
103+
<WarningLevel>Level3</WarningLevel>
104+
<Optimization>Disabled</Optimization>
105+
<SDLCheck>true</SDLCheck>
106+
</ClCompile>
107+
</ItemDefinitionGroup>
108+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
109+
<ClCompile>
110+
<WarningLevel>Level3</WarningLevel>
111+
<Optimization>Disabled</Optimization>
112+
<SDLCheck>true</SDLCheck>
113+
</ClCompile>
114+
</ItemDefinitionGroup>
115+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
116+
<ClCompile>
117+
<WarningLevel>Level3</WarningLevel>
118+
<Optimization>MaxSpeed</Optimization>
119+
<FunctionLevelLinking>true</FunctionLevelLinking>
120+
<IntrinsicFunctions>true</IntrinsicFunctions>
121+
<SDLCheck>true</SDLCheck>
122+
</ClCompile>
123+
<Link>
124+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
125+
<OptimizeReferences>true</OptimizeReferences>
126+
</Link>
127+
</ItemDefinitionGroup>
128+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
129+
<ClCompile>
130+
<WarningLevel>Level3</WarningLevel>
131+
<Optimization>MaxSpeed</Optimization>
132+
<FunctionLevelLinking>true</FunctionLevelLinking>
133+
<IntrinsicFunctions>true</IntrinsicFunctions>
134+
<SDLCheck>true</SDLCheck>
135+
</ClCompile>
136+
<Link>
137+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
138+
<OptimizeReferences>true</OptimizeReferences>
139+
</Link>
140+
</ItemDefinitionGroup>
141+
<ItemGroup>
142+
<ClInclude Include="include\NullX.h" />
143+
</ItemGroup>
144+
<ItemGroup>
145+
<ClCompile Include="src\Vector2.cpp" />
146+
</ItemGroup>
147+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
148+
<ImportGroup Label="ExtensionTargets">
149+
</ImportGroup>
150+
</Project>

NullX/NullX.vcxproj.filters

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClInclude Include="include\NullX.h">
19+
<Filter>Header Files</Filter>
20+
</ClInclude>
21+
</ItemGroup>
22+
<ItemGroup>
23+
<ClCompile Include="src\Vector2.cpp">
24+
<Filter>Source Files</Filter>
25+
</ClCompile>
26+
</ItemGroup>
27+
</Project>

NullX/build/Debug/NullX.lib

32.4 KB
Binary file not shown.

NullX/build/Debug/NullX.pdb

76 KB
Binary file not shown.

NullX/build/Debug/NullX32.lib

2.71 KB
Binary file not shown.

NullX/build/Release/NullX.lib

5.05 KB
Binary file not shown.

NullX/build/Release/NullX32.lib

5.02 KB
Binary file not shown.

NullX/debug/Debug/NullX.idb

19 KB
Binary file not shown.

NullX/debug/Debug/NullX.log

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
 Vector2.cpp
2+
NullX.vcxproj -> C:\Users\CaptainKirk\Desktop\NullX\NullX\build\Debug\NullX32.lib

NullX/debug/Debug/NullX.pdb

60 KB
Binary file not shown.
768 Bytes
Binary file not shown.
430 Bytes
Binary file not shown.
508 Bytes
Binary file not shown.
430 Bytes
Binary file not shown.
268 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
2+
Debug|Win32|C:\Users\CaptainKirk\Desktop\NullX\|
428 Bytes
Binary file not shown.

NullX/debug/Debug/Vector2.obj

2.38 KB
Binary file not shown.

NullX/debug/Release/NullX.log

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
 Vector2.cpp
2+
NullX.vcxproj -> C:\Users\CaptainKirk\Desktop\NullX\NullX\build\Release\NullX32.lib

NullX/debug/Release/NullX.pdb

60 KB
Binary file not shown.
788 Bytes
Binary file not shown.
430 Bytes
Binary file not shown.
388 Bytes
Binary file not shown.
438 Bytes
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
2+
Release|Win32|C:\Users\CaptainKirk\Desktop\NullX\|
452 Bytes
Binary file not shown.

NullX/debug/Release/Vector2.obj

4.7 KB
Binary file not shown.

NullX/debug/x64/Debug/NullX.idb

43 KB
Binary file not shown.

NullX/debug/x64/Debug/NullX.log

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
 Vector2.cpp
2+
NullX.vcxproj -> C:\Users\CaptainKirk\Desktop\NullX\NullX\build\Debug\NullX.lib

NullX/debug/x64/Debug/NullX.pdb

76 KB
Binary file not shown.
758 Bytes
Binary file not shown.
1.43 KB
Binary file not shown.
532 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
2+
Debug|x64|C:\Users\CaptainKirk\Desktop\NullX\|
468 Bytes
Binary file not shown.

NullX/debug/x64/Debug/Vector2.obj

30.1 KB
Binary file not shown.

NullX/debug/x64/Release/NullX.log

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
 Vector2.cpp
2+
NullX.vcxproj -> C:\Users\CaptainKirk\Desktop\NullX\NullX\build\Release\NullX.lib

NullX/debug/x64/Release/NullX.pdb

60 KB
Binary file not shown.
Binary file not shown.
450 Bytes
Binary file not shown.
404 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
2+
Release|x64|C:\Users\CaptainKirk\Desktop\NullX\|
Binary file not shown.

NullX/debug/x64/Release/Vector2.obj

4.72 KB
Binary file not shown.

NullX/include/NullX.h

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#pragma once
2+
3+
namespace NullX
4+
{
5+
class Vector2
6+
{
7+
public:
8+
// Member Variables
9+
float x;
10+
float y;
11+
12+
// Static Variables
13+
static Vector2 up;
14+
static Vector2 down;
15+
static Vector2 left;
16+
static Vector2 right;
17+
18+
// Constructors
19+
Vector2();
20+
Vector2(float _x, float _y);
21+
Vector2(const Vector2& vec);
22+
23+
// Member Functions
24+
void Normalize();
25+
26+
// Static Functions
27+
static Vector2 Normalized(Vector2& vec);
28+
static float Magnitude(const Vector2& vec);
29+
static float MagnitudeSqr(const Vector2& vec);
30+
static float Dot(const Vector2& vec1, const Vector2& vec2);
31+
static float Angle(Vector2& vec1, Vector2& vec2);
32+
static float Distance(Vector2& vec1, Vector2& vec2);
33+
static Vector2 Clamp(Vector2& vec, const float mag);
34+
static Vector2 Projection(Vector2& vec1, Vector2& vec2);
35+
36+
// Operator Overloads
37+
bool operator == (const Vector2& vec);
38+
bool operator != (const Vector2& vec);
39+
Vector2 operator + (const Vector2& vec);
40+
Vector2 operator - (const Vector2& vec);
41+
Vector2 operator * (const float num);
42+
Vector2 operator / (const float num);
43+
Vector2 operator += (const Vector2& vec);
44+
Vector2 operator -= (const Vector2& vec);
45+
Vector2 operator *= (const float num);
46+
Vector2 operator /= (const float num);
47+
};
48+
}

0 commit comments

Comments
 (0)