Skip to content

Instantly share code, notes, and snippets.

@veryjos
Created May 20, 2018 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veryjos/52c99c33e2f5ae842d7ebd3ed6a934de to your computer and use it in GitHub Desktop.
Save veryjos/52c99c33e2f5ae842d7ebd3ed6a934de to your computer and use it in GitHub Desktop.
#include "Component.hpp"
using namespace tdrp;
class PositionComponent : public Component {
public:
COMPONENT_ENABLE(PositionComponent)
float x;
float y;
private:
};
int main(int argc, char* argv[]) {
ComponentEntity ent;
ent.AddComponent<PositionComponent>();
{
auto positionComponent = ent.GetComponent<PositionComponent>().lock();
positionComponent->x = 3.0f;
positionComponent->y = 4.0f;
}
{
auto positionComponent = ent.GetComponent<PositionComponent>().lock();
printf("%f %f\n", positionComponent->x, positionComponent->y);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment