⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bombermidi.c

📁 一个炸弹人游戏的源代码(win32 application)
💻 C
字号:
MCIDEVICEID gDeviceID = -1;
int         Playing = 0;

void PlayMidi (char *FileName)
{
  char              PathName [2048];
  MCI_OPEN_PARMS    OpenStructure;
  MCI_PLAY_PARMS    PlayStructure;

  if (gDeviceID != -1) {
    mciSendCommand (gDeviceID, MCI_STOP, 0, 0);
    mciSendCommand (gDeviceID, MCI_CLOSE, 0, 0);
    gDeviceID = -1;
  }

  //Append full path to filename
  strcpy (PathName, StartDir);
  strcat (PathName, FileName);

  OpenStructure.lpstrDeviceType = "sequencer";
  OpenStructure.lpstrElementName = PathName;
  mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)&OpenStructure);
  gDeviceID = OpenStructure.wDeviceID;

  Playing = -1;

  PlayStructure.dwCallback = (DWORD)WindowHandle;
  mciSendCommand (gDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)&PlayStructure);
}

void StopMidi ()
{
  if (gDeviceID != -1) {
    mciSendCommand (gDeviceID, MCI_STOP, 0, 0);
    mciSendCommand (gDeviceID, MCI_CLOSE, 0, 0);
    gDeviceID = -1;
    Playing = 0;
  }
}

void UnloadMidi ()
{
  if (gDeviceID != -1) {
    mciSendCommand (gDeviceID, MCI_STOP, 0, 0);
    mciSendCommand (gDeviceID, MCI_CLOSE, 0, 0);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -