当前位置: 首页>>代码示例>>C++>>正文


C++ CAudioManager::IsPlaying方法代码示例

本文整理汇总了C++中CAudioManager::IsPlaying方法的典型用法代码示例。如果您正苦于以下问题:C++ CAudioManager::IsPlaying方法的具体用法?C++ CAudioManager::IsPlaying怎么用?C++ CAudioManager::IsPlaying使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAudioManager的用法示例。


在下文中一共展示了CAudioManager::IsPlaying方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

cGameStateObject* cGameStateIntro::update(double timeDifference, Camera &cam, CGameData &data, CGraphics &con){
  m_event = EVENT_GO_NO_WHERE;
  
  //initialize data first time this state is called
  static bool bFirstTime = true;
  if(bFirstTime == true){
 
    CAudioManager *pAudio = CAudioManager::Instance();
    if(pAudio->IsPlaying(0) == false)    //nature sounds
      pAudio->PlaySoundClip(0, 1);
    if(pAudio->IsPlaying(13) == false)    //birds
      pAudio->PlaySoundClip(13, 1);

    bFirstTime = false;
  }

  //keystrokes
  if(::GetActiveWindow() == data.m_hWnd && keyDown(VK_SPACE))
    m_event = EVENT_GO_MAIN;

  for(unsigned int i=0; i< m_TE.size(); i++){
    if (m_TE[i].event == m_event){
      return m_TE[i].p_gso;
    }
  }
  return 0;
}
开发者ID:ChuckBolin,项目名称:CookieStealingOgre,代码行数:27,代码来源:cGameStateIntro.cpp

示例2: update

cGameStateObject* cGameStateFireControl::update(double timeDifference){
  m_event = EVENT_GO_NO_WHERE;

  //loads mouse position into global variable.
  POINT pt;
  POINT *ppt = &pt;
  ::GetCursorPos(ppt);
  RECT rct;
  ::GetWindowRect(g_hWnd, &rct);
  g_Global.g_mouse.x = pt.x - rct.left;
  g_Global.g_mouse.y = pt.y - rct.top;
  
  CGameData *pData = CGameData::Instance();
  pData->Update(timeDifference);
  CAudioManager *pAudio = CAudioManager::Instance();

  static double timeDiffTotal = 0;
  timeDiffTotal += timeDifference;
  if(timeDiffTotal > .1){
    timeDiffTotal = 0;

    if(keyDown(VK_SPACE) && ::GetActiveWindow() == g_hWnd){
      CTorpedo torpedo(pData->m_Player.m_heading, pData->m_Player.m_heading, pData->m_Player.m_posX, pData->m_Player.m_posY);
      pData->m_torpedos.push_back(torpedo);
      //there are 2 torpedo sounds...play 1..if busy play 2
      if(pAudio->IsPlaying(SOUND_TORPEDO1) == false)
        pAudio->PlaySoundClip(SOUND_TORPEDO1, 0);
      else{
        if(pAudio->IsPlaying(SOUND_TORPEDO2) == false)
          pAudio->PlaySoundClip(SOUND_TORPEDO2, 0);
      }
    }
  
    //process short cut buttons
    if(g_Global.g_mouse.y > 10 && g_Global.g_mouse.y < 130 
      && g_Global.g_bLeftMouseDown == true && ::GetActiveWindow() == g_hWnd){
      if(g_Global.g_mouse.x > 10 && g_Global.g_mouse.x < 110)
        m_event = EVENT_GO_SONAR;
      else if(g_Global.g_mouse.x > 120 && g_Global.g_mouse.x < 220)
        m_event = EVENT_GO_RADAR;
      else if(g_Global.g_mouse.x > 230 && g_Global.g_mouse.x < 330)
        m_event = EVENT_GO_CONTROL;
      else if(g_Global.g_mouse.x > 804 && g_Global.g_mouse.x < 904)
        m_event = EVENT_GO_STATUS;
      else if(g_Global.g_mouse.x > 914 && g_Global.g_mouse.x < 1014)
        m_event = EVENT_GO_CHART;
    }      
  }

  for(unsigned int i=0; i< m_TE.size(); i++){
    if (m_TE[i].event == m_event){
      return m_TE[i].p_gso;
    }
  }
  return 0;
}
开发者ID:ChuckBolin,项目名称:Sinking,代码行数:56,代码来源:CGameStateFireControl.cpp

示例3: Update

CGameState* CStateIntro::Update(double timeDifference){
  m_event = GO_NO_WHERE;

  if(g_audio.IsPlaying(2) == false)
    g_audio.PlaySoundClip(2, 1);


  //process this code for the very first Update(...) call
  static bool bFirstTime = false;
  if(bFirstTime == false){
    bFirstTime = true;
  }

  //check user interface
  INPUT_RECORD InRec = GetConsoleInputInfo();

  //key press events
  if(InRec.EventType == KEY_EVENT){
    m_event = GO_MENU;//press any key
  }

  //mouse events
  else if(InRec.EventType == MOUSE_EVENT){
    //left mouse 
    if(InRec.Event.MouseEvent.dwButtonState == 0x01){
    }
    //right mouse
    else if(InRec.Event.MouseEvent.dwButtonState == 0x02){
    }
    //mouse move
    else if(InRec.Event.MouseEvent.dwEventFlags == MOUSE_MOVED){
      m_mouseX = InRec.Event.MouseEvent.dwMousePosition.X;
      m_mouseY = InRec.Event.MouseEvent.dwMousePosition.Y;
    }
  }
  
  //animated border
  if(m_timerBorder.GetTimer(.05)== true){
    m_borderCount++;
    if(m_borderCount > 205)
      m_borderCount = 0;
  }

  //game state transition code...very important
  for(unsigned int i=0; i< m_TE.size(); ++i){
    if (m_TE[i].event == m_event){
      return m_TE[i].p_gso;
    }
  }

  return 0;
}
开发者ID:ChuckBolin,项目名称:DOS2DGame,代码行数:52,代码来源:CStateIntro.cpp

示例4: update

/*************************************  U P D A T E *****************************************/
cGameStateObject* CGameStatePlay::update(double timeDifference){
  m_event = EVENT_GO_NO_WHERE;
  static double timeDiffTotal = 0;
  static double thingTimeDiff = 0;
  //GRAPHIC_IMAGE gi;
  int spriteID;
  int frameMax  = 0;
  int frameCount  = 0;

  //start ambient sound loop
  CAudioManager *pAudio = CAudioManager::Instance();
  if(pAudio->IsPlaying(SOUND_ANCHORS) == false)
    pAudio->PlaySoundClip(SOUND_ANCHORS, 0);

  //loads mouse position into global variable.
  POINT pt;
  POINT *ppt = &pt;
  ::GetCursorPos(ppt);
  RECT rct;
  ::GetWindowRect(g_hWnd, &rct);
  g_Global.g_mouse.x = pt.x - rct.left;
  g_Global.g_mouse.y = pt.y - rct.top;

  //accept...go to control
  if(g_Global.g_mouse.x > 289 && g_Global.g_mouse.x < 407
    && g_Global.g_mouse.y > 683 && g_Global.g_mouse.y < 718
    && g_Global.g_bLeftMouseDown == true && ::GetActiveWindow() == g_hWnd){
    m_event = EVENT_GO_CONTROL;
  }

  //reject..return to menu  
  if(g_Global.g_mouse.x > 626 && g_Global.g_mouse.x < 743
    && g_Global.g_mouse.y > 683 && g_Global.g_mouse.y < 718
    && g_Global.g_bLeftMouseDown == true && ::GetActiveWindow() == g_hWnd){
    m_event = EVENT_GO_SELECT;
  }

  //game state transition code...very important
  for(unsigned int i=0; i< m_TE.size(); i++){
    if (m_TE[i].event == m_event){
      return m_TE[i].p_gso;
    }
  }

  return 0;
}
开发者ID:ChuckBolin,项目名称:Sinking,代码行数:47,代码来源:CGameStatePlay.cpp

示例5: update

cGameStateObject* cGameStateIntro::update(double timeDifference){
  m_event = EVENT_GO_NO_WHERE;

  
 // if(keyDown(VK_SPACE) && ::GetActiveWindow() == g_hWnd){
 //   m_event = EVENT_GO_MAIN;
 //   ::ShowCursor(true);
 // }

  //loads mouse position into global variable.
  //loads mouse position into global variable.
  POINT pt;
  POINT *ppt = &pt;
  ::GetCursorPos(ppt);
  RECT rct;
  ::GetWindowRect(g_hWnd, &rct);
  g_Global.g_mouse.x = pt.x - rct.left;
  g_Global.g_mouse.y = pt.y - rct.top;

  if(m_motionTimer.getTimer(0.005) == true){
    m_motionCount += m_motionStep;
  }

  if(g_Global.g_bLeftMouseDown == true && ::GetActiveWindow() == g_hWnd) 
      m_event = EVENT_GO_MAIN;

  //play music
  CAudioManager *pAudio = CAudioManager::Instance();
  if(pAudio->IsPlaying(SOUND_REMEMBER) == false)
    pAudio->PlaySoundClip(SOUND_REMEMBER, 0);


  for(unsigned int i=0; i< m_TE.size(); i++){
    if (m_TE[i].event == m_event){
      return m_TE[i].p_gso;
    }
  }
  return 0;
}
开发者ID:ChuckBolin,项目名称:Sinking,代码行数:39,代码来源:cGameStateIntro.cpp

示例6: update

cGameStateObject* cGameStateChart::update(double timeDifference){
  m_event = EVENT_GO_NO_WHERE;
  //loads mouse position into global variable.
  
  POINT pt;
  POINT *ppt = &pt;
  ::GetCursorPos(ppt);
  RECT rct;
  ::GetWindowRect(g_hWnd, &rct);
  g_Global.g_mouse.x = pt.x - rct.left;
  g_Global.g_mouse.y = pt.y - rct.top;
  
  CGameData *pData = CGameData::Instance();
  //start ambient sound loop
  CAudioManager *pAudio = CAudioManager::Instance();
  if(pAudio->IsPlaying(SOUND_AMBIENCE1) == false)
    pAudio->PlaySoundClip(SOUND_AMBIENCE1, 1);

  if(pData->m_bAttack == true){
    if(pAudio->IsPlaying(SOUND_PING) == false)
      pAudio->PlaySoundClip(SOUND_PING,0);
  }

  if(pData->m_bDropped == true && pAudio->IsPlaying(SOUND_DEPTH_CHARGE2) == false)
        pAudio->PlaySoundClip(SOUND_DEPTH_CHARGE2, 0);

  //update all targets, sub, torpedos, and depth charges
  pData->Update(timeDifference);

  static double timeDiffTotal = 0;
  timeDiffTotal += timeDifference;
  if(timeDiffTotal > .11){
    timeDiffTotal = 0;

    if(keyDown(VK_SPACE) == true && ::GetActiveWindow() == g_hWnd){
      CLog *pLog = CLog::Instance();
      pLog->Log("Tautog ...............");
      pLog->Log("subX", (long)pData->m_Player.m_posX);
      pLog->Log("subY", (long)pData->m_Player.m_posY);
      pLog->Log("subH", pData->m_Player.m_heading);
      pLog->Log("subS", pData->m_Player.m_speed);
      pLog->Log("..............");

      for(int i = 0; i < pData->m_targets.size(); ++i){
        pLog->Log("target", i);
        pLog->Log("targetX", (long)pData->m_targets[i].m_posX);
        pLog->Log("targetY", (long)pData->m_targets[i].m_posY);
        pLog->Log("targetH", pData->m_targets[i].m_heading);
        pLog->Log("targetS", pData->m_targets[i].m_speed);
        pLog->Log("targetTB", pData->m_targets[i].m_trueBearing);
        pLog->Log("targetRB", pData->m_targets[i].m_relativeBearing);
        pLog->Log("targetAOB",(int)pData->m_targets[i].m_AOB);
        pLog->Log("targetAOBindex", pData->m_targets[i].m_AOBindex);
        pLog->Log(".......................");
      }
    }

    //process short cut buttons
    if(g_Global.g_mouse.y > 10 && g_Global.g_mouse.y < 130 
      && g_Global.g_bLeftMouseDown == true && ::GetActiveWindow() == g_hWnd){
      //if(g_Global.g_mouse.x > 10 && g_Global.g_mouse.x < 110)
      //  m_event = EVENT_GO_SONAR;
      //else if(g_Global.g_mouse.x > 120 && g_Global.g_mouse.x < 220)
      //  m_event = EVENT_GO_RADAR;
      if(g_Global.g_mouse.x > 230 && g_Global.g_mouse.x < 330)
        m_event = EVENT_GO_CONTROL;
      //else if(g_Global.g_mouse.x > 694 && g_Global.g_mouse.x < 794)
      //  m_event = EVENT_GO_FIRECONTROL;
      //else if(g_Global.g_mouse.x > 804 && g_Global.g_mouse.x < 904)
      //  m_event = EVENT_GO_STATUS;
    } 
    else if(g_Global.g_mouse.x > 806 && g_Global.g_mouse.x < 1006 
      && g_Global.g_bLeftMouseDown == true && ::GetActiveWindow() == g_hWnd){
        if(g_Global.g_mouse.y > 134 && g_Global.g_mouse.y < 249){//zoom in
          m_chartScaleIndex++;
          if(m_chartScaleIndex > 4)
            m_chartScaleIndex = 4;
        }
        else if(g_Global.g_mouse.y > 269 && g_Global.g_mouse.y < 384){//zoom out
          m_chartScaleIndex--;
          if(m_chartScaleIndex < 0)
            m_chartScaleIndex = 0;
        }
    }
  }
  
  //this controls game states
  if(pData->m_missionOver == MISSION_OVER_WIN  )
    m_event = EVENT_GO_WIN;
  else if(pData->m_missionOver == MISSION_OVER_DEAD || pData->m_missionOver == MISSION_OVER_TIMEOVER || pData->m_missionOver == MISSION_OVER_COLLISION )
    m_event = EVENT_GO_LOSE;

  for(unsigned int i=0; i< m_TE.size(); i++){
    if (m_TE[i].event == m_event){
      return m_TE[i].p_gso;
    }
  }
  return 0;
}
开发者ID:ChuckBolin,项目名称:Sinking,代码行数:99,代码来源:cGameStateChart.cpp

示例7: Update

CGameStateObject* CGameStateHelp::Update(double timeDifference,  CGameData &data, CConfigData &cfg, CGraphics &con){
  m_event = EVENT_GO_NO_WHERE;

  CAudioManager *pAudio = CAudioManager::Instance();

  //play background music
  if(cfg.PlayMusic == true && pAudio->IsPlaying(4) == false)
    pAudio->PlaySoundClip(4, 1);

  //first time
  static bool bFirstTime = true;
  if(bFirstTime == true){
    bFirstTime = false;
    m_screenNumber = 0;
    m_arrowX = 150;
    m_arrowY = 150;
  }


  //CAudioManager *pAudio = CAudioManager::Instance();
  m_mouse.SetHandle(data.m_hWnd);


  static double screenTime = 0;
  screenTime += timeDifference;
  
  if(::GetActiveWindow() == data.m_hWnd && screenTime > 0.4 && data.m_bLeftMouseDown == true){
    
    //previous button
    if(m_mouse.MouseX() > 212 && m_mouse.MouseX() < 312 && 
      m_mouse.MouseY() > 650 && m_mouse.MouseY() < 700){
        m_screenNumber--;
        if(m_screenNumber < 0)
          m_screenNumber = 0;
    }
    //next button
    else if(m_mouse.MouseX() > 712 && m_mouse.MouseX() < 812 && 
      m_mouse.MouseY() > 650 && m_mouse.MouseY() < 700){
        m_screenNumber++;
        if(m_screenNumber > 9)
          m_screenNumber = 9;
    }
    
    screenTime = 0;
  }
  
  //animate arrow
  static double arrowTime = 0;
  arrowTime += timeDifference;
  if(arrowTime > 0.05 && m_screenNumber == 1){
    m_arrowX += 10;
    m_arrowY += 5;

    if(m_arrowX > 750){
      m_arrowX = 150;
      m_arrowY = 150;
    }    
    arrowTime = 0;
  }

  if(::GetActiveWindow() == data.m_hWnd && data.m_bLeftMouseDown == true){
    //main menu
    if(m_mouse.MouseX() > 812 && m_mouse.MouseX() < 1012 && 
      m_mouse.MouseY() > 50 && m_mouse.MouseY() < 100){
      m_event = EVENT_GO_MAIN;    
    }
  }


  for(unsigned int i=0; i< m_TE.size(); i++){
    if (m_TE[i].event == m_event){
      return m_TE[i].p_gso;
    }
  }
  return 0;
}
开发者ID:ChuckBolin,项目名称:GoldenSpike,代码行数:76,代码来源:cGameStateHelp.cpp

示例8: update

//***************************************************************
//                         U P D A T E
//***************************************************************
cGameStateObject* cGameStateEditor::update(double timeDifference, Camera &cam, CGameData &data, CGraphics &con){
  m_event = EVENT_GO_NO_WHERE;
  static bool bStop = false;
  D3DXVECTOR3 position;
  GRAPHIC_IMAGE gi;
  GAME_OBJECT go;
  std::ostringstream oss;

  CLog *pLog = CLog::Instance(); 

  //play audio file at start of game state
  CAudioManager *pAudio = CAudioManager::Instance();
  if(pAudio->IsPlaying(0) == false)    
    pAudio->PlaySoundClip(0, 1);

  //configure mouse
  m_mouse.SetHandle(data.m_hWnd);

  //set aircraft camera to 1000 feet
  static bool bFirstTime = true;
  if(bFirstTime == true){
    position.x = 0.0f; position.y = 3.0f; position.z = 0.0f;
    cam.setPosition(&position); 
    cam.roll(0.0f);

    //define position of editor control panel
    gi = con.GetSprite(42);
    m_panelX = con.GetScreenWidth() - 50 - gi.width;
    m_panelY = 50;
    gi = con.GetSprite(47);
    m_fileBarY = con.GetScreenHeight() - 50 - gi.height;
    bFirstTime = false;
    m_viewChoice = 4;
    m_editLevel = 0;
    //data.LoadGameLevel("data//level1.dat", con);
  }

  //escape state by pressing ESC key
  if(::GetActiveWindow() == data.m_hWnd && keyDown(VK_ESCAPE))
    m_event = EVENT_GO_MAIN;

  cam.getPosition(&position);
  static double timeDiff = 0;
  timeDiff = timeDifference;

  for(int i = 0; i < data.m_pObject.size(); ++i){
    data.m_pObject[i]->Update(timeDiff);
  }

  //slows down key press for PageUp and PageDown
  static double timeSprite = 0;
  timeSprite += timeDiff;

  //only process keys if this window has focus
  if(::GetActiveWindow() == data.m_hWnd){// && gTimerKey.getTimer(0.03) == true){
    cam.yaw(0.0f);

    //rotate sprite
    if(keyDown('X') == true   && timeSprite > 0.05){
      cam.yaw(-2.0f * timeDiff);
      m_angle += 0.05f;
      if(m_angle > 6.28)
        m_angle = 0.0f;
      timeSprite = 0;
    }
    if(keyDown('Z') == true   && timeSprite > 0.05){
      cam.yaw(2.0f * timeDiff);
      m_angle -= 0.05f;
      if(m_angle < 0.0f)
        m_angle = 6.28f;
      timeSprite = 0;
    }
    
    //walk
    if(keyDown('W') == true){
      cam.walk(1.0f * timeDiff);
      data.m_playerY -= 200.0f * timeDiff;
      if(data.m_playerY < data.m_world_top)
        data.m_playerY = data.m_world_top;
    }
    if(keyDown('S') == true){
      cam.walk(-1.0f * timeDiff);
      data.m_playerY += 200.0f * timeDiff;
      if(data.m_playerY > data.m_world_bottom)
        data.m_playerY = data.m_world_bottom;
    }

    //strafe
    if(keyDown('A') == true){
      cam.strafe(-1.0f * timeDiff);
      data.m_playerX -= 200.0f * timeDiff;
      if(data.m_playerX < data.m_world_left)
        data.m_playerX = data.m_world_left;
    }
    if(keyDown('D') == true){
      cam.strafe(1.0f * timeDiff);
      data.m_playerX += 200.0f * timeDiff;
//.........这里部分代码省略.........
开发者ID:ChuckBolin,项目名称:CookieStealingOgre,代码行数:101,代码来源:cGameStateEditor.cpp

示例9: AddProjectile

void CGameData::AddProjectile(float x, float y, float vx, float vy, int type, float dir){
  WEAPON_OBJECT temp;
  temp.pos.x = x;
  temp.pos.y = y;
  temp.vel.x = vx;
  temp.vel.y = vy;
  temp.weaponType = type;
  temp.alive = true;
  temp.distance = 0;
  temp.dir = dir;
  GAME_OBJECT go;
  go.pos.x = x;
  go.pos.y = y;
  go.frameCount = 0;
  go.angle = dir;
  go.alive = true;

  CAudioManager *pAudio = CAudioManager::Instance();
  if(type == WEAPON_PISTOL)// && pAudio->IsPlaying(5) == false)
    pAudio->PlaySoundClip(5, 0);
  if(type == WEAPON_SHOTGUN)// && pAudio->IsPlaying(4) == false)
    pAudio->PlaySoundClip(4, 0);
  if(type == WEAPON_MACHINEGUN && pAudio->IsPlaying(2) == false)
    pAudio->PlaySoundClip(2, 0);
  if(type == WEAPON_ROCKET)// && pAudio->IsPlaying(6) == false)
    pAudio->PlaySoundClip(6, 0);
  if(type == WEAPON_FLAMETHROWER)// && pAudio->IsPlaying(3) == false)
    pAudio->PlaySoundClip(3, 0);


  switch(type){
    case 0:  //bat      
      temp.damage = 1;
      temp.radius = 1;
      temp.range = 10;
      temp.spriteID = 87;   
      go.maxFrames = 8;
      go.updateInterval =0.2;
      go.totalTime = 0;      
      go.height = 32;
      go.width = 32;
      break;
    case 1: //pistol
      temp.damage = 1;
      temp.radius = 1;
      temp.range = 10;
      temp.spriteID = 84;      
      go.maxFrames = 12;
      go.updateInterval =0.1;
      go.totalTime = 0;      
      go.height = 32;
      go.width = 32;
      break;
    case 2: //shotgun
      temp.damage = 1;
      temp.radius = 1;
      temp.range = 10;
      temp.spriteID = 85;  
      go.maxFrames = 12;
      go.updateInterval =0.1;
      go.totalTime = 0;      
      go.height = 32;
      go.width = 32;
      break;
    case 3: //machinegun
      temp.damage = 1;
      temp.radius = 1;
      temp.range = 10;
      temp.spriteID = 86;  
      go.maxFrames = 4;
      go.updateInterval =0.1;
      go.totalTime = 0;      
      go.height = 32;
      go.width = 32;
      break;
    case 4: //rocket
      temp.damage = 1;
      temp.radius = 1;
      temp.range = 10;
      temp.spriteID = 88;  
      go.maxFrames = 12;
      go.updateInterval =0.1;
      go.totalTime = 0;      
      go.height = 32;
      go.width = 32;
      break;
    case 5: //flamethrower
      temp.damage = 1;
      temp.radius = 1;
      temp.range = 10;
      temp.spriteID = 89;      
      go.maxFrames = 16;
      go.updateInterval =0.1;
      go.totalTime = 0;    
      go.height = 124;
      go.width = 32;
      break;
  }
  CProjectile cp;
  cp.m_WO = temp;
//.........这里部分代码省略.........
开发者ID:ChuckBolin,项目名称:CookieStealingOgre,代码行数:101,代码来源:CGameData.cpp

示例10: if


//.........这里部分代码省略.........
  }
   
  //select weapon type from keyboard
  //****************************************
  if(::GetActiveWindow() == data.m_hWnd && timeKey > 0.25){
    if(keyDown('1'))
      data.m_weaponType = 1;//pistol
    else if(keyDown('2'))
      data.m_weaponType = 2;//shotgun
    else if(keyDown('3'))
      data.m_weaponType = 3;//machine gun
    else if(keyDown('4'))
      data.m_weaponType = 4;//rockets
    else if(keyDown('5'))
      data.m_weaponType = 5;//flame thrower

    //toggle inventory
    if(keyDown('I') && m_bInventory == true)
      m_bInventory = false;
    else if(keyDown('I') && m_bInventory == false)
      m_bInventory = true;

    timeKey = 0;
  }

  //fire weapon with spacebar
  if(::GetActiveWindow() == data.m_hWnd && timeFire > 0.25){

    //walk
    if((keyDown(VK_SPACE) == true || data.m_bLeftMouseDown == true) && data.m_weapons[data.m_weaponType].exists == true && data.m_weapons[data.m_weaponType].rounds > 0){
      data.AddProjectile(data.m_player.go.pos.x, data.m_player.go.pos.y, 0, 0, data.m_weaponType, data.m_player.GetPlayerDir());
      data.m_weapons[data.m_weaponType].rounds--;
/*   
      if(data.m_weaponType == WEAPON_PISTOL)// && pAudio->IsPlaying(5) == false)
        pAudio->PlaySoundClip(5, 0);
      if(data.m_weaponType == WEAPON_SHOTGUN)// && pAudio->IsPlaying(4) == false)
        pAudio->PlaySoundClip(4, 0);
      if(data.m_weaponType == WEAPON_MACHINEGUN && pAudio->IsPlaying(2) == false)
        pAudio->PlaySoundClip(2, 0);
      if(data.m_weaponType == WEAPON_ROCKET)// && pAudio->IsPlaying(6) == false)
        pAudio->PlaySoundClip(6, 0);
      if(data.m_weaponType == WEAPON_FLAMETHROWER)// && pAudio->IsPlaying(3) == false)
        pAudio->PlaySoundClip(3, 0);
*/
      //pLog->Log("Projectile added", data.m_player.go.pos.x, data.m_player.go.pos.y);
      timeFire = 0;
    }
  }
  
  //combined direction and shooting
  //*******************************************************************************************************************
  if(::GetActiveWindow() == data.m_hWnd  && timeFire > 0.25){// && gTimerKey.getTimer(0.03) == true){
    cam.yaw(0.0f);

    //walk
    if(keyDown(VK_UP) == true  && data.m_weapons[data.m_weaponType].exists == true && data.m_weapons[data.m_weaponType].rounds > 0){
      //cam.walk(0.5f * timeDiff);
      data.m_player.MoveUp(timeDiff);
      if(data.m_player.go.pos.y < data.m_world_top)
        data.m_player.go.pos.y = data.m_world_top;
      data.AddProjectile(data.m_player.go.pos.x, data.m_player.go.pos.y, 0, 0, data.m_weaponType, data.m_player.GetPlayerDir());
      data.m_weapons[data.m_weaponType].rounds--;

    }
    else if(keyDown(VK_DOWN) == true   && data.m_weapons[data.m_weaponType].exists == true && data.m_weapons[data.m_weaponType].rounds > 0){
      //cam.walk(-0.5f * timeDiff);
开发者ID:ChuckBolin,项目名称:CookieStealingOgre,代码行数:67,代码来源:cGameStatePlay2.cpp


注:本文中的CAudioManager::IsPlaying方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。