当前位置: 代码迷 >> C语言 >> 发错拉 不用看啦
  详细解决方案

发错拉 不用看啦

热度:191   发布时间:2008-03-23 02:32:46.0
发错拉 不用看啦
#include <stdio.h>
#include <bios.h>
#include <dos.h>
#include <graphics.h>
#include <string.h>
#include <stdlib.h>
#define BoardWidth   12
#define BoardHeight  23
#define _INNER_HELPER
typedef struct tagBlock
{
   char c[4][4];
   int  x;
   int  y;
   char color;
   char size;
   char name;
}Block;
int CellSize=18;
int BoardLeft=30;
int BoardTop=30;
int NBBoardLeft=300;
int NBBoardTop=30;
int NBCellSize=10;
int ScoreBoardLeft=300;
int ScoreBoardTop=100;
int ScoreBoardWidth=200;
int ScoreBoardHeight=35;
int ScoreColor=LIGHTCYAN;
int ToaalScore=100;
int InfoLeft=300;
int InfoTop=200;
int InfoColor=YELLOW;
int BkGndColor=BLACK;
int BorderColor=DARKGRAY;
int TotalScore=100;
char info_help[255];
char info_common[255];
char info_score[20];
unsigned char Board[BoardWidth][BoardHeight][2];
Block nextBlock;
void InitGame();
void DisplayScore();
void DisplayInfo(char *text)
void DisplayInfo(char *text)
{
   setcolor(BkGndColor);
   outtextxy(InfoLeft,InfoTop,info_common);
   strcpy(info_common,text);
   setcolor(InfoColor);
   outtextxy(InfoLeft,InfoTop,info_common);
}
void InitGame()
{
  int i,j,gdriver=DETECT,gmode;
  struct time sysTime;
  memset(Board,0,BoardWidth*BoardHeight*2);
  memset(nextBlock.c,0,16);
  strcpy(info_help,"P:Pause Game.  --by hoodlum1980");
  initgraph(&gdriver,&gmode,"d:\\tc\\");
  setcolor(BorderColor);
  for(i=0;i<=BoardWidth;i++)
  {
    line(BoardLeft+i*CellSize,BoardTop,BoardLeft+i*CellSize,BoardTop+BoardHeight*CellSize);
  }
  for(i=0;i<=BoardHeight;i++)
  {
    line(BoardLeft,BoardTop+i*CellSize,BoardLeft+BoardWidth*CellSize,BoardTop+i*CellSize);
  }
  rectangle(BoardLeft-CellSize/4,BoardTop-CellSize/4,BoardLeft+BoardWidth*CellSize+CellSize/4,BoardTop+BoardHeight*CellSize+CellSize/4);
  for(i=0;i<=4;i++)
  {
    line(NBBoardLeft+i*NBCellSize,NBBoardTop,NBBoardLeft+i*NBCellSize,NBBoardTop+4*NBCellSize);
    line(NBBoardLeft,NBBoardTop+i*NBCellSize,NBBoardLeft+4*NBCellSize,NBBoardTop+i*NBCellSize);
  }
  rectangle(ScoreBoardLeft,ScoreBoardTop,ScoreBoardLeft+ScoreBoardWidth,ScoreBoardTop+ScoreBoardHeight);
  DisplayScore();
  gettime(&sysTime);
  srand(sysTime.ti_hour*3600+sysTime.ti_min*60+sysTime.ti_sec);
  GenerateBlock(&nextBlock);
  NextBlock();
  setcolor(DARKGRAY);
  outtextxy(InfoLeft,InfoTop+20,"Up -rotate Space-drop");
  outtextxy(InfoLeft,InfoTop+35,"Left-left  Right-right");
  outtextxy(InfoLeft,InfoTop+50,"Esc -exit");
  DisplayInfo(info_help);
}
void _INNER_HELPER DisplayScore()
{
  setcolor(BkGndColor);
  outtextxy(ScoreBoardLeft+5,ScoreBoardTop+5,info_score);
  setcolor(ScoreColor);
  sprintf(info_score,"Score:%d",TotalScore);
  outtextxy(ScoreBoardLeft+5,ScoreBoardTop+5,info_score);
}
void main(void)
{
  InitGame();
}
程序运行有一个错误,搞不明白?

[[it] 本帖最后由 jxt598598 于 2008-3-23 02:40 编辑 [/it]]
搜索更多相关的解决方案: 300  include  color  

----------------解决方案--------------------------------------------------------
  相关解决方案