int main() { set_conio_terminal_mode(); acc_tick=0; last_tick=0; //putTitle(1,5,0,4,pstr); int bLoop=1; while(bLoop){ if(kbhit()!=0){ char ch=getch(); if(ch=='q'){ bLoop=0; } } clock_gettime(CLOCK_MONOTONIC,&work_timer); double cur_tick=work_timer.tv_sec+(double)(work_timer.tv_nsec*1e-9); double delta_tick=cur_tick-last_tick; last_tick=cur_tick; acc_tick+=delta_tick; if(acc_tick>1.0){ acc_tick=0; nCount--; system("clear"); putTitle(nCount,nCount+4,0,8,9,pstr); //printf("%d\r\n",nCount); } } }
int loop() { startInf(); HWND hwnd = ::FindWindowA(NULL,"easyNote"); SetTransparent(hwnd,215); while(1) { view(); setcolor(RED); moveWindow(hwnd); doubleThing(inf.page-1); putTitle(th[0].title,BLUE); putThing(inf.screen_x,inf.screen_y,inf.box_y,th[0].thing,RED); putTime(); drawMouse(mouse(X),mouse(Y),WHITE); if(keystate(VK_ESCAPE)&&keystate(VK_LBUTTON)) break; delay_fps(100); cleardevice(); } return 0; }
int main() { int bLoop=1; MapObject.m_header.m_nSkima=1; //파일구조바꿀때 구분 MapObject.m_pBuf=NULL; char TitlePalette[]={'.','#','@','%'}; while(bLoop){ char szCmd[32]; gets(szCmd); char *pTemp=strtok(szCmd," "); if(!strcmp(pTemp,"exit")){ bLoop=0; if(MapObject.m_pBuf){ free(MapObject.m_pBuf); } } else if(!strcmp(pTemp,"dump")){ putTitle(0,MapObject.m_header.m_nHeight, 0,MapObject.m_header.m_nWidth, MapObject.m_header.m_nWidth,MapObject.m_pBuf,TitlePalette); } else if(!strcmp(pTemp,"new")){ //new width height if(MapObject.m_pBuf!=NULL){ free(MapObject.m_pBuf); } MapObject.m_header.m_nWidth=atoi(strtok(NULL," ")); MapObject.m_header.m_nHeight=atoi(strtok(NULL," ")); MapObject.m_pBuf=malloc(MapObject.m_header.m_nHeight*MapObject.m_header.m_nWidth); //초기화 /*for(int i=0;i<MapObject.m_header.m_nHeight;i++){ for(int j=0;j<MapObject.m_header.m_nWidth;j++){ MapObject.m_pBuf[j*MapObject.m_header.m_nWidth+i]=0; } }*/ for(int i=0;i<MapObject.m_header.m_nHeight*MapObject.m_header.m_nWidth;i++){ MapObject.m_pBuf[i]=0; } } else if(!strcmp(pTemp,"put")){ //put whidth height tile_index int x,y,tile_index; x=atoi(strtok(NULL," ")); y=atoi(strtok(NULL," ")); tile_index=atoi(strtok(NULL," ")); MapObject.m_pBuf[y*MapObject.m_header.m_nWidth+x]=tile_index; } else if(!strcmp(pTemp,"hline")){ int x,tile_index; x=atoi(strtok(NULL," ")); tile_index=atoi(strtok(NULL," ")); for(int y=0;y<MapObject.m_header.m_nHeight;y++){ MapObject.m_pBuf[y*MapObject.m_header.m_nHeight+x]=tile_index; } } else if(!strcmp(pTemp,"vline")){ int y,tile_index; y=atoi(strtok(NULL," ")); tile_index=atoi(strtok(NULL," ")); for(int x=0;x<MapObject.m_header.m_nWidth;x++){ MapObject.m_pBuf[y*MapObject.m_header.m_nWidth+x]=tile_index; } } else if(!strcmp(pTemp,"save")){ //save filename char *szFileName=strtok(NULL,""); FILE *pFile=fopen(szFileName,"wb"); fwrite(&MapObject.m_header,sizeof(MapObject.m_header),1,pFile); int nSize=MapObject.m_header.m_nWidth*MapObject.m_header.m_nHeight; fwrite(MapObject.m_pBuf,nSize,1,pFile); puts("save ok"); fclose(pFile); } else if(!strcmp(pTemp,"load")){ //load filename char *szFileName=strtok(NULL,""); FILE *pFile=fopen(szFileName,"rb"); fread(&MapObject.m_header,sizeof(MapObject.m_header),1,pFile); if(MapObject.m_pBuf){ free(MapObject.m_pBuf); } int nSize=MapObject.m_header.m_nWidth*MapObject.m_header.m_nHeight; MapObject.m_pBuf=malloc(nSize); fread(MapObject.m_pBuf,nSize,1,pFile); puts("load ok"); fclose(pFile); } } return 0; }