Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12279 for code/branches


Ignore:
Timestamp:
Apr 4, 2019, 4:21:48 PM (6 years ago)
Author:
tkuonen
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapi.cc

    r12275 r12279  
    1212void MouseAPI::activate()
    1313{
    14     active = true;
    15      if(InputManager::exists())
    16      {
    17         //cam = CameraManager::getInstance().getActiveCamera()->getOgreCamera();
    18         state = InputManager::getInstance().createInputState("MouseAPI",true,true,99);
    19         state->setMouseExclusive(false);//does this work
    20         state->setMouseHandler(this);
    21         InputManager::getInstance().enterState("MouseAPI");
     14    if(!active)
     15    {
     16        active = true;
     17        if(InputManager::exists())
     18        {
     19            //cam = CameraManager::getInstance().getActiveCamera()->getOgreCamera();
     20            state = InputManager::getInstance().createInputState("MouseAPI",true,true,99);
     21            state->setMouseExclusive(false);//does this work
     22            state->setMouseHandler(this);
     23            InputManager::getInstance().enterState("MouseAPI");
     24        }
    2225    }
    2326
     
    2629void MouseAPI::deactivate()
    2730{
    28     active = false;
    29     if(InputManager::exists())
     31    if(active)
    3032    {
    31         InputManager::getInstance().leaveState("MouseAPI");
    32         state->setMouseHandler(nullptr);
    33         InputManager::getInstance().destroyState("MouseAPI");
     33        active = false;
     34        if(InputManager::exists())
     35        {
     36            InputManager::getInstance().leaveState("MouseAPI");
     37            state->setMouseHandler(nullptr);
     38            InputManager::getInstance().destroyState("MouseAPI");
     39        }
     40        clickEvents.clear();
     41        scrollEvents.clear();
    3442    }
    35     clickEvents.clear();
    36     scrollEvents.clear();
    3743}
    3844
Note: See TracChangeset for help on using the changeset viewer.