Skip to content

Commit

Permalink
Merge pull request #4 from ShortStomp/master
Browse files Browse the repository at this point in the history
Updated code.
  • Loading branch information
GoodKhaos committed May 17, 2013
2 parents 35fb8cc + fad9081 commit 9e8bfa2
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 152 deletions.
10 changes: 10 additions & 0 deletions props/(compiler)-boost-headers.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>C:\boost;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
</Project>
15 changes: 15 additions & 0 deletions props/(linker)-boost-log-binay.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LibraryPath>C:\boost\stage64\lib\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>libboost_log_setup-vc110-mt-gd-1_53.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\boost\stage64\lib\</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
14 changes: 14 additions & 0 deletions props/(linker)-sfml-binaries(release).props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LibraryPath>C:\sfml-2.0\lib\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>sfml-audio.lib;sfml-graphics.lib;sfml-main.lib;sfml-network.lib;sfml-system.lib;sfml-window.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
2 changes: 2 additions & 0 deletions src/Tetris/Tetris.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<Import Project="..\..\props\(compiler)-output-directory.props" />
<Import Project="..\..\props\(compiler)-sfml-headers.props" />
<Import Project="..\..\props\(linker)-sfml-binaries(debug).props" />
<Import Project="..\..\props\(linker)-boost-log-binay.props" />
<Import Project="..\..\props\(linker)-ec-binaries.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
Expand All @@ -65,6 +66,7 @@
<Import Project="..\..\props\(compiler)-sfml-headers.props" />
<Import Project="..\..\props\(linker)-sfml-binaries(debug).props" />
<Import Project="..\..\props\(linker)-ec-binaries.props" />
<Import Project="..\..\props\(linker)-boost-log-binay.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
Expand Down
29 changes: 10 additions & 19 deletions src/Tetris/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ add_test_L_block_to_engine(ec::engine &engine, ec::entity *parent_entity_ptr, co

const entity_factory ef;
const auto e0 = ef.get();
e0->Parent = parent_entity_ptr;

const component_factory<sprite_component> sprite_cfactory;

auto spritecomponent_ptr = sprite_cfactory.get();


const auto load_result = spritecomponent_ptr->Texture.loadFromFile("../../assets/tetris-block.png");
if(load_result == false) {
// file failed to load
Expand All @@ -70,19 +69,10 @@ add_test_L_block_to_engine(ec::engine &engine, ec::entity *parent_entity_ptr, co
spritecomponent_ptr->Sprite.setTexture(spritecomponent_ptr->Texture);
e0->add_component(spritecomponent_ptr);

// the two entities are sharing the transform component
//const auto shared_transform_component_ptr = entity_helpers::get_transform_component(parent_entity_ptr);
const component_factory<transform_component> transform_cfactory;
const auto shared_transform_component_ptr = transform_cfactory.get();
shared_transform_component_ptr->move(offset);
e0->add_component(shared_transform_component_ptr);

const component_factory<parent_component> parent_cfactory;
const auto parent_component_ptr = parent_cfactory.get();

parent_component_ptr->Offset = offset;
parent_component_ptr->parent_entity_ptr = parent_entity_ptr;
e0->add_component(parent_component_ptr);
const auto transform_component_ptr = transform_cfactory.get();
transform_component_ptr->move(offset);
e0->add_component(transform_component_ptr);

engine.Entities.emplace_back(e0);
}
Expand Down Expand Up @@ -151,11 +141,12 @@ tet::game::game_loop(
setup_window(engine);
setup_test_code(engine);

add_test_L_block_to_engine(engine, engine.Entities.front(), sf::Vector2f(-15.0f, -15.0f));
add_test_L_block_to_engine(engine, engine.Entities.front(), sf::Vector2f(-15.0f, 0.0f));
add_test_L_block_to_engine(engine, engine.Entities.front(), sf::Vector2f(-15.0f, 15.0f));
add_test_L_block_to_engine(engine, engine.Entities.front(), sf::Vector2f(0.0f, 15.0f));
add_test_L_block_to_engine(engine, engine.Entities.front(), sf::Vector2f(15.0f, 15.0f));
const auto parent_entity = engine.Entities.front();
add_test_L_block_to_engine(engine, parent_entity, sf::Vector2f(-15.0f, -15.0f));
add_test_L_block_to_engine(engine, parent_entity, sf::Vector2f(-15.0f, 0.0f));
add_test_L_block_to_engine(engine, parent_entity, sf::Vector2f(-15.0f, 15.0f));
add_test_L_block_to_engine(engine, parent_entity, sf::Vector2f(0.0f, 15.0f));
add_test_L_block_to_engine(engine, parent_entity, sf::Vector2f(15.0f, 15.0f));

add_border_to_engine(engine);

Expand Down
1 change: 0 additions & 1 deletion src/entity-component/component/component_factory.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "sprite_component.hpp"
#include "movement_component.hpp"
#include "gravity_component.hpp"
#include "parent_component.hpp"

//===----------------------------------------------------------------------===//
//
Expand Down
40 changes: 0 additions & 40 deletions src/entity-component/component/parent_component.hpp

This file was deleted.

39 changes: 0 additions & 39 deletions src/entity-component/component/scenegraph_component.hpp

This file was deleted.

13 changes: 10 additions & 3 deletions src/entity-component/entity-component.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
Expand All @@ -59,11 +59,19 @@
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="..\..\props\(linker)-sfml-binaries(debug).props" />
<Import Project="..\..\props\(linker)-boost-log-binay.props" />
<Import Project="..\..\props\(compiler)-sfml-headers.props" />
<Import Project="..\..\props\(compiler)-output-directory.props" />
<Import Project="..\..\props\(compiler)-boost-headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="..\..\props\(linker)-sfml-binaries(release).props" />
<Import Project="..\..\props\(linker)-boost-log-binay.props" />
<Import Project="..\..\props\(compiler)-sfml-headers.props" />
<Import Project="..\..\props\(compiler)-output-directory.props" />
<Import Project="..\..\props\(compiler)-boost-headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand Down Expand Up @@ -136,7 +144,6 @@
<ClInclude Include="component\icomponent.hpp" />
<ClInclude Include="component\input_component.hpp" />
<ClInclude Include="component\movement_component.hpp" />
<ClInclude Include="component\parent_component.hpp" />
<ClInclude Include="component\sprite_component.hpp" />
<ClInclude Include="component\transform_component.hpp" />
<ClInclude Include="engine.hpp" />
Expand Down
3 changes: 0 additions & 3 deletions src/entity-component/entity-component.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@
<ClInclude Include="component\transform_component.hpp">
<Filter>component</Filter>
</ClInclude>
<ClInclude Include="component\parent_component.hpp">
<Filter>component</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="component">
Expand Down
1 change: 1 addition & 0 deletions src/entity-component/entity/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//===----------------------------------------------------------------------===//
ec::entity::entity(const ec::entity_id id)
: _id(id),
Parent(nullptr),
_components(COMPONENT_TYPE_MAX, nullptr)
{
}
Expand Down
3 changes: 2 additions & 1 deletion src/entity-component/entity/entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ namespace ec
public:

// members
entity *Parent;
std::queue<message> Message_Queue;

// methods
void add_component(icomponent *const component_ptr);
void remove_component(const int component_type); // TODO: determine how this should work.
void remove_component(const int component_type);
};
}
#endif // _ENTITY_HPP_ definition
2 changes: 0 additions & 2 deletions src/entity-component/entity/entity_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace ec
struct movement_component;
struct sprite_component;
struct transform_component;
struct parent_component;

namespace entity_helpers
{
Expand All @@ -31,7 +30,6 @@ namespace entity_helpers
input_component* get_input_component(entity *const entity_ptr);
movement_component* get_movement_component(entity *const entity_ptr);
sprite_component* get_sprite_component(entity *const entity_ptr);
parent_component* get_parent_component(entity *const entity_ptr);

// templated function declarations
template<typename T>
Expand Down
13 changes: 0 additions & 13 deletions src/entity-component/entity/entity_helpers.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "../component/input_component.hpp"
#include "../component/movement_component.hpp"
#include "../component/sprite_component.hpp"
#include "../component/parent_component.hpp"


//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -72,16 +71,4 @@ inline ec::sprite_component*
ec::entity_helpers::get_sprite_component(entity *const entity_ptr)
{
return get_component<sprite_component>(entity_ptr);
}


//===----------------------------------------------------------------------===//
//
// Wrapper for getting the parent_component from an entity.
//
//===----------------------------------------------------------------------===//
inline ec::parent_component*
ec::entity_helpers::get_parent_component(entity *const entity_ptr)
{
return get_component<parent_component>(entity_ptr);
}
Loading

0 comments on commit 9e8bfa2

Please sign in to comment.