Skip to content
Snippets Groups Projects
Commit 3f0ec7e0 authored by KosmX's avatar KosmX :satellite_orbital:
Browse files

Revert "No circular includes allowed"

This reverts commit 73c0a46d
parent 73c0a46d
No related branches found
No related tags found
1 merge request!1Revert "No circular includes allowed"
...@@ -148,11 +148,13 @@ ...@@ -148,11 +148,13 @@
<ClCompile Include="LazySprite.cpp" /> <ClCompile Include="LazySprite.cpp" />
<ClCompile Include="mainGame.cpp" /> <ClCompile Include="mainGame.cpp" />
<ClCompile Include="ResourceManager.cpp" /> <ClCompile Include="ResourceManager.cpp" />
<ClCompile Include="SimpleSprite.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="DynamicArray.hpp" /> <ClInclude Include="DynamicArray.hpp" />
<ClInclude Include="mainGame.h" /> <ClInclude Include="mainGame.h" />
<ClInclude Include="olc.h" /> <ClInclude Include="olc.h" />
<ClInclude Include="ITexture.h" />
<ClInclude Include="Entity.h" /> <ClInclude Include="Entity.h" />
<ClInclude Include="interfaces.h" /> <ClInclude Include="interfaces.h" />
<ClInclude Include="LazySprite.h" /> <ClInclude Include="LazySprite.h" />
...@@ -160,6 +162,7 @@ ...@@ -160,6 +162,7 @@
<ClInclude Include="olcPixelGameEngine.h" /> <ClInclude Include="olcPixelGameEngine.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="ResourceManager.h" /> <ClInclude Include="ResourceManager.h" />
<ClInclude Include="SimpleSprite.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
......
...@@ -24,34 +24,34 @@ ...@@ -24,34 +24,34 @@
<Filter Include="Header Files\gameObj\management"> <Filter Include="Header Files\gameObj\management">
<UniqueIdentifier>{886a9672-46a0-46f4-a068-e12dce07d024}</UniqueIdentifier> <UniqueIdentifier>{886a9672-46a0-46f4-a068-e12dce07d024}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\gameObj\entities">
<UniqueIdentifier>{019a40f0-9aba-4843-a753-9ba31998703e}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\gameObj\entities">
<UniqueIdentifier>{bf3d32be-2a80-447b-ad99-95fd482d9b18}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="game.cpp"> <ClCompile Include="game.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Entity.cpp">
<Filter>Source Files\gameObj</Filter>
</ClCompile>
<ClCompile Include="ResourceManager.cpp"> <ClCompile Include="ResourceManager.cpp">
<Filter>Source Files\gameObj</Filter> <Filter>Source Files\gameObj</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="LazySprite.cpp"> <ClCompile Include="LazySprite.cpp">
<Filter>Source Files\gameObj</Filter> <Filter>Source Files\gameObj</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SimpleSprite.cpp">
<Filter>Source Files\gameObj</Filter>
</ClCompile>
<ClCompile Include="mainGame.cpp"> <ClCompile Include="mainGame.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Entity.cpp">
<Filter>Source Files\gameObj\entities</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="interfaces.h"> <ClInclude Include="interfaces.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Entity.h">
<Filter>Header Files\gameObj</Filter>
</ClInclude>
<ClInclude Include="LazySprite.h"> <ClInclude Include="LazySprite.h">
<Filter>Header Files\gameObj\render</Filter> <Filter>Header Files\gameObj\render</Filter>
</ClInclude> </ClInclude>
...@@ -67,6 +67,12 @@ ...@@ -67,6 +67,12 @@
<ClInclude Include="olc.h"> <ClInclude Include="olc.h">
<Filter>olc::PGE</Filter> <Filter>olc::PGE</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="ITexture.h">
<Filter>Header Files\gameObj\render</Filter>
</ClInclude>
<ClInclude Include="SimpleSprite.h">
<Filter>Header Files\gameObj\render</Filter>
</ClInclude>
<ClInclude Include="mainGame.h"> <ClInclude Include="mainGame.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
...@@ -76,8 +82,5 @@ ...@@ -76,8 +82,5 @@
<ClInclude Include="DynamicArray.hpp"> <ClInclude Include="DynamicArray.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Entity.h">
<Filter>Header Files\gameObj\entities</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
#pragma once #pragma once
#include "olc.h" #include "olc.h"
#include "ITexture.h"
#include "mainGame.h" #include "mainGame.h"
#include "WallEntity.h"
namespace entities { namespace entities {
class WallEntity;
class Entity class Entity
{ {
protected: protected:
olc::vf2d pos; //I can store these safely directly olc::vf2d pos; //I can store these safely directly
virtual render::ITexture& getTexture() = 0;
virtual olc::vf2d getHitBoxSize() const = 0; virtual olc::vf2d getHitBoxSize() const = 0;
virtual olc::vf2d getCollision(const Entity& other); virtual olc::vf2d getCollision(const Entity& other);
...@@ -29,26 +29,9 @@ namespace entities { ...@@ -29,26 +29,9 @@ namespace entities {
virtual ~Entity() = default; virtual ~Entity() = default;
//TODO getAs*** stuff, all virtual //TODO getAs*** stuff, all virtual
virtual WallEntity* getAsWall()
{
return nullptr;
}
}; };
class WallEntity :
public Entity
{
private:
public:
virtual void initWallTexture(GameClient& client);
WallEntity* getAsWall() override;
};
} }
/** /**
......
#pragma once #pragma once
#include "olcPGEX_TransformedView.h"
#include "Entity.h" #include "Entity.h"
#include "olcPGEX_TransformedView.h"
namespace render namespace render
{ {
...@@ -11,7 +10,7 @@ namespace render ...@@ -11,7 +10,7 @@ namespace render
public: public:
//Giving the entity will reduce the variables needed, and will make it's use more dynamic //Giving the entity will reduce the variables needed, and will make it's use more dynamic
virtual void render(olc::TransformedView& scene, entities::Entity& entity) = 0; virtual void render(olc::TransformedView& scene, Entity& entity) = 0;
virtual ~ITexture() = default; virtual ~ITexture() = default;
}; };
......
#include "SimpleSprite.h"
include "SimpleSprite.h"
render::SimpleSprite::SimpleSprite(const std::string name, olc::vi2d pos) render::SimpleSprite::SimpleSprite(const std::string name, olc::vi2d pos)
: sprite(name, pos) : sprite(name, pos)
......
#pragma once
#include "ITexture.h"
#include <string>
#include "LazySprite.h"
namespace render {
class SimpleSprite :
public ITexture
{
private:
LazySprite sprite;
public:
SimpleSprite(const std::string name, olc::vi2d pos);
void render(olc::TransformedView& scene, entities::Entity& entity) override;
};
}
#include "WallEntity.h"
namespace entities {
void WallEntity::initWallTexture(GameClient& client)
{
//TODO
}
WallEntity* WallEntity::getAsWall()
{
return this;
}
}
\ No newline at end of file
#pragma once
#include "Entity.h"
#include "SimpleSprite.h"
namespace entities {
}
#include "WallSprite.h"
 Entity.cpp
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,52): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,62): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,44): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,54): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(9,2): error C2504: 'Entity': base class undefined
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(17,15): error C3668: 'entities::WallEntity::getAsWall': method with override specifier 'override' did not override any base class methods
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.cpp(21,42): warning C4244: 'argument': conversion from 'int' to 'T', possible loss of data
with
[
T=float
]
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.cpp(21,20): warning C4244: 'argument': conversion from 'int' to 'T', possible loss of data
with
[
T=float
]
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.cpp(49,35): error C2660: 'render::ITexture::render': function does not take 2 arguments
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,16): message : see declaration of 'render::ITexture::render'
game.cpp
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,52): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,62): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,44): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,54): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(9,2): error C2504: 'Entity': base class undefined
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(15,32): error C2061: syntax error: identifier 'GameClient'
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(17,15): error C3668: 'entities::WallEntity::getAsWall': method with override specifier 'override' did not override any base class methods
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(25,21): error C2061: syntax error: identifier 'GameClient'
mainGame.cpp
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,52): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,62): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,44): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,54): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(9,2): error C2504: 'Entity': base class undefined
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(15,32): error C2061: syntax error: identifier 'GameClient'
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(17,15): error C3668: 'entities::WallEntity::getAsWall': method with override specifier 'override' did not override any base class methods
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(25,21): error C2061: syntax error: identifier 'GameClient'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.cpp(47,35): error C2660: 'entities::Entity::tick': function does not take 2 arguments
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(25,16): message : see declaration of 'entities::Entity::tick'
ResourceManager.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\memory(3579,1): error C2248: 'render::ResourceManager::ResourceManager': cannot access private member declared in class 'render::ResourceManager'
C:\Users\kosmx\Documents\GitHub\2d-game\ResourceManager.h(34): message : see declaration of 'render::ResourceManager::ResourceManager'
C:\Users\kosmx\Documents\GitHub\2d-game\ResourceManager.h(15): message : see declaration of 'render::ResourceManager'
C:\Users\kosmx\Documents\GitHub\2d-game\ResourceManager.cpp(40): message : see reference to function template instantiation 'std::unique_ptr<render::ResourceManager,std::default_delete<render::ResourceManager>> std::make_unique<render::ResourceManager,render::ResourceManager&,0>(render::ResourceManager &)' being compiled
SimpleSprite.cpp
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(9,2): error C2504: 'Entity': base class undefined
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(17,15): error C3668: 'entities::WallEntity::getAsWall': method with override specifier 'override' did not override any base class methods
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,11): error C2653: 'render': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,27): error C2143: syntax error: missing ';' before '&'
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,27): error C2433: 'entities::Entity::ITexture': 'virtual' not permitted on data declarations
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,27): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,45): error C2238: unexpected token(s) preceding ';'
WallEntity.cpp
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,52): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\ITexture.h(14,62): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(33,21): error C2143: syntax error: missing ';' before '*'
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(33,21): error C2433: 'entities::Entity::WallEntity': 'virtual' not permitted on data declarations
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(33,21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(34,3): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,8): error C3668: 'render::SimpleSprite::render': method with override specifier 'override' did not override any base class methods
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(17,15): error C3668: 'entities::WallEntity::getAsWall': method with override specifier 'override' did not override any base class methods
WallSprite.cpp
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(21,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,31): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,41): error C2065: 'Entity': undeclared identifier
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C2923: 'std::shared_ptr': 'Entity' is not a valid template type argument for parameter '_Ty'
C:\Users\kosmx\Documents\GitHub\2d-game\mainGame.h(27,20): error C3203: 'shared_ptr': unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(11,2): error C2504: 'ITexture': base class undefined
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,44): error C2653: 'entities': is not a class or namespace name
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,54): error C2061: syntax error: identifier 'Entity'
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(18,8): error C3668: 'render::SimpleSprite::render': method with override specifier 'override' did not override any base class methods
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(9,2): error C2504: 'Entity': base class undefined
C:\Users\kosmx\Documents\GitHub\2d-game\WallEntity.h(17,15): error C3668: 'entities::WallEntity::getAsWall': method with override specifier 'override' did not override any base class methods
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,19): error C2039: 'ITexture': is not a member of 'render'
C:\Users\kosmx\Documents\GitHub\2d-game\SimpleSprite.h(7): message : see declaration of 'render'
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,27): error C2143: syntax error: missing ';' before '&'
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,27): error C2433: 'entities::Entity::ITexture': 'virtual' not permitted on data declarations
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,27): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\kosmx\Documents\GitHub\2d-game\Entity.h(14,45): error C2238: unexpected token(s) preceding ';'
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29910:TargetPlatformVersion=10.0.19041.0:
Release|x64|C:\Users\kosmx\Documents\GitHub\2d-game\|
File suppressed by a .gitattributes entry, the file's encoding is unsupported, or the file size exceeds the limit.
File suppressed by a .gitattributes entry, the file's encoding is unsupported, or the file size exceeds the limit.
File suppressed by a .gitattributes entry, the file's encoding is unsupported, or the file size exceeds the limit.
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment