- Timestamp:
- May 2, 2019, 1:47:32 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapiexample.cc
r12311 r12330 42 42 } 43 43 44 // 44 // scale the z-component up / down with left-mouse / right-mouse (max. factor 2, min. factor 1) 45 45 void MouseAPIExample::clickleft(MouseButtonCode::ByEnum mouse) 46 46 { 47 //MouseAPI::getInstance().changeRadiusOfClickableObject(cubeid,10); 48 orxout() << "left" << "\n"; 47 // action after left-click 48 if (mouse == MouseButtonCode::Left) 49 { 50 Vector3 scale = this->getScale3D(); 51 if (scale.z <= 2) this->setScale3D(scale.x,scale.y,scale.z+0.1); 52 } 53 // action after right-click 54 else if (mouse == MouseButtonCode::Right) 55 { 56 Vector3 scale = this->getScale3D(); 57 if (scale.z > 1) this->setScale3D(scale.x,scale.y,scale.z-0.1); 58 } 49 59 } 50 60 51 // 61 // scale the y-component up / down with left-mouse / right-mouse (max. factor 2, min. factor 1) 52 62 void MouseAPIExample::clickright(MouseButtonCode::ByEnum mouse) 53 63 { 54 //MouseAPI::getInstance().changeRadiusOfClickableObject(cubeid,10); 55 orxout() << "right" << "\n"; 64 // action after left-click 65 if (mouse == MouseButtonCode::Left) 66 { 67 Vector3 scale = this->getScale3D(); 68 if (scale.y <= 2) this->setScale3D(scale.x,scale.y+0.1,scale.z); 69 } 70 // action after right-click 71 else if (mouse == MouseButtonCode::Right) 72 { 73 Vector3 scale = this->getScale3D(); 74 if (scale.y > 1) this->setScale3D(scale.x,scale.y-0.1,scale.z); 75 } 56 76 } 57 77 … … 75 95 else if(this->getId() == 3) // id == 3; long block 76 96 { 77 // add the left and right outermostpart of the long block to the list with clickable Objects and define clickleft/clickright to be called78 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);});97 // add the left and right part of the long block to the list with clickable Objects and define clickleft/clickright to be called 98 leftid = MouseAPI::getInstance().addClickableObject(Vector3(0,70,-70),20,std::list<MouseButtonCode::ByEnum>{MouseButtonCode::Left,MouseButtonCode::Right},[this](MouseButtonCode::ByEnum mouse){this->clickleft(mouse);}); 99 rightid = MouseAPI::getInstance().addClickableObject(Vector3(0,70,70),20,std::list<MouseButtonCode::ByEnum>{MouseButtonCode::Left,MouseButtonCode::Right},[this](MouseButtonCode::ByEnum mouse){this->clickright(mouse);}); 80 100 } 81 101
Note: See TracChangeset
for help on using the changeset viewer.