?? head.h
字號:
/*=================head.h=====================*/
/*=============頭文件,宏定義,函數申明========*/
#include"stdio.h"
#include"stdlib.h"
#include"math.h"
#include"conio.h"
#include"time.h"
#include"graphics.h"
#define upkey 72 /*------上方向鍵-------*/
#define downkey 80 /*------下方向鍵-------*/
#define leftkey 75 /*------左方向鍵-------*/
#define rightkey 77 /*------右方向鍵-------*/
#define Enter 13 /*------回車鍵---------*/
#define ESC 27 /*------ESC鍵----------*/
#define DisplayColor BLACK /*------演示界面背景色-*/
#define StarColor WHITE /*------星點顏色-------*/
#define GunColor RED /*------炮頭顏色-------*/
#define LockColor RED /*------鎖定顏色-------*/
#define mMax 10 /*------最大目標數-----*/
#define nMax 10 /*------最多指標數-----*/
int n=6,m=3; /*目標數初始定為六個,目標指標定為3個*/
int best=0; /*最優目標在目標數組中的下標值*/
/*------演示矩形框結構----*/
struct RECT{
int left,top,right,bottom;
int width,height,d;
}rect;
/*------炮臺結構--------*/
struct Emplacement{
int x,y;
int width,lenth;
int color;
}emp;
/*---------------------坦克目標屬性---------------------------*/
struct Target{
int ID; /*---坦克標識符,用以識別該目標的唯一編號----*/
int x,y; /*---坦克坐標----*/
int r,color; /*---坦克半徑和顏色--*/
float d; /*---距離----*/
int dIndex; /*---距離索引----*/
float T; /*---貼近度----*/
int TIndex; /*---貼近度索引----*/
int pIndex; /*---坦克排序索引---*/
int direction; /*---坦克當前運動方向---*/
float inva,distance,power;
/*----分別為坦克的三個指標:“侵略性”、“距炮臺距離”、“攻擊力”---*/
}Tank[nMax]; /*---定義坦克目標數組---*/
int color[3]={WHITE,YELLOW,RED}; /*---定義坦克的三種顏色值---*/
/*---------------------動畫演示-------------------------------*/
void InitDisplay(); /*圖形初始化*/
void Display(); /*動畫演示:找出當前最優目標并擊毀*/
void Emplacement(); /*畫炮臺*/
void DisplayBG(); /*演示背景*/
void ShowInt(int data,int x,int y); /*將整型轉化為字符型并顯示/
void DrawMissile(int x,int y,int r,int color); /*畫導彈*/
void DrawTank(struct Target T_pro,int Tcolor,int color); /*畫坦克*/
void Attack(int x1,int y1,int x2,int y2); /*攻擊效果*/
void Blast(int x,int y,int r,int color); /*爆炸效果*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -