Line | |
---|
1 | #include "mouseapiexample.h" |
---|
2 | |
---|
3 | namespace orxonox |
---|
4 | { |
---|
5 | |
---|
6 | RegisterClass(MouseAPIExample); |
---|
7 | |
---|
8 | MouseAPIExample::MouseAPIExample(Context* context) : ControllableEntity(context) |
---|
9 | { |
---|
10 | RegisterObject(MouseAPIExample); |
---|
11 | //mouseapi = MouseAPI::getInstance(); |
---|
12 | |
---|
13 | } |
---|
14 | |
---|
15 | MouseAPIExample::~MouseAPIExample() |
---|
16 | { |
---|
17 | if(MouseAPI::isActive()) |
---|
18 | MouseAPI::getInstance().deactivate(); |
---|
19 | } |
---|
20 | |
---|
21 | void MouseAPIExample::tick(float dt) |
---|
22 | { |
---|
23 | ControllableEntity::tick(dt); |
---|
24 | |
---|
25 | } |
---|
26 | |
---|
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); |
---|
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 | |
---|
38 | } |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.