Rev | Line | |
---|
[12255] | 1 | #include "mouseapiexample.h" |
---|
| 2 | |
---|
| 3 | namespace orxonox |
---|
| 4 | { |
---|
| 5 | |
---|
| 6 | RegisterClass(MouseAPIExample); |
---|
| 7 | |
---|
[12271] | 8 | MouseAPIExample::MouseAPIExample(Context* context) : ControllableEntity(context) |
---|
[12255] | 9 | { |
---|
| 10 | RegisterObject(MouseAPIExample); |
---|
[12271] | 11 | //mouseapi = MouseAPI::getInstance(); |
---|
[12255] | 12 | |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | MouseAPIExample::~MouseAPIExample() |
---|
| 16 | { |
---|
[12271] | 17 | if(MouseAPI::isActive()) |
---|
| 18 | MouseAPI::getInstance().deactivate(); |
---|
[12255] | 19 | } |
---|
| 20 | |
---|
[12271] | 21 | void MouseAPIExample::tick(float dt) |
---|
| 22 | { |
---|
| 23 | ControllableEntity::tick(dt); |
---|
| 24 | |
---|
| 25 | } |
---|
| 26 | |
---|
[12255] | 27 | void MouseAPIExample::testfunction(MouseButtonCode::ByEnum mouse) |
---|
| 28 | { |
---|
| 29 | orxout() << "MouseAPIExample: Object Clicked\n"; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | void MouseAPIExample::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 33 | { |
---|
| 34 | SUPER(MouseAPIExample, XMLPort, xmlelement, mode); |
---|
[12271] | 35 | MouseAPI::getInstance().activate(); |
---|
| 36 | MouseAPI::getInstance().addClickableObject(this->getWorldPosition(),10,std::list<MouseButtonCode::ByEnum>{MouseButtonCode::Left},[this](MouseButtonCode::ByEnum mouse){this->testfunction(mouse);}); |
---|
| 37 | |
---|
[12255] | 38 | } |
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.