如何在codeblocks俄罗斯方块中添加音乐

如何在codeblocks俄罗斯方块中添加音乐,第1张

把声音文件载入到游戏程序中,然后在特定的位置播放出来。《俄罗斯方块》是一款由俄罗斯人阿列克谢·帕基特诺夫于1984年6月发明的休闲游戏。该游戏曾经被多家公司代理过。经过多轮诉讼后,该游戏的代理权最终被任天堂获得。任天堂对于俄罗斯方块来说意义重大,将它与GB搭配在一起后,获得了巨大的成功,《俄罗斯方块》的基本规则是移动、旋转和摆放游戏自动输出的各种方块,使之排列成完整的一行或多行并且消除得分。

windows下面可以使用API函数 BOOL PlaySound(

LPCSTR pszSound,

HMODULE hmod,

DWORD fdwSound

)

下面是抄的msdn的:

Parameters

pszSound

A string that specifies the sound to play. If this parameter is NULL, any

currently playing waveform sound is stopped. To stop a non-waveform sound,

specify SND_PURGE in the fdwSound parameter.

Three flags in fdwSound (SND_ALIAS, SND_FILENAME, and SND_RESOURCE)

determine whether the name is interpreted as an alias for a system event, a

filename, or a resource identifier. If none of these flags are specified,

PlaySound searches the registry or the WIN.INI file for an association

with the specified sound name. If an association is found, the sound event is

played. If no association is found in the registry, the name is interpreted as a

filename.

hmod

Handle of the executable file that contains the resource to be loaded. This

parameter must be NULL unless SND_RESOURCE is specified in fdwSound.

fdwSound

Flags for playing the sound. The following values are defined:

SND_APPLICATION

The sound is played using an application-specific association.

SND_ALIAS

The pszSound parameter is a system-event alias in the registry or the

WIN.INI file. Do not use with either SND_FILENAME or SND_RESOURCE.

SND_ALIAS_ID

The pszSound parameter is a predefined sound identifier.

SND_ASYNC

The sound is played asynchronously and PlaySound returns immediately

after beginning the sound. To terminate an asynchronously played waveform sound,

call PlaySound with pszSound set to NULL.

SND_FILENAME

The pszSound parameter is a filename.

SND_LOOP

The sound plays repeatedly until PlaySound is called again with the

pszSound parameter set to NULL. You must also specify the SND_ASYNC flag

to indicate an asynchronous sound event.

SND_MEMORY

A sound event's file is loaded in RAM. The parameter specified by

pszSound must point to an image of a sound in memory.

SND_NODEFAULT

No default sound event is used. If the sound cannot be found,

PlaySound returns silently without playing the default sound.

SND_NOSTOP

The specified sound event will yield to another sound event that is already

playing. If a sound cannot be played because the resource needed to generate

that sound is busy playing another sound, the function immediately returns FALSE

without playing the requested sound.

If this flag is not specified, PlaySound attempts to stop the

currently playing sound so that the device can be used to play the new sound.

SND_NOWAIT

If the driver is busy, return immediately without playing the sound.

SND_PURGE

Sounds are to be stopped for the calling task. If pszSound is not

NULL, all instances of the specified sound are stopped. If pszSound is

NULL, all sounds that are playing on behalf of the calling task are stopped.

You must also specify the instance handle to stop SND_RESOURCE events.

SND_RESOURCE

The pszSound parameter is a resource identifierhmod must

identify the instance that contains the resource.

SND_SYNC

Synchronous playback of a sound event. PlaySound returns after the

sound event completes.

Return Values

Returns TRUE if successful or FALSE otherwise.

Remarks

The sound specified by pszSound must fit into available physical

memory and be playable by an installed waveform-audio device driver.

PlaySound searches the following directories for sound files: the current

directorythe Windows directorythe Windows system directorydirectories

listed in the PATH environment variableand the list of directories mapped in a

network. For more information about the directory search order, see the

documentation for the OpenFile function.

If it cannot find the specified sound, PlaySound uses the default

system event sound entry instead. If the function can find neither the system

default entry nor the default sound, it makes no sound and returns FALSE.

QuickInfo

Windows NT: Requires version 3.1 or later.

Windows:

Requires Windows 95 or later.

Windows CE:

Unsupported.

Header: Declared in mmsystem.h.

Import

Library: Use winmm.lib.

Unicode: Implemented as Unicode and ANSI

versions on Windows NT.

See Also

Waveform Audio Overview, Waveform Functions

codeblock设置了背景怎么没改

一、用工具导入配置文件:

第一步:打开codeblock wiki网址:可以看到该网页中有十几个配色主题,可以预览一下。

可以看看,按照后面说的,把配置文件保存为: colour_themes.conf

第二步:下载 Colour_themes.conf 配置文件:https://download.csdn.net/download/xrinosvip/10628032

第三步:打开Code::Blocks安装目录下的cb_share_config.exe文件。

在 Soures Configuration file 选择上一步下载的Colour_Themes.conf,

在Destination Configuration file 选择C:\Users\Sandy(此处替换成你的用户名)\AppData\Roaming\CodeBlocks\default.conf

(注意:......\AppData\Roaming\CodeBlocks\default.conf,是处于隐藏状态的,按照下图的方法即可显示 )

1、运行 cb_share_config.exe文件

2、 点击打开cb_share_config.exe后, 主题全部勾选上,然后依次点3个按钮(是否备份无所谓,默认主题会保留下来的)

3、重启Codeblocks,Settings→Editor→Syntax highlighting→colour theme就成功啦

二、配置主题

1、打开codeblocks,setting(设置)->editor(编辑)->Syntax highlighting(语法高亮), 然后在右边的Colour theme(主题)里选择适合你的主题

下一步:

注:点击Background->添加自定义颜色->记住上图的 六 个数据,后面会用到!

2、设置光标

可能用新的界面风格由于颜色会看不到光标,setting(设置)->editor(编辑)->Margins and caret->caret, 然后选择适合你颜色、大小的光标

4、配置字体

在Settings->Editor->左侧General settings,修改字体为Consolas,字号选择11号,同时把下面的show line numbers选中

Consolas字体的斜体简直不要太好看~~~

下一步:勾选展示 行号

4、设置左边行号区域部分

setting(设置)->Environment->Colurs, 然后就要用到第 1 步的六个数值!

按照下图修改:

设置完后的效果:

三、codeblocks的editor以外的背景暂时不知道怎么修改,可能要源码编译

codeblocks怎么改editor以外的背景

是时候发个codeblocks配色的设置帖子,图多慎入

Reference:

美化CodeBlocks的主题和字体

CodeBlocks 配色方案设置

如何把CodeBlocks写的程序的背景改变啊

168飞艇6种不亏钱的方法-align:center">

4、配置字体

在Settings->Editor->左侧General settings,修改字体为Consolas,字号选择11号,同时把下面的show line numbers选中

Consolas字体的斜体简直不要太好看~~~

下一步:勾选展示 行号

4、设置左边行号区域部分

setting(设置)->Environment->Colurs, 然后就要用到第 1 步的六个数值!

按照下图修改:

设置完后的效果:

三、codeblocks的editor以外的背景暂时不知道怎么修改,可能要源码编译

codeblocks怎么改editor以外的背景

是时候发个codeblocks配色的设置帖子,图多慎入

Reference:

美化CodeBlocks的主题和字体

CodeBlocks 配色方案设置

如何把CodeBlocks写的程序的背景改变啊


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11913388.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存