Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapiexample.cc @ 12285

Last change on this file since 12285 was 12285, checked in by mkarpf, 6 years ago

Example Level with scaling

File size: 878 bytes
Line 
1#include "mouseapiexample.h"
2
3namespace orxonox
4{
5
6RegisterClass(MouseAPIExample);
7
8MouseAPIExample::MouseAPIExample(Context* context) : ControllableEntity(context)
9{
10    RegisterObject(MouseAPIExample);
11
12}
13
14MouseAPIExample::~MouseAPIExample()
15{
16    if(MouseAPI::isActive())
17        MouseAPI::getInstance().deactivate();
18}
19
20void MouseAPIExample::testfunction(MouseButtonCode::ByEnum mouse)
21{
22    float randomnumber = (rand()%100 + 1)/100.0;
23    this->setScale(randomnumber);
24    orxout() << "Blah\n";
25
26}
27
28void MouseAPIExample::XMLPort(Element& xmlelement, XMLPort::Mode mode)
29{
30    SUPER(MouseAPIExample, XMLPort, xmlelement, mode);
31    MouseAPI::getInstance().activate();
32    MouseAPI::getInstance().addClickableObject(this->getWorldPosition(),10,std::list<MouseButtonCode::ByEnum>{MouseButtonCode::Left},[this](MouseButtonCode::ByEnum mouse){this->testfunction(mouse);});
33}
34}
Note: See TracBrowser for help on using the repository browser.