#include "mouseapicursor.h" namespace orxonox{ RegisterClass(MouseAPICursor); MouseAPICursor::MouseAPICursor(Context* context):OrxonoxOverlay(context) { RegisterObject(MouseAPICursor); cursor = static_cast(Ogre::OverlayManager::getSingleton() .createOverlayElement("Panel", "MouseAPI_cursor_" + getUniqueNumberString())); cursor->setMaterialName(TextureGenerator::getMaterialName( cursorname, Ogre::ColourValue::White)); overlay_->add2D(this->cursor); scale(Vector2(0.03,0.03)); setVisible(true); } MouseAPICursor::~MouseAPICursor() { if(running) MouseAPI::getInstance().deactivate(); } void MouseAPICursor::XMLPort(ticpp::Element &xmlelement, XMLPort::Mode mode) { MouseAPI::getInstance().activate(); running = true; SUPER(MouseAPICursor, XMLPort, xmlelement, mode); XMLPortParam(MouseAPICursor, "cursorShape", setCursorName, getCursorName,xmlelement, mode); //XMLPortParam(MouseAPICursor, "cursorColor", setCursorColor, getCursorColor,xmlelement, mode);//TODO: ColoValue::setAsARGB() } void MouseAPICursor::tick(float dt) { if(running) { this->cursor->show(); this->show(); this->setPosition(MouseAPI::getInstance().getMousePosition()); } } }