Skip to content
Snippets Groups Projects
Commit 73c0a46d authored by KosmX's avatar KosmX
Browse files

No circular includes allowed

WTF is this language
parent 5e5161bc
Branches
No related tags found
No related merge requests found
......@@ -148,13 +148,11 @@
<ClCompile Include="LazySprite.cpp" />
<ClCompile Include="mainGame.cpp" />
<ClCompile Include="ResourceManager.cpp" />
<ClCompile Include="SimpleSprite.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="DynamicArray.hpp" />
<ClInclude Include="mainGame.h" />
<ClInclude Include="olc.h" />
<ClInclude Include="ITexture.h" />
<ClInclude Include="Entity.h" />
<ClInclude Include="interfaces.h" />
<ClInclude Include="LazySprite.h" />
......@@ -162,7 +160,6 @@
<ClInclude Include="olcPixelGameEngine.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="ResourceManager.h" />
<ClInclude Include="SimpleSprite.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
......
......@@ -24,34 +24,34 @@
<Filter Include="Header Files\gameObj\management">
<UniqueIdentifier>{886a9672-46a0-46f4-a068-e12dce07d024}</UniqueIdentifier>
</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>
<ClCompile Include="game.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Entity.cpp">
<Filter>Source Files\gameObj</Filter>
</ClCompile>
<ClCompile Include="ResourceManager.cpp">
<Filter>Source Files\gameObj</Filter>
</ClCompile>
<ClCompile Include="LazySprite.cpp">
<Filter>Source Files\gameObj</Filter>
</ClCompile>
<ClCompile Include="SimpleSprite.cpp">
<Filter>Source Files\gameObj</Filter>
</ClCompile>
<ClCompile Include="mainGame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Entity.cpp">
<Filter>Source Files\gameObj\entities</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="interfaces.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Entity.h">
<Filter>Header Files\gameObj</Filter>
</ClInclude>
<ClInclude Include="LazySprite.h">
<Filter>Header Files\gameObj\render</Filter>
</ClInclude>
......@@ -67,12 +67,6 @@
<ClInclude Include="olc.h">
<Filter>olc::PGE</Filter>
</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">
<Filter>Header Files</Filter>
</ClInclude>
......@@ -82,5 +76,8 @@
<ClInclude Include="DynamicArray.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Entity.h">
<Filter>Header Files\gameObj\entities</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
#pragma once
#include "olc.h"
#include "ITexture.h"
#include "mainGame.h"
#include "WallEntity.h"
namespace entities {
class WallEntity;
class Entity
{
protected:
olc::vf2d pos; //I can store these safely directly
virtual render::ITexture& getTexture() = 0;
virtual olc::vf2d getHitBoxSize() const = 0;
virtual olc::vf2d getCollision(const Entity& other);
......@@ -29,9 +29,26 @@ namespace entities {
virtual ~Entity() = default;
//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
#include "Entity.h"
#include "olcPGEX_TransformedView.h"
#include "Entity.h"
namespace render
{
......@@ -10,7 +11,7 @@ namespace render
public:
//Giving the entity will reduce the variables needed, and will make it's use more dynamic
virtual void render(olc::TransformedView& scene, Entity& entity) = 0;
virtual void render(olc::TransformedView& scene, entities::Entity& entity) = 0;
virtual ~ITexture() = default;
};
......
#include "SimpleSprite.h"
include "SimpleSprite.h"
render::SimpleSprite::SimpleSprite(const std::string name, olc::vi2d 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 added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment