Created
May 20, 2018 02:08
-
-
Save veryjos/52c99c33e2f5ae842d7ebd3ed6a934de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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