Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualConny14156

Posted 28 December 2012 - 10:30 PM


Have fun!
Yeha sure >.>

I will try to remember you tips :3 and make some more rules for myself.

while am here I may aswell ask
I literately copy pasted my Entityfactory code to do something like factory handler, but instead of returning a smart pointer towards a Entity its points (well suppose to) points towards a "component" instead, than Its suppose to insert the component pointer inside the entity componentlist map, Isnt this suppose to be working or did I missunderstood horrible wrong?

std::shared_ptr<BaseComponent> pComponent;

pComponent = cFactory.ComponentInstantiate<TransformComponent>();
vEntity[0]->AddComponent(pComponent);

class FactoryComponent
{
public:
FactoryComponent(){}
virtual ~FactoryComponent(){}

template<class ComponentType>
std::shared_ptr<ComponentType> ComponentInstantiate()
{
return std::make_shared<ComponentType>();
}
};

class Entity
{
public:
Entity(){};

std::map<std::string,std::shared_ptr<BaseComponent>> ComponentList;

void AddComponent(std::shared_ptr<BaseComponent> type)
{
if(ComponentList.count(type->getTypeName()) == 0)
{
ComponentList.insert(std::make_pair(type->getTypeName(),type));
}
}

void Destroy();



};

#9Conny14156

Posted 28 December 2012 - 10:30 PM


Have fun!
Yeha sure >.>

I will try to remember you tips :3 and make some more rules for myself.

while am here I may aswell ask
I literately copy pasted my Entityfactory code to do something like factory handler, but instead of returning a smart pointer towards a Entity its points (well suppose to) points towards a "component" instead, than Its suppose to insert the component pointer inside the entity componentlist map, Isnt this suppose to be working or did I missunderstood horrible wrong?

std::shared_ptr<BaseComponent> pComponent;

pComponent = cFactory.ComponentInstantiate<TransformComponent>();
vEntity[0]->AddComponent(pComponent);

class FactoryComponent
{
public:
FactoryComponent(){}
virtual ~FactoryComponent(){}

template<class ComponentType>
std::shared_ptr<ComponentType> ComponentInstantiate()
{
return std::make_shared<ComponentType>();
}
};

class Entity
{
public:
Entity(){};

std::map<std::string,std::shared_ptr<BaseComponent>> ComponentList;

void AddComponent(std::shared_ptr<BaseComponent> type)
{
if(ComponentList.count(type->getTypeName()) == 0)
{
ComponentList.insert(std::make_pair(type->getTypeName(),type));
}
}

void Destroy();



};

#8Conny14156

Posted 28 December 2012 - 10:30 PM


Have fun!
Yeha sure >.>

I will try to remember you tips :3 and make some more rules for myself.

while am here I may aswell ask
I literately copy pasted my Entityfactory code to do something like factory handler, but instead of returning a smart pointer towards a Entity its points (well suppose to) points towards a "component" instead, than Its suppose to insert the component pointer inside the entity componentlist map, Isnt this suppose to be working or did I missunderstood horrible wrong?

std::shared_ptr<BaseComponent> pComponent;

pComponent = cFactory.ComponentInstantiate<TransformComponent>();
vEntity[0]->AddComponent(pComponent);

class FactoryComponent
{
public:
FactoryComponent(){}
virtual ~FactoryComponent(){}

template<class ComponentType>
std::shared_ptr<ComponentType> ComponentInstantiate()
{
return std::make_shared<ComponentType>();
}
};

class Entity
{
public:
Entity(){};

std::map<std::string,std::shared_ptr<BaseComponent>> ComponentList;

void AddComponent(std::shared_ptr<BaseComponent> type)
{
if(ComponentList.count(type->getTypeName()) == 0)
{
ComponentList.insert(std::make_pair(type->getTypeName(),type));
}
}

void Destroy();



};

#7Conny14156

Posted 28 December 2012 - 10:30 PM


Have fun!
Yeha sure >.>

I will try to remember you tips :3 and make some more rules for myself.

while am here I may aswell ask
I literately copy pasted my Entityfactory code to do something like factory handler, but instead of returning a smart pointer towards a Entity its points (well suppose to) points towards a "component" instead, than Its suppose to insert the component pointer inside the entity componentlist map, Isnt this suppose to be working or did I missunderstood horrible wrong?

std::shared_ptr<BaseComponent> pComponent;

pComponent = cFactory.ComponentInstantiate<TransformComponent>();
vEntity[0]->AddComponent(pComponent);

class FactoryComponent
{
public:
FactoryComponent(){}
virtual ~FactoryComponent(){}

template<class ComponentType>
std::shared_ptr<ComponentType> ComponentInstantiate()
{
return std::make_shared<ComponentType>();
}
};

class Entity
{
public:
Entity(){};

std::map<std::string,std::shared_ptr<BaseComponent>> ComponentList;

void AddComponent(std::shared_ptr<BaseComponent> type)
{
if(ComponentList.count(type->getTypeName()) == 0)
{
ComponentList.insert(std::make_pair(type->getTypeName(),type));
}
}

void Destroy();



};

#6Conny14156

Posted 28 December 2012 - 10:30 PM


Have fun!
Yeha sure >.>

I will try to remember you tips :3 and make some more rules for myself.

while am here I may aswell ask
I literately copy pasted my Entityfactory code to do something like factory handler, but instead of returning a smart pointer towards a Entity its points (well suppose to) points towards a "component" instead, than Its suppose to insert the component pointer inside the entity componentlist map, Isnt this suppose to be working or did I missunderstood horrible wrong?

std::shared_ptr<BaseComponent> pComponent;

pComponent = cFactory.ComponentInstantiate<TransformComponent>();
vEntity[0]->AddComponent(pComponent);

class FactoryComponent
{
public:
FactoryComponent(){}
virtual ~FactoryComponent(){}

template<class ComponentType>
std::shared_ptr<ComponentType> ComponentInstantiate()
{
return std::make_shared<ComponentType>();
}
};

class Entity
{
public:
Entity(){};

std::map<std::string,std::shared_ptr<BaseComponent>> ComponentList;

void AddComponent(std::shared_ptr<BaseComponent> type)
{
if(ComponentList.count(type->getTypeName()) == 0)
{
ComponentList.insert(std::make_pair(type->getTypeName(),type));
}
}

void Destroy();



};

#5Conny14156

Posted 28 December 2012 - 10:30 PM


Have fun!
Yeha sure >.>

I will try to remember you tips :3 and make some more rules for myself.

while am here I may aswell ask
I literately copy pasted my Entityfactory code to do something like factory handler, but instead of returning a smart pointer towards a Entity its points (well suppose to) points towards a "component" instead, than Its suppose to insert the component pointer inside the entity componentlist map, Isnt this suppose to be working or did I missunderstood horrible wrong?

std::shared_ptr<BaseComponent> pComponent;

pComponent = cFactory.ComponentInstantiate<TransformComponent>();
vEntity[0]->AddComponent(pComponent);

class FactoryComponent
{
public:
FactoryComponent(){}
virtual ~FactoryComponent(){}

template<class ComponentType>
std::shared_ptr<ComponentType> ComponentInstantiate()
{
return std::make_shared<ComponentType>();
}
};

class Entity
{
public:
Entity(){};

std::map<std::string,std::shared_ptr<BaseComponent>> ComponentList;

void AddComponent(std::shared_ptr<BaseComponent> type)
{
if(ComponentList.count(type->getTypeName()) == 0)
{
ComponentList.insert(std::make_pair(type->getTypeName(),type));
}
}

void Destroy();



};

PARTNERS