java五子棋音乐_五子棋加背景音乐

学了一段时间的VC了,虽然自己的五子棋还没有做完,但是把我遇到的问题记下来,以后再遇到可以来博客里翻一翻自己的记录。

五子棋加背景音乐用的是CDirectSound类:

//DirectSound.h

/

// Copyright (C) 1998 by J鰎g K鰊ig

// All rights reserved

//

// This file is part of the completely free tetris clone

"CGTetris".

//

// This is free software.

// You may redistribute it by any means providing it is not sold

for profit

// without the authors written consent.

//

// No warrantee of any kind, expressed or implied, is included with

this

// software; use at your own risk, responsibility for damages (if

any) to

// anyone resulting from the use of this software rests entirely

with the

// user.

//

// Send bug reports, bug fixes, enhancements, requests, flames,

etc., and

// I'll try to keep a version up to date. I can

be reached as follows:

// [email protected] (company site)

// [email protected] (private site)

/

// DirectSound.h: interface for the CDirectSound class.

//

//

#if

!defined(AFX_DIRECTSOUND_H__A20FE86F_118F_11D2_9AB3_0060B0CDC13E__INCLUDED_)

#define

AFX_DIRECTSOUND_H__A20FE86F_118F_11D2_9AB3_0060B0CDC13E__INCLUDED_

#if _MSC_VER >= 1000

#pragma once

#endif // _MSC_VER >= 1000

#include

#include

#pragma message("linking with Microsoft's DirectSound library

...")

#pragma comment(lib, "dsound.lib")

class CDirectSound {

public: //

construction/destruction

CDirectSound();

virtual ~CDirectSound();

//If the "pWnd" paramter is NULL, then

AfxGetApp()->GetMainWnd() will be used.

BOOL Create(LPCTSTR pszResource,

CWnd * pWnd = 0);

BOOL Create(UINT uResourceID,

CWnd * pWnd = 0) {

return

Create(MAKEINTRESOURCE(uResourceID), pWnd);

}

// Alternativly you can specify the sound by

yourself

// Note that the class does not copy the entire

data ! Instead

// a pointer to the given data will be stored

!

// You can load an entire WAV file into memory

and then call this

// Create() method.

BOOL Create(LPVOID pSoundData,

CWnd * pWnd = 0);

public: // operations

BOOL IsValid()

const;

void Play(DWORD

dwStartPosition = 0, BOOL bLoop = FALSE);

void Stop();

void Pause();

void Continue();

CDirectSound

& EnableSound(BOOL bEnable = TRUE)

{

m_bEnabled

= bEnable;

if(

! bEnable )

Stop();

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值