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

📄 ring.h

📁 俄罗斯方块。很好玩得小游戏
💻 H
字号:
/*
=============Ring  Music  Head File
=============CopyRight (C) LiGungcun
=============QQ:66855618
=============E-Mail: hoya-lee@sohu.com
*/
#ifndef _RING
#define _RING
/*===========head file include============*/
#if     !defined(__DOS_DEF_)
#include <dos.h>
#endif
#include "c:\code\timer.h"
/*===========macro defined================*/
/*===========globe variable===============*/
static int g_ring[4][8]=
{0,131,147,165,175,196,220,247,
0,262,294,330,349,392,440,493,
0,532,587,659,698,784,880,988,
0,1047,1175,1382,1397,1568,1760,1976};
/*===========data structure===============*/
/*===========function declare=============*/
void play_string(const char *play_string);
/*===========function implement===========*/
void play_ring(char *s,int d){
	int n1,n2;
	if(*s==97) n1=0;
	if(*s==98) n1=1;
	if(*s==99) n1=2;
	if(*s==100) n1=3;
	n2=*(s+1)-48;
	sound(g_ring[n1][n2]);
	delay_ms(d*100);
	nosound();
}
void play_string(const char *play_string){
/*ex: "a13";  "a1" is g_ring[0][0],3 is delay(3*100) */
/*  "a(b,c,d) 1(1--7) 1(1--10)"  */
	char *t=(char *)play_string;
	int delay;
	while(*t!='\0'){
		if(*t==' ') t++;
		delay=*(t+2)-48;
		play_ring(t,delay);
		t+=3;
	}
}
/*===========END==========================*/
#endif

⌨️ 快捷键说明

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