- Timestamp:
- Apr 18, 2019, 4:05:35 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapiexample.cc
r12306 r12311 35 35 // set factor to 120% or 80% of the current size, depending on increase or decrease 36 36 float factor = curRadius/10*(1+rel/600.0); 37 // return if factor is outside of range [0.5,5] (limit size) 38 if(factor > 5 || factor < 0.5) return; 37 39 //scale the sphere with this factor and change the radius 38 40 this->setScale(factor); 39 41 MouseAPI::getInstance().changeRadiusOfScrollableElement(sphereid,factor*10); 42 } 43 44 // 45 void MouseAPIExample::clickleft(MouseButtonCode::ByEnum mouse) 46 { 47 //MouseAPI::getInstance().changeRadiusOfClickableObject(cubeid,10); 48 orxout() << "left" << "\n"; 49 } 50 51 // 52 void MouseAPIExample::clickright(MouseButtonCode::ByEnum mouse) 53 { 54 //MouseAPI::getInstance().changeRadiusOfClickableObject(cubeid,10); 55 orxout() << "right" << "\n"; 40 56 } 41 57 … … 57 73 sphereid = MouseAPI::getInstance().addScrollElement(this->getWorldPosition(), 10, [this](int abs, int rel, const IntVector2& mousePos){this->changesizeonscroll(abs,rel,mousePos);}); 58 74 } 75 else if(this->getId() == 3) // id == 3; long block 76 { 77 // add the left and right outermost part of the long block to the list with clickable Objects and define clickleft/clickright to be called 78 leftid = MouseAPI::getInstance().addClickableObject(this->getWorldPosition(),10,std::list<MouseButtonCode::ByEnum>{MouseButtonCode::Left,MouseButtonCode::Right},[this](MouseButtonCode::ByEnum mouse){this->clickleft(mouse);}); 79 rightid = MouseAPI::getInstance().addClickableObject(this->getWorldPosition(),10,std::list<MouseButtonCode::ByEnum>{MouseButtonCode::Left,MouseButtonCode::Right},[this](MouseButtonCode::ByEnum mouse){this->clickright(mouse);}); 80 } 59 81 60 82 // activate MouseAPI
Note: See TracChangeset
for help on using the changeset viewer.