コード例 #1
0
ファイル: actionbar.cpp プロジェクト: Faultless/Dawn
void ActionBar::clicked( int clickX, int clickY )
{
  // if the right mouse button is pressed you exit "disabled" mode and remove the cursor
  if( SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON( 3 ) )
    stopCastingAoE();

  int buttonId = getMouseOverButtonId( clickX, clickY );
  if( buttonId >= 0 )
  {
    // we clicked a button which has an action and has no floating spell on the mouse (we're launching an action from the actionbar)
    if( button[buttonId].action != NULL && !spellbook->hasFloatingSpell() && isSpellUseable( button[buttonId].action ) && !isPreparingAoESpell() )
    {
      // AoE spell with specific position
      if( button[ buttonId ].action->getEffectType() == EffectType::AreaTargetSpell && player->getTarget() == NULL && isSpellUseable( button[ buttonId ].action ) == true )
      {
        setSpellQueue( button[buttonId], false );
        cursorRadius = button[buttonId].action->getRadius();
      }
      else // "regular" spell
      {
        setSpellQueue( button[buttonId] );
      }
    }

    // check to see if we're holding a floating spell on the mouse. if we do, we want to place it in the actionbar slot...
    if( spellbook->hasFloatingSpell() )
    {
      if( isButtonUsed( &button[buttonId] ) )
        unbindAction( &button[buttonId] );

      bindAction( &button[buttonId], spellbook->getFloatingSpell()->action );
    }
  }
}
コード例 #2
0
ファイル: actionbar.cpp プロジェクト: Faultless/Dawn
void ActionBar::clear()
{
  for( size_t curButtonNr=0; curButtonNr<button.size(); ++curButtonNr )
  {
    if( isButtonUsed( &button[ curButtonNr ] ) )
      unbindAction( &button[ curButtonNr ] );
  }
}
コード例 #3
0
ファイル: actionbar.cpp プロジェクト: Faultless/Dawn
void ActionBar::dragSpell()
{
  if( spellQueue != NULL )
  {
    if ( spellQueue->action != NULL )
    {
      spellbook->setFloatingSpell( spellQueue->action );
      unbindAction( spellQueue );
      spellQueue = NULL;
    }
  }
}
コード例 #4
0
ファイル: FreeLook.cpp プロジェクト: tolstenko/mobagen
 void FreeLook::deregisterFromEngine(Engine *engine) {
   auto input = engine->getWindow()->getInput();
   input->unbindAction("look");
 }