Hi
im really begginer , how can i do simple zoom in out with the mouse ?
im reading the document and the fourm with out any example about simple zoom in / out
how to make zoom in with mouse ?
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Copy this into your event receiver:soulless wrote:In the mouse event just change the field of view of the camera.
Code: Select all
//check mouse events
if(irr::EET_MOUSE_INPUT_EVENT == event.EventType)
{
//check mouse wheel
if (irr::EMIE_MOUSE_WHEEL == event.MouseInput.Event)
{
irr::scene::ICameraSceneNode* const camera = smgr->getActiveCamera();
//zoom camera
irr::f32 newFOV = camera->getFOV();
if (event.MouseInput.Wheel < 0)
newFOV = irr::core::min_(newFOV + irr::core::DEGTORAD, irr::core::PI*0.5f);
else
newFOV = irr::core::max_(newFOV - irr::core::DEGTORAD, irr::core::PI*0.0125f);
camera->setFOV(newFOV);
return true;
}
}
"Whoops..."