Changeset 12363 for code/branches/MouseAPI_FS19/src/modules
- Timestamp:
- May 9, 2019, 4:04:30 PM (6 years ago)
- Location:
- code/branches/MouseAPI_FS19/src/modules/MouseAPI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapi.cc
r12362 r12363 1 1 #include "mouseapi.h" 2 3 #if OGRE_VERSION >= 0x010900 4 # include <Overlay/OgreOverlayManager.h> 5 # include <Overlay/OgrePanelOverlayElement.h> 6 #else 7 # include <OgreOverlayManager.h> 8 # include <OgrePanelOverlayElement.h> 9 #endif 10 11 #include "util/StringUtils.h" 2 12 3 13 namespace orxonox{ … … 29 39 } 30 40 //GUIManager::getInstance().showGUI("MouseAPICursor", true);//Display a mouse cursor by displaying a empty menu 41 /*cursor = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 42 .createOverlayElement("Panel", "MouseAPI_cursor_" + getUniqueNumberString())); 43 cursor->setMaterialName("Orxonox/RadarMarker");//todo: better material 44 cursor->setPosition(0,0); 45 cursor->setDimensions(0.1,0.1); 46 Ogre::Overlay* overlay = Ogre::OverlayManager::getSingleton().create( "MouseAPI_cursor_" + getUniqueNumberString() ); 47 overlay->show();*/ 48 //this->overlay_->add2D(this->cursor); 31 49 } 32 50 … … 84 102 { 85 103 InputManager::getInstance().leaveState("game");//hack: todo: crate 2nd input state with prioritz 98 for cegui(cursor) 86 GUIManager::getInstance().showGUI("MouseAPICursor", false);//hack todo: only if gui not shown & evt better if not in mouse mooved104 //GUIManager::getInstance().showGUI("MouseAPICursor", false);//hack todo: only if gui not shown & evt better if not in mouse mooved 87 105 } 88 106 -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapi.h
r12362 r12363 96 96 bool active = false; 97 97 98 Ogre::PanelOverlayElement* cursor; 99 98 100 public: 99 101 -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapicursor.cc
r12348 r12363 8 8 { 9 9 RegisterObject(MouseAPICursor); 10 //TODO: copy from radar overlay 10 cursor = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 11 .createOverlayElement("Panel", "MouseAPI_cursor_" + getUniqueNumberString())); 12 cursor->setMaterialName(TextureGenerator::getMaterialName( 13 cursorname, Ogre::ColourValue::White)); 14 15 overlay_->add2D(this->cursor); 16 scale(Vector2(0.03,0.03)); 17 setVisible(true); 18 } 19 20 MouseAPICursor::~MouseAPICursor() 21 { 22 if(running) 23 MouseAPI::getInstance().deactivate(); 24 } 25 26 void MouseAPICursor::XMLPort(ticpp::Element &xmlelement, XMLPort::Mode mode) 27 { 28 MouseAPI::getInstance().activate(); 29 running = true; 30 SUPER(MouseAPICursor, XMLPort, xmlelement, mode); 31 XMLPortParam(MouseAPICursor, "cursorShape", setCursorName, getCursorName,xmlelement, mode); 32 //XMLPortParam(MouseAPICursor, "cursorColor", setCursorColor, getCursorColor,xmlelement, mode);//TODO: ColoValue::setAsARGB() 33 } 34 35 void MouseAPICursor::tick(float dt) 36 { 37 if(running) 38 { 39 this->cursor->show(); 40 this->show(); 41 this->setPosition(MouseAPI::getInstance().getMousePosition()); 42 } 11 43 } 12 44 -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapicursor.h
r12348 r12363 3 3 #include <overlays/OrxonoxOverlay.h> 4 4 #include "core/CoreIncludes.h" 5 #include "tools/interfaces/Tickable.h" 6 #include "overlays/OverlayGroup.h" 7 #include "mouseapi.h" 8 #include "core/XMLPort.h" 9 10 11 #if OGRE_VERSION >= 0x010900 12 # include <Overlay/OgreOverlayManager.h> 13 # include <Overlay/OgrePanelOverlayElement.h> 14 #else 15 # include <OgreOverlayManager.h> 16 # include <OgrePanelOverlayElement.h> 17 #endif 18 19 #include "tools/TextureGenerator.h" 20 #include "util/StringUtils.h" 5 21 6 22 namespace orxonox{ 7 23 8 class MouseAPICursor: public OrxonoxOverlay 24 class MouseAPICursor: public OrxonoxOverlay, public Tickable 9 25 { 26 private: 27 Ogre::PanelOverlayElement* cursor; 28 bool running = false; 29 std::string cursorname = "cursor.png"; 10 30 public: 11 31 MouseAPICursor(Context* context); 32 ~MouseAPICursor(); 33 virtual void tick(float dt) override; 34 virtual void XMLPort(ticpp::Element &xmlelement, XMLPort::Mode mode) override; 35 inline void setCursorName(const std::string& name) 36 { 37 cursorname = name; 38 cursor->setMaterialName(TextureGenerator::getMaterialName( 39 cursorname, Ogre::ColourValue::White)); 40 } 41 inline std::string getCursorName(void) const 42 { 43 return cursorname; 44 } 45 12 46 }; 13 47 -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mousegametype.cc
r12309 r12363 8 8 player_ =nullptr; 9 9 10 this->setHUDTemplate("MouseCursor"); 11 10 12 } 11 13 12 void MouseGametype::start() {13 14 void MouseGametype::start() 15 { 14 16 bool temp = this->bForceSpawn_; 15 17 this->bForceSpawn_ = true; … … 20 22 // Reset the variable. 21 23 this->bForceSpawn_ = temp; 24 22 25 } 23 26 … … 39 42 this->player_ = player; 40 43 this->players_[player].state_ = PlayerState::Alive; 41 42 44 } 43 45 }
Note: See TracChangeset
for help on using the changeset viewer.