俄罗斯方块程序详解
#include "colorConsole.h"
HANDLE initiate()
{
HANDLE hOutput;
hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
return hOutput;
}
BOOL textout(HANDLE hOutput,int x,int y,WORD wColors[],int nColors,LPTSTR lpszString)
{
DWORD cWritten;
BOOL fSuccess;
COORD coord;
coord.X = x; // start at first cell
coord.Y = y; // of first row
fSuccess = WriteConsoleOutputCharacter(
hOutput, // screen buffer handle
lpszString, // pointer to source string
lstrlen(lpszString), // length of string
coord, // first cell to write to
&cWritten); // actual number written
if (! fSuccess)
cout<<"error:WriteConsoleOutputCharacter"<<endl;
for (;fSuccess && coord.X < lstrlen(lpszString)+x; coord.X += nColors)
{
fSuccess = WriteConsoleOutputAttribute(
hOutput, // screen buffer handle
wColors, // pointer to source string
nColors, // length of string
coord, // first cell to write to
&cWritten); // actual number written
}
if (! fSuccess)
cout<<"error:WriteConsoleOutputAttribute"<<endl;
return 0;
}
(2)第二个cpp
#include <conio.h>
#include <stdlib.h>
#include<stdio.h>
#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib") //播放背景音乐的头文件
#include "colorConsole.h"
#include<time.h>
#define SQUARE_COLOR BACKGROUD_BLUE|BACKGROUD_RED| BACKGROUD_INTENSITY //背景颜色
#define SQUARE_COLOR FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY //方块的颜色
#define up 72
#define down 80
#define left 75
#define right 77
#define esc 27
#define MAPW 15 //地图的宽度
#define MAPH 25 //地图的高度
void initiate1();
int * build(); //创建方块 //初始化工作
BOOL isavailable(int a[],int x,int y,int w,int h); //判定是否能放下
void drawblocks(int a[],int w,int h,int x,int y,WORD wColors[],int nColors);
void delete_cache(); //清除键盘缓冲区
void revolve(int a[][4],int w,int h,int *x,int y); //转动方块
void pro();
void end();
void delete_blocks(int *a,int w,int h,int x,int y);
void gameover();
void deletefull_line(int m[][MAPW],int row,int w,int h); //消除一行
int dx=30,dy=5; //屏幕上的偏移量
int score=0,level=0;
int map[MAPH][MAPW];
int a1[4][4]={{1},{1,1,1}};
int a2[4][4]={{0,1},{1,1,1}};
int a3[4][4]={{1,1},{0,1,1}};
int a4[4][4]={{0,0,1},{1,1,1}};
int a5[4][4]={{0,1,1},{1,1}};
int a6[4][4]={{1,1,1,1}};
int a7[4][4]={{1,1},{
1,1}};
int a[4][4];
int main()
{
HANDLE handle;
handle=initiate();
WORD wColors[1]={FOREGROUND_BLUE| FOREGROUND_GREEN|FOREGROUND_INTENSI
你可能喜欢
- 插入图片
- c++经典代码大全
- C语言游戏源代码
- 俄罗斯方块程序设计
- 五子棋C语言源代码
- c++代码
- c++贪吃蛇
- 插入的图片9页
- word中插入图片11页
- 在画图中插入图片3页
- Word中插入图片出现的问题2页
- WORD插入图片练习3页
- PPT文档快速插入图片的方法10页
- 简单的迷宫小游戏 C语言程序源代码2页
- C语言小游戏源代码《打砖块》3页
- C语言小游戏源代码《贪吃蛇》9页
- C语言扫雷游戏源代码20页
- 最经典的C语言拼图小游戏源代码2页
- 三连棋游戏 C语言源代码 网络提供 自行修改编译通过4页
- 俄罗斯方块源程序(C语言课程设计)17页
- 俄罗斯方块程序设计与系统分析26页
- 俄罗斯方块游戏的设计_java课设_含可运行程序41页
- Java俄罗斯方块游戏的设计_java课设_含可运行程序29页
- 俄罗斯方块游戏程序设计5页
- 俄罗斯方块程序设计思想终结6页
- C语言实现五子棋小游戏源代码2页
- C语言游戏之五子棋源代码5页
- C语言程序源代码_五子棋游戏10页
- C语言五子棋游戏源代码12页
- 五子棋游戏 C语言 代码 源代码5页
- 五子棋C语言源代码11页
- c++代码编写规范6页
- c++实验及代码(全部)23页
- c++源代码1页
- c++源代码 (102)2页
- c++源代码 (101)2页
- c++源代码 (85)2页


