#include "mouseapiexample.h" namespace orxonox { RegisterClass(MouseAPIExample); MouseAPIExample::MouseAPIExample(Context* context) : ControllableEntity(context) { RegisterObject(MouseAPIExample); //mouseapi = MouseAPI::getInstance(); } MouseAPIExample::~MouseAPIExample() { if(MouseAPI::isActive()) MouseAPI::getInstance().deactivate(); } void MouseAPIExample::tick(float dt) { ControllableEntity::tick(dt); } void MouseAPIExample::testfunction(MouseButtonCode::ByEnum mouse) { orxout() << "MouseAPIExample: Object Clicked\n"; } void MouseAPIExample::XMLPort(Element& xmlelement, XMLPort::Mode mode) { SUPER(MouseAPIExample, XMLPort, xmlelement, mode); MouseAPI::getInstance().activate(); MouseAPI::getInstance().addClickableObject(this->getWorldPosition(),10,std::list{MouseButtonCode::Left},[this](MouseButtonCode::ByEnum mouse){this->testfunction(mouse);}); } }