static void DrawStatus( void ) { static int fontHeight = 15; int yPos = g_windowHeight - fontHeight; Push2DMode(); glColor3f( 1.0f, 1.0f, 1.0f ); if( !showHelp ) { PrintfXY( 0, yPos, "hit 'h' for help" ); } else { PrintfXY( 0, yPos, "hit 'h' to hide help" ); yPos -= fontHeight; PrintfXY( 0, yPos, "'w': toggle wireframe" ); yPos -= fontHeight; PrintfXY( 0, yPos, "'t': toggle base texture" ); yPos -= fontHeight; PrintfXY( 0, yPos, "'l': toggle lighting" ); yPos -= fontHeight; #if 0 PrintfXY( 0, yPos, "'n': toggle normals" ); yPos -= fontHeight; #endif PrintfXY( 0, yPos, "'r': reload data" ); yPos -= fontHeight; PrintfXY( 0, yPos, "'q': reload data" ); yPos -= fontHeight; } Pop2DMode(); }
int computeFS () { uint refresh = 2,key; int index = 0,i,hcs; char ch; double ht,hz,v,bh,hd; double value[4] = {0.0,0.0,0.0,0.0}; const char * context[] = {"","","",""}; while(1){ if (refresh == REFRESH_ALL){ refresh = REFRESH_PART; Bdisp_AllClr_VRAM(); SetMyFont(&stHz12x12,&stAsc6x12); //¶¨Òå×ÖÌå´óС DispStr(2,1, "Ïß "); DispStr(2,12,"· "); DispStr(2,25,"·´ "); DispStr(2,38,"Ëã "); ShowTitle(TITLE); DispStr(17,0, "×ø±êX: "); DispStr(17,13,"×ø±êY: "); DispStr(17,26,"×ø±êZ: "); //DispStr(17,39,"×ø±êZ: "); for (i=0;i<4;++i){ PrintXY(50,2+i*12,(uchar*)context[i],0); } PrintIcon (0,"Rou",0); PrintIcon (1,"Set",0); PrintIcon (2,"Disp",0); PrintIcon (3,"=0=",1); PrintIcon (4,"Save",1); PrintIcon (5,"?",0); } if (refresh == REFRESH_PART){ for (i=0;i<4;++i){ PrintFloat(value[i],48,0+i*12,index==i,4); //ÊäÈë¿òλÖà } refresh = 0; } GetKey(&key); switch(key){ case KEY_CTRL_F1 : SET(); refresh=REFRESH_ALL; break; case KEY_CTRL_F2 : ZSSET(); refresh=REFRESH_ALL; break; case KEY_CTRL_F3 : RestoreDisp(SAVEDISP_PAGE1);refresh=REFRESH_ALL;WaitKey();break; case KEY_CTRL_F4 : case KEY_CTRL_F5 : Nodata(); refresh=REFRESH_ALL; break; case KEY_CTRL_F6 : About(); refresh=REFRESH_ALL; break; case KEY_CTRL_UP : refresh=REFRESH_PART; --index; break; case KEY_CTRL_DOWN : refresh=REFRESH_PART; ++index; break; case KEY_CTRL_EXE: if (index<3){ refresh = REFRESH_PART; index++; }else{ yscs.x1 = value[0]; yscs.y1 = value[1]; hz = value[2]; ht = value[3]; refresh=REFRESH_ALL; //yscs.k=0.0; yscs.k=xy_to_sdSrd( yscs.x1, yscs.y1, 0); yscs.d=xy_to_sdSrd( yscs.x1, yscs.y1, 1); //yscs.k=xy_to_sd( yscs.x1, yscs.y1, 0); //yscs.d=xy_to_sd( yscs.x1, yscs.y1, 1); //FS(); GC(); HP(); if (yscs.d<0) hcs=-1; //Æ«¾à×ó²à if (yscs.d>=0) hcs=1; //Æ«¾àÓÒ²à if (yscs.d*hcs<=zfset.zsp) hd=0; // if (zfset.zsh==0) hd=0; if (yscs.d*hcs>zfset.zsp && yscs.d*hcs-zfset.zsp<zfset.zsh) hd=(yscs.d*hcs-zfset.zsp)*hcs; if (yscs.d*hcs-zfset.zsp>=zfset.zsh) hd=zfset.zsh*hcs; bh=yscs.gch+(yscs.hpd*hd)-ht; Bdisp_AllClr_VRAM(); DispStr(2,0, "¼Æ "); DispStr(2,12,"Ëã "); DispStr(2,26,"½á "); DispStr(2,39,"¹û "); ShowTitle(TITLE); DispStr(17,0,"×®ºÅ "); DispStr(17,13,"Æ«¾à "); DispStr(17,26,"ÌîÍÚ: "); DispStr(17,39,"»ù¸ß: "); PrintfXY (48,2.5,0,"%.4f",yscs.k); PrintfXY (48,15,0,"%.4f",yscs.d); PrintfXY (48,28,0,"%.4f",yscs.gch); PrintfXY (48,42,0,"%.4f",yscs.hpd); //PrintfXY (22,40,0," H= %.3f",bh); //PrintfXY (22,48,0," H-Z= %.3f",hz-bh); SaveDisp(SAVEDISP_PAGE1); WaitKey(); ++index; }break; case KEY_CTRL_EXIT: return 0; default: if ((ch=GetPressNumChar(key))!=0){ char buf[14]; int r; refresh = REFRESH_PART; buf[0] = ch; buf[1] = '\0'; r = InputString (48,0+index*12,buf,0,12); //ÊäÈë¿òλÖà if (r != KEY_CTRL_EXIT){ value[index] = atof(buf); if (r==KEY_CTRL_DOWN) ++index; if (r==KEY_CTRL_UP) --index; if (r==KEY_CTRL_EXE && index<3) ++index; } break; } } if (index >=4) index = 2; if (index < 0) index = 3; } }
/////////////////////////////////////////////////////////////// // File List /////////////////////////////////////////////////////////////// int SelectFiles3 (char * file_name) // -1 no file , 1 complate ,0 cancel { int key; char str[50]; //字符数组长度下标从0开始,共50个元素 FONTCHARACTER find_path[50]; //获得路径 FONTCHARACTER find_name[50]; //获得名字 int find_h; int size = 0; int top = 0; int buttom = 0; int index,r,y; char *files; FILE_INFO file_info; // CharToFont("\\\\fls0\\ZDM\\*.zdm",find_path); sprintf(str,"%s\\*.zdm",szSrdDir3); CharToFonts3(str,find_path); if(Bfile_FindFirst (find_path,&find_h,find_name,&file_info)==0) //函数搜索目录中文件的名称符合指定的文件名 { int i=0,ret; BOOL bFindFirst=TRUE; //定义一个布尔型变量初始化为真(true),对于bool类型,值只要不是0就是为真,即true;当值为0时为假,即false; size ++; //使用size之后再加一(先计算再操作) while(Bfile_FindNext(find_h,find_name,&file_info)==0) //Bfile_FindNext 函数使用搜索处理定位匹配一个给定名称的文件名称。 size++; Bfile_FindClose(find_h); //Bfile_FindClose 关闭搜索指定处理函数 files = (char*)malloc(size*13); index = 0; for(;;) { if(bFindFirst) //if 值为真 ret=Bfile_FindFirst (find_path,&find_h,find_name,&file_info); else ret=Bfile_FindNext(find_h,find_name,&file_info); if(ret!=0) //if break; strncpy((files+13*i),FontToChars3(find_name,str),13); if(strcmp((files+13*i),setup_data.zdmroute_name)==0) //文件选中后,现在记忆位置 index=i; i++; bFindFirst=FALSE; //令值为假 即=0 } Bfile_FindClose(find_h); //Bfile_FindClose 关闭搜索指定处理函数 r = 1; top = 0; buttom = 4; while(1) { if (r) { Bdisp_AllClr_VRAM(); //PopUpWin(6); DispStr(20,8,"纵断面文件: "); if (buttom-top>3)buttom = top + 3; if(top>index) { top = index; buttom = index + 3; } if (index>buttom) { buttom = index; top = buttom - 3; } if(buttom>size - 1)buttom = size - 1; if(top<0) top = 0; for (i=top;i<=buttom;++i) { //sprintf(str,"%13.13s",(files+13*i)); //y=2+(i-top)*13; //顶部文件位置 //SetMyFont(&stHz12x12,&stAsc6x12); //DispStr(18,y,str); //str[]是字符串 //if(index==i) //Bdisp_AreaReverseVRAM(15,y,20+13*6,y+11); PrintfXY(20,22+(i-top)*8,index==i,"%13.13s",(files+13*i)); } PrintXY(100,22,top>0?"\xE6\x92":" ",0); PrintXY(100,46,buttom<size-1?"\xE6\x93":" ",0); r = 0; } GetKey(&key); if (key==KEY_CTRL_UP) {if(--index<0) index = size - 1;r = 1;} if (key==KEY_CTRL_DOWN) {if(++index>size - 1) index = 0;r = 1;} if (key==KEY_CTRL_EXE) { strcpy(file_name,(files+13*index)); free (files); return 1; } if (key==KEY_CTRL_EXIT) { free (files); return 0; } } } else return -1; }