Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
*.pdb

Debug/
packages/
26 changes: 15 additions & 11 deletions RoboCat/Chapter3.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<AdditionalIncludeDirectories>..\SDL\include;Inc;..\</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>RoboCatPCH.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
Expand Down Expand Up @@ -370,11 +370,11 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Inc\ByteSwap.h" />
<ClInclude Include="Inc\LinkingContext.h" />
<ClInclude Include="Inc\MemoryBitStream.h" />
<ClCompile Include="PlayerUser.cpp" />
<ClCompile Include="Unit.cpp" />
<ClCompile Include="UnitManager.cpp" />
<ClInclude Include="Color.h" />
<ClInclude Include="Inc\OutputWindow.h" />
<ClInclude Include="Inc\RoboMath.h" />
<ClInclude Include="Inc\SocketAddress.h" />
<ClInclude Include="Inc\SocketAddressFactory.h" />
<ClInclude Include="Inc\SocketUtil.h" />
Expand All @@ -383,14 +383,18 @@
<ClInclude Include="Inc\RoboCatPCH.h" />
<ClInclude Include="Inc\RoboCatShared.h" />
<ClInclude Include="Inc\UDPSocket.h" />
<ClCompile Include="Src\Main.cpp" />
<ClCompile Include="Src\MemoryBitStream.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="Src\oldMain.cpp" />
<ClCompile Include="Src\OutputWindow.cpp" />
<ClCompile Include="Src\SocketAddress.cpp" />
<ClCompile Include="Src\SocketAddressFactory.cpp" />
<ClCompile Include="Src\SocketUtil.cpp" />
<ClCompile Include="Src\StringUtils.cpp" />
<ClCompile Include="Src\TCPSocket.cpp" />
<ClInclude Include="PlayerUser.h" />
<ClInclude Include="TCPHandler.h" />
<ClInclude Include="Unit.h" />
<ClInclude Include="UnitManager.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Src\RoboCatPCH.cpp">
Expand All @@ -404,14 +408,14 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\AllegroDeps.1.12.1\build\native\AllegroDeps.targets" Condition="Exists('..\packages\AllegroDeps.1.12.1\build\native\AllegroDeps.targets')" />
<Import Project="..\packages\Allegro.5.2.7.1\build\native\Allegro.targets" Condition="Exists('..\packages\Allegro.5.2.7.1\build\native\Allegro.targets')" />
<Import Project="..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets" Condition="Exists('..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets')" />
<Import Project="..\packages\sdl2.2.0.5\build\native\sdl2.targets" Condition="Exists('..\packages\sdl2.2.0.5\build\native\sdl2.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\AllegroDeps.1.12.1\build\native\AllegroDeps.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AllegroDeps.1.12.1\build\native\AllegroDeps.targets'))" />
<Error Condition="!Exists('..\packages\Allegro.5.2.7.1\build\native\Allegro.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Allegro.5.2.7.1\build\native\Allegro.targets'))" />
<Error Condition="!Exists('..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets'))" />
<Error Condition="!Exists('..\packages\sdl2.2.0.5\build\native\sdl2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sdl2.2.0.5\build\native\sdl2.targets'))" />
</Target>
</Project>
61 changes: 61 additions & 0 deletions RoboCat/Color.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#pragma once
#include <SDL_stdinc.h>
#include <ostream>

struct Color
{
Uint8 r, g, b, a = 255;

Color::Color()
{
r = g = b = a = 255;
}

Color::Color(Uint8 x, Uint8 y, Uint8 z, Uint8 w)
{
r = x;
g = y;
b = z;
a = w;
}

void incrementColor(Uint8 amt = 1)
{
r += amt;
if (r > 255)
r = 0;

g += amt;
//g += (amt * 2);
if (g > 255)
g = 0;

b += amt;
//b += (amt + 2);
if (b > 255)
b = 0;
}

void wrapColor()
{
if (r > 255)
r = 0;

if (g > 255)
g = 0;

if (b > 255)
b = 0;
}

friend std::ostream& operator<<(std::ostream& out, const Color& col)
{
out << "[" << col.r << "," << col.g << "," << col.b << "," << col.a << "]";
return out;
}

std::string ToString()
{
return "[" + std::to_string(r) + "," + std::to_string(g) + "," + std::to_string(b) + "," + std::to_string(a) + "]";
}
};
1 change: 1 addition & 0 deletions RoboCat/Inc/OutputWindow.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once

// Encapsulates a simulated "output window," where
// new messages are written from top to bottom
Expand Down
6 changes: 0 additions & 6 deletions RoboCat/Inc/RoboCatShared.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ using std::unordered_set;
class RoboCat;
class GameObject;

#include "RoboMath.h"

#include "LinkingContext.h"
#include "ByteSwap.h"
#include "MemoryBitStream.h"

#include "StringUtils.h"
#include "SocketAddress.h"
#include "SocketAddressFactory.h"
Expand Down
2 changes: 2 additions & 0 deletions RoboCat/Inc/SocketAddress.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

class SocketAddress
{
public:
Expand Down
2 changes: 1 addition & 1 deletion RoboCat/Inc/SocketAddressFactory.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#pragma once

class SocketAddressFactory
{
Expand Down
3 changes: 3 additions & 0 deletions RoboCat/Inc/SocketUtil.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma once


enum class SocketAddressFamily
{
INET = AF_INET,
Expand Down
3 changes: 3 additions & 0 deletions RoboCat/Inc/TCPSocket.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma once


class TCPSocket
{
public:
Expand Down
1 change: 1 addition & 0 deletions RoboCat/Inc/UDPSocket.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once


class UDPSocket
Expand Down
Loading