StaffmodeWnd::StaffmodeWnd() { int i,j; ZeroMemory(this,sizeof(StaffmodeWnd)); InitMaze(); baseWnd.loadLGF(pack_gparts,"staffBase"); logo.loadLGF(pack_gparts,"staffLogo"); nameList.createColorBuf(800,22,32); dest.buf = (RGB24 *)g_DibInf.colorBuf.pBuf; dest.sx = 800; dest.sy = 600; selectNum = rndSelect(43); for(i=0;i<4;i++){ j = selectNum +i; if(i==3) j = selectNum -1; if( j < 0) j += 44; if( j > 43) j -= 44; wsprintf(str,"stt%03d",j); panel[i].loadLGF(pack_eventcg,str); src[i].buf = (BYTE *)panel[i].pBuf; src[i].pal = (RGB32 *)panel[i].palColor; src[i].alp = NULL; src[i].sx = 400; src[i].sy = 300; } button.loadLGF(pack_gparts,"staffBtn"); RECT ptRect[3]; rect.left = 20; rect.right = rect.left +188; rect.top = 268; rect.bottom = rect.top +172; for(i=0;i<3;i++){ ptRect[i].left = 0; ptRect[i].right = ptRect[i].left +188; ptRect[i].top = i*172; ptRect[i].bottom = ptRect[i].top +172; } btn[0].Create(1,&button,&rect,ptRect,&g_DibInf.colorBuf); rect.left = 592; rect.right = rect.left +188; rect.top = 268; rect.bottom = rect.top +172; for(i=0;i<3;i++){ ptRect[i].left = 188; ptRect[i].right = ptRect[i].left +188; ptRect[i].top = i*172; ptRect[i].bottom = ptRect[i].top +172; } btn[1].Create(1,&button,&rect,ptRect,&g_DibInf.colorBuf); rect.left = 400-216/2; rect.right = rect.left +216; rect.top = 340; rect.bottom = rect.top +156; for(i=0;i<3;i++){ ptRect[i].left = 376; ptRect[i].right = ptRect[i].left +216; ptRect[i].top = i*156; ptRect[i].bottom = ptRect[i].top +156; } btn[2].Create(1,&button,&rect,ptRect,&g_DibInf.colorBuf); c_cls_all(); msgWnd.MsgCLS(); msgWnd.ForceHide(); changeExecMode( staffmode_mode ); bgInf.look_max = 900; bgInf.look_cnt = timeGetTime() +bgInf.look_max; panel[0].alpha = panel[1].alpha = button.alpha = baseWnd.alpha = logo.alpha = 0; DrawMaze(&baseWnd); writeName(); }
CMaze::CMaze() { chDXY[0] = 0x01; // N chDXY[1] = 0x10; // E chDXY[2] = -0x01; // S chDXY[3] = -0x10; // W InitMaze(); InitMouse(); }
GLScene::GLScene ( QWidget* parent ):QGLWidget(parent), m_ambientColor(), m_background(), m_lastPoint() { //ambient lighting color m_ambientColor.assign(0.2f); m_ambientColor[3] = 1.0f; //background initialization m_background.assign(0.0f); //make it a black bg m_background[3] = 1.0f; InitMaze(1.2f); }
int main( ){ //主函数 MazeType maze; PostType start,end; InitMaze(maze);//初始化并创建迷宫 start.r=1;start.c=1;//迷宫入口坐标 end.c=8;end.r=8; //迷宫出口坐标 PrintMaze(maze); MazePath(maze,start,end); PrintMaze(maze);//打印路径 return 0; }
void SystemInit() { sysInf.FontSize = mainFontSize; InitMaze(); HDC hDC; BITMAPINFOHEADER bmpInfoHead; CreateAlphaTable(); ZeroMemory(&bmpInfoHead,sizeof(BITMAPINFOHEADER)); bmpInfoHead.biSize = sizeof(BITMAPINFOHEADER); bmpInfoHead.biWidth = WIN_SIZEX; bmpInfoHead.biHeight = -WIN_SIZEY; bmpInfoHead.biPlanes = 1; bmpInfoHead.biBitCount = 24; bmpInfoHead.biCompression = BI_RGB; bmpInfoHead.biSizeImage = WIN_SIZEX * WIN_SIZEY *3; hDC = GetDC(sysInf.hWnd); g_DibInf.memDC = CreateCompatibleDC(hDC); g_DibInf.hBmp = CreateDIBSection(hDC,(BITMAPINFO *)&bmpInfoHead,DIB_RGB_COLORS, (void **)&g_DibInf.colorBuf.pBuf,NULL,NULL); g_DibInf.oldBmp = (HBITMAP)SelectObject(g_DibInf.memDC,g_DibInf.hBmp); ReleaseDC(sysInf.hWnd,hDC); ZeroMemory(g_DibInf.colorBuf.pBuf, WIN_SIZEX*WIN_SIZEY*3); g_DibInf.colorBuf.width = WIN_SIZEX; g_DibInf.colorBuf.height = WIN_SIZEY; g_DibInf.colorBuf.bpp = 24; g_DibInf.colorBuf.wPitch = WIN_SIZEX *3; backColorBuf.createColorBuf(WIN_SIZEX+80,WIN_SIZEY+60,24); bak_backColorBuf.createColorBuf(WIN_SIZEX+80,WIN_SIZEY+60,24); bgInf.colorBuf.loadLGF(pack_eventcg,"s00000",Type_back); msgWnd.InitMessageParts(); InitDirectInput(sysInf.hInstance); lpSoundDS = new ClSoundDS(sysInf.hWnd,readFile,FALSE); if(sysInf.bAutoRead)CheckMenuItem( sysInf.hMenu, ID_AUTOREAD, MF_CHECKED ); #ifdef _DEBUG sysInf.bInfo = TRUE; #endif InitReadFlag(); lpMovie = new CMovie; lpMovie->OpenMovie("leaflogo.avi",1); SYSTEMTIME sysTime; GetLocalTime(&sysTime); srand( sysTime.wMilliseconds ); for(int i=0;i<sysTime.wMilliseconds;i++)rand(); } // SystemInit
void DebugRender(GameState* state){ Renderer* renderer = state->renderer; PhysicsManager* physics = state->physics; FileContents file = GetLog(); Maze* maze = state->maze; int size = maze->dims * maze->dims; char* grid = (char*)file.contents; maze->data = grid + (state->mazeFrame * size); int numTiles = InitMaze(physics, 11.0f, 11.0f, maze); }
int main(int argc, char const *argv[]) { maze_path = new Stack; InitStack(maze_path); InitMaze(maze_matrix); if(Solution()) { cout<<"we solved the maze!\n"; Show_Stack(maze_path); } else cout<<"it is bad.......\n"; return 0; }
/* *主函数 */ int main() { loop: printf("plase input the number of row m(m>0,m<100):"); scanf("%d",&m); printf("plase input the number of line n(n>0,n<100):"); scanf("%d",&n); if(m<0||m>100||n<0||n>100){ printf("The number is error,process will exit !\n"); exit(-1); } printf("The character is 'a',it is area.\n"); printf("The character is 'b',it is wall.\n"); printf("\n"); InitMaze(); printf("The oid Maze:\n"); printf("\n"); drawMaze(); printf("\n show the path ?(y/n)"); fflush(stdin); if(toupper(getch())=='Y') { printf("\n"); ShowPath(); printf("\n go on play ?(y/n)"); fflush(stdin); if(toupper(getch())=='Y') { goto loop; } else { exit(1); } } else { exit(1); } getch(); return 0; }
void TestMaze() { int n = 10; int** ppMaze = CreateMaze(n); Pos entry = InitMaze(ppMaze, n); PrintMaze(ppMaze, n); Stack<Pos> path; Maze(ppMaze, n, entry, path); PrintMaze(ppMaze, n); cout<<"Path:"; while (!path.Empty()) { const Pos& pos = path.Top(); cout<<"("<<pos.row<<","<<pos.col<<")"<<"<-"; path.Pop(); } cout<<"Entry"<<endl; }