Linux上运行扫雷,基于linux环境下扫雷应用程序.docx

本文档详细介绍了如何在Linux平台的GCC环境下,使用C语言开发一款模拟Windows系统扫雷游戏的应用程序。内容包括程序的功能、硬件及软件平台需求,以及部分源代码展示,如键盘事件定义、窗口操作函数等。
摘要由CSDN通过智能技术生成

总俶斜技誓魄

《网络操作糸统》掖告

(应用程序开发丿

目:

基于I inux平台GCC环境下扫雷应用程

序开发

名:

李磊

院:

理学院

业:

网络工程

级:

092

号:

1887090211

2012年 01月01日

基于Linux平台GCC环境下扫雷应用程序开发

1应用程序功能

通过模拟windows系统中的扫雷应用程序,在linux平台gcc环境下实现C语言

扫雷应用程序。

2硬件平台

内存2.0G,硬盘320G, CPU Pentium 4以上PC机一台

3软件平台

3. 1操作系统平台

linux cygwin 环境

3. 2应用软件平台(黑体小四号)

Visual C++ 6.0或其他C语言编译程序,linux cygwin环境,GCC编译条件

3.3应用程序

// header file

#incIude

#i ncIude

#incIude

#i ncIude

#incIude

// def ines

#define KEY_UP 0xE048

#define KEY_DOWN 0xE050

#define KEY_LEFT 0xE04B

#define KEY RIGHT 0xE04D

0x001B

0x001B

*1 *

2

3

#define

#define

#def ine

#define

KEY_ESC

KEY_1

KEY_2

KEY 3

#define GAME川AX_WIDTH

100

#define GAME_MAX_HEIGHT 100

// Strings Resource

#define STR_GAMET I TLE H程序说明:数字键1打开\

数字键2标记 数字键3打开附近盒子“

#define STR_GAMEWIN ”亲,祝贺你赢了哦,再接再厉哦!\n“

#define STR_GAMEOVER ”亲,你咋那么笨呢?挂了吧!\n“

#define STR_GAMEEND n 亲,按 ESC 键退出程序\n”

//

// Base cI ass

cI ass CConsoIeWnd {

pub lie:

stat i c

int TextOut (const char*);

static

int GotoXY(int, int);

stat i c

int CharOut(int, int, const int);

stat i c

int Text0ut(int, int, const char*);

stat i c

i nt GetKey ();

pub lie:

};

//{{// cI ass CConsoIeWnd

// // i nt CConso I eWnd: : GetKey ()

// Wa i t for standard i nput and return the KeyCode //

i nt CConso I eWnd: : GetKey ()

{

int nkey二getch(),nk二0;

i f (nkey>二 1281 | nkey二二0) nk二getch (); return nk>0?nkey*256+nk:nkey;

}

//

// i nt CConsoIeWnd::GotoXY (i nt x, i nt y)

// Move cursor to (x,y)

// On Iy ConsoIe AppI i cation

//

i nt CConsoIeWnd::GotoXY (i nt x, i nt y)

{

COORD cd;

cd. X = x;cd. Y = y;

return

SetConsoIeCursorPosition (GetStdHandIe(STD_OUTPUT_HANDLE), cd); }

//

// i nt CConsoIeWnd::TextOut(const char* pstr)

// Output a string at cur rent pos i tion

//

i nt CConsoIeWnd::TextOut (const char* pstr)

{

for(;*pstr;++pstr)putchar (*pstr);

return 0;

//

// int CConsoIeWnd::CharOut(int x, int y, const int pstr)

// Output a char at (x,y)

//

int CConso IeWnd::CharOut( int x, int y, const int pstr)

{

GotoXY (x,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值