void GameMessageUI::PrintHitResultMessage(HitResult hitResult, int x, int y ) { Gotoxy(x, y); printf_s(" "); Gotoxy(x, y); switch (hitResult) { case MISS: printf_s("적에게 공격이 빗나갔습니다."); break; case HIT: printf_s("적에게 공격이 성공하였습니다."); break; case AIRCRAFT_DESTROY: printf_s("적의 Aircraft를 격침하였습니다."); break; case BATTLESHIP_DESTROY: printf_s("적의 BattleShip을 격침하였습니다."); break; case CRUISER_DESTROY: printf_s("적의 Cruiser를 격침하였습니다."); break; case DESTROYER_DESTROY: printf_s("적의 Destroyer를 격침하였습니다."); break; } }
void GameMessageUI::PrintGameNumMessage(int playNum, int TurnNum, int TurnSum) { Gotoxy(GAMENUMMESSAGE_X, GAMENUMMESSAGE_Y); printf_s("플레이 횟수: %d번 ", playNum); printf_s("이번 게임 턴수: %d턴", TurnNum); Gotoxy(GAMENUMMESSAGE_X, GAMENUMMESSAGE_Y + 2); printf_s(" 지금까지의 평균 턴수: %d턴", TurnSum / playNum); }
void GameMessageUI::PrintGameOverMessage(std::string playerName) { Gotoxy(ATTACKMENU_X + 6, 1); printf_s(" "); Gotoxy(ENDMESSAGE_X,ENDMESSAGE_Y); printf_s(" ** 게임 종료 **"); Gotoxy(ENDMESSAGE_X - MESSAGE_INTERVAL, ENDMESSAGE_Y + MESSAGE_INTERVAL); printf_s(" <%s> (이)가 이겼습니다.", playerName.c_str()); }
void Paint(int no){ Element *p = snake; if (no == body){ Gotoxy(p->posx, p->posy); printf("@"); while (p->next != snake) p = p->next; Gotoxy(p->posx, p->posy); printf("@"); } else if (no == remove){ Gotoxy(tail->posx, tail->posy); printf(" "); } tail->posx = p->posx; tail->posy = p->posy; }
//============================================================================== void ICACHE_FLASH_ATTR LINES() { int i; Gotoxy(0,2); for(i = 0; i < 96; i++) spi(_DATA, 0x18); Gotoxy(0,6); for(i = 0; i < 96; i++) spi(_DATA, 0x18); }
void GameMessageUI::PrintAttackMessage() { Gotoxy(ATTACKMESSAGE_X, ATTACKMESSAGE_Y - MENU_INTERVAL); printf_s("*공격 좌표 설정*"); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL, ATTACKMESSAGE_Y - 2); printf_s("┏━┓"); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL, ATTACKMESSAGE_Y - 1); printf_s("┃--┃"); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL, ATTACKMESSAGE_Y); printf_s("┗━┛"); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL + 2, ATTACKMESSAGE_Y - 1); }
void GameMessageUI::EraseAttackMessage() { Gotoxy(ATTACKMESSAGE_X, ATTACKMESSAGE_Y - MENU_INTERVAL); printf_s(" "); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL, ATTACKMESSAGE_Y - 2); printf_s(" "); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL, ATTACKMESSAGE_Y - 1); printf_s(" "); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL, ATTACKMESSAGE_Y); printf_s(" "); Gotoxy(ATTACKMESSAGE_X + MESSAGE_INTERVAL + 2, ATTACKMESSAGE_Y - 1); printf_s(" "); }
void Print::PrintBottom() { Gotoxy(0, PLAY_LINES + 2); Setcolor(Color(BOTTOM)); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); if (hero.empty()) { Setcolor(Color(STATUS_BAR)); printf("\t\t\t\t 확인: Enter Key or Z key \t\t 취소: ESC key or X key \t\t\t\t\t"); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); } else { Setcolor(Color(HP_BAR)); hero[PLAYER_1]->HpStatus(); printf(" "); if (playerNum > 1) hero[PLAYER_2]->HpStatus(); else printf(" \t\t 공격 : Z key 조준 : X key \t\t\t"); Setcolor(Color(MP_BAR)); hero[PLAYER_1]->MpStatus(); printf(" "); if (playerNum > 1) hero[PLAYER_2]->MpStatus(); else printf(" \t\t 스킬1: X -> Z 스킬2: X -> C \t\t\t"); } Setcolor(Color(BOTTOM)); printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Setcolor(Color(SCREEN)); }
void Print::PrintColor() { if (!m_HeroColor.empty()) { Setcolor(Color(HERO)); while (!m_HeroColor.empty()) { Gotoxy(m_HeroColor.back().x, m_HeroColor.back().y + 1); _putch(m_ScreenBuffer[m_HeroColor.back().y][m_HeroColor.back().x]); _putch(m_ScreenBuffer[m_HeroColor.back().y][m_HeroColor.back().x + 1]); m_HeroColor.pop_back(); } } if (!m_SopeColor.empty()) { Setcolor(Color(SCORP)); while (!m_SopeColor.empty()) { Gotoxy(m_SopeColor.back().x, m_SopeColor.back().y + 1); _putch(m_ScreenBuffer[m_SopeColor.back().y][m_SopeColor.back().x]); m_SopeColor.pop_back(); } } if (!m_HitColor.empty()) { Setcolor(Color(HIT)); while (!m_HitColor.empty()) { Gotoxy(m_HitColor.back().x, m_HitColor.back().y + 1); _putch(m_ScreenBuffer[m_HitColor.back().y][m_HitColor.back().x]); _putch(m_ScreenBuffer[m_HitColor.back().y][m_HitColor.back().x + 1]); m_HitColor.pop_back(); } } if (!m_DeathColor.empty()) { Setcolor(Color(DEATH)); while (!m_DeathColor.empty()) { Gotoxy(m_DeathColor.back().x, m_DeathColor.back().y + 1); _putch(m_ScreenBuffer[m_DeathColor.back().y][m_DeathColor.back().x]); _putch(m_ScreenBuffer[m_DeathColor.back().y][m_DeathColor.back().x + 1]); m_DeathColor.pop_back(); } } Sleep(20 / (1 + lowSpecMode)); }
//============================================================================== void char_10x16(unsigned int aX, unsigned int aY, unsigned int aDig) { int i = 0, j = 0; for(i = 0; i < 2; i++) { Gotoxy(aX,aY+i); for(j = 0; j < 10; j++) spi(_DATA, courier_10x16[j+i*10 + aDig*10*2]); } }
void drawSqureSub(int x, int y) { textcolor(153); Gotoxy(x,y); for(int i=y;i<SQUARE_SIZE+y;i++) { for(int j=x;j<SQUARE_SIZE*2+x;j++) { Gotoxy(j,i); printf("%c",'k'); } } textcolor(7); }
//============================================================================== void char_24x16(unsigned int aDig, unsigned int aX, unsigned int aY) { int i = 0, j = 0; for(i = 0; i < SYM_HEIGHT; i++) { Gotoxy(aX,aY+i); for(j = 0; j < SYM_WIDGHT; j++) spi(_DATA, Times_16x24[j+i*SYM_WIDGHT + aDig*SYM_WIDGHT*SYM_HEIGHT]); } }
void GameMessageUI::PrintAttackResultMessage(AttackResult attackResult, Position attackPos, int x, int y) { Gotoxy(ATTACKMESSAGE_X - MESSAGE_INTERVAL * 2, ATTACKMESSAGE_Y + MESSAGE_INTERVAL); printf_s(" "); switch (attackResult) { case ALREADY_ATTACK: Gotoxy(ATTACKMESSAGE_X - MESSAGE_INTERVAL, ATTACKMESSAGE_Y + MESSAGE_INTERVAL); printf_s("\"%c%c\" (은)는 이미 공격한 좌표입니다.", attackPos.y, attackPos.x); break; case INVALID_ATTACK: Gotoxy(ATTACKMESSAGE_X - MESSAGE_INTERVAL * 2, ATTACKMESSAGE_Y + MESSAGE_INTERVAL); printf_s("\"%c%c\" (은)는 유효하지 않은 좌표입니다.", attackPos.y, attackPos.x); break; case VALID_ATTACK: Gotoxy(x, y); printf_s("\"%c%c\" (을)를 공격하였습니다.", attackPos.y, attackPos.x); break; } }
void TMessageEcran::Defiler() const { int PosX = MX; int PosY = MY; Gotoxy(PosX, PosY); while (PosY < 25) { while ((PosX + MTexteMessage.length()) < 79) { Gotoxy(PosX, PosY); cout << MTexteMessage; Sleep(50); Gotoxy(PosX, PosY); ClrEol(); PosX++; } PosY++; PosX = 1; } cout << MTexteMessage; }
//--------------------------------------------------------------------------- void CShowVGAMode(void) { Gotoxy(6, _SHOW_NUM_POS_Y, BYTE_DISPLAY); CShowNumber1(stModeInfo.IHWidth, 0); OutputChar('X'); CShowNumber1(stModeInfo.IVHeight, 0); OutputChar('X'); CShowNumber1((stModeInfo.IVFreq/10), 0); OutputChar('H'); OutputChar('Z'); OutputChar(' '); }
void animation(int x, int y) { int i,j; for(int i=y;i<SQUARE_SIZE+y;i++) { textcolor(204); Gotoxy(x,i); printf("%c",'k'); } for(int j=x;j<SQUARE_SIZE*2+x;j++) { textcolor(204); Gotoxy(j,y); printf("%c",'k'); } }
void Maschera ( char Titolo [], //Vettore per inserimento titolo int Colore //Variabile per scelta del colore ) { int X ; //Variabile per posizionamento del titolo Clrscr(); TextColor(Colore); Gotoxy (0, 0); printf ("%80s", " "); Gotoxy (0,24); printf ("%80s", " "); X = 40 - strlen(Titolo)/2 ; //Calcolo Posizione Titolo Gotoxy(X , 0); printf(Titolo); Gotoxy(32,24); printf("Created by Martin De Luca"); Gotoxy(1,3); TextColor(0x0F); }
/*-----------------------------------------------------------------------------* |////////////////////////Procedura GetNumInLine////////////////////////////////| *-----------------------------------------------------------------------------*/ char* GetNumInLine ( int c, // carattere di inizio stringa int line // posizione della riga sullo schermo ) { char* string; // buffer di lettura e stringa di output [max BUFFSIZE] int i; // indice della stringa [da 0 a 26] i=0; string=(char*)calloc(NUMBUFF,sizeof(char)); SetColor(TXT,BKGRND); do { if(isdigit(c)&&i<NUMBUFF-1) // c deve necessariamente essere un { // numero da 0 a 9 if(i<27) // se non è stato raggiunto il margine { string[i]=c; // inserisce il numero nella stringa printf("%c",c); // stampa a video il numero i++; // incrementa l'indice } } else if(c==BACKSPACE) // nel caso ci sia BACKSPACE in input { if(i>0) // se è presente almeno un numero { i--; string[i]='\0'; // elimina l'ultimo numero Gotoxy(line+6,i+30); printf(" "); Gotoxy(line+6,i+30); // visualizza l'eliminazione } } c=GetKey(); // ottiene il prossimo input }while(c!=ENTER); // esegue finchè non viene premuto ENTER return string; TextReset(); }
//----------------------------------------------------------------------- void CDrawMuteState(void) { COsdFxDisableOsd(); SetOSDDouble(0x03); SetOsdMap(tUserMenuOsdMap); // Init OSD Ram OSDClear(0,_MAINMENU_HEIGHT, 0, 31, 0x8C, BYTE_ATTRIB); OSDClear(0,_MAINMENU_HEIGHT, 0, 31, 0x00, BYTE_DISPLAY); OSDClear(0,_MAINMENU_HEIGHT, 0, 31, 0x40, BYTE_COLOR); COsdFxCodeWrite(ucCloseAllWindow); OSDPosition(4 * 12, 2 * 18, 40, 1, 0x03); if (GET_AUDIO_MUTE()) // Mute on COsdLoad1BitFont(FntMute, 0x10, 6, tFntVolumeCharWidth); else COsdLoad1BitFont(FntVolume, 0x10, 6, tFntVolumeCharWidth); // Display Volume/Mute icon Gotoxy(0, 0, BYTE_DISPLAY); OutputChar(0x10); OutputChar(0x11); OutputChar(0x12); Gotoxy(0, 1, BYTE_DISPLAY); OutputChar(0x13); OutputChar(0x14); OutputChar(0x15); COsdFxEnableOsd(); bOSDTimeOut = 0; // ucAudioState = 1; if (GET_AUDIO_MUTE()) // Mute on { CTimerCancelTimerEvent(COsdDispOsdTimerEvent); } else { CTimerReactiveTimerEvent(SEC(5), COsdDispOsdTimerEvent); } }
void Velocity_Display(int ch) //周波数応答(モータ) { double RPS; M[ch].Counter = Count_Read(ch); RPS = (M[ch].Counter-M[ch].Counter_Past)/(2000.0*Reduction_Ratio)/(Samp_Cycle/1000.0); M[ch].Velocity = RPS*5.0; M[ch].RPM = RPS*60.0; Gotoxy(0,20); Setcolor(GREEN,BLACK); printf(" ch%d Velocity :%8.3f[mm/sec] %8.3f[rpm]\n",ch, M[ch].Velocity,M[ch].RPM); Restore(); M[ch].Counter_Past = M[ch].Counter; }
void Print::PrintTop() { Gotoxy(0, 0); Setcolor(Color(TOP_BAR)); if (hero.empty()) printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); else { if (playerNum == 1) printf(" \t Stage%4d \t\t\t ENTER: 다음 라운드 ESC: 처음으로 \t\t\t\t 남은 생명: %d \t ", gameStage, hero[PLAYER_1]->HavingHeart()); else printf(" \t Stage%4d \t\t\t ENTER: 다음 라운드 ESC: 처음으로 \t\t\t 1P 생명: %d 2P 생명: %d ", gameStage, hero[PLAYER_1]->HavingHeart(), hero[PLAYER_2]->HavingHeart()); } }
//--------------------------------------------------------------------------- void CShowHDMIMode(void) { WORD ucLen; WORD IHWidth_Tmp,IVHeight_Tmp; IHWidth_Tmp = stModeInfo.IHWidth; IVHeight_Tmp = stModeInfo.IVHeight; CScalerPageSelect(_PAGE2); CScalerGetDataPortByte(_P2_HDMI_ADDR_PORT_C9, _P2_HDMI_VCR_50, 1, pData, _NON_AUTOINC); stModeInfo.IVHeight = HDMI_V_Height; if((pData[0]&0x0F) == 0x01) // 2 times stModeInfo.IHWidth = HDMI_H_Width*2; else if((pData[0]&0x0F) == 0x03) // 4 times stModeInfo.IHWidth = HDMI_H_Width*4; else stModeInfo.IHWidth = HDMI_H_Width; ucLen = stModeInfo.IVHeight; CScalerRead(_IPV_ACT_LEN_H_1A, 1, pData, _AUTOINC); if (pData[0] & _BIT5) ucLen = stModeInfo.IVHeight*2; if (GET_INTERLACE_MODE()) { if(stModeInfo.IVFreq>=598 && stModeInfo.IVFreq<=599) //60Hz stModeInfo.IVFreq += 2; else if(stModeInfo.IVFreq>=498 && stModeInfo.IVFreq<=499) //50Hz stModeInfo.IVFreq += 2; } Gotoxy(6, _SHOW_NUM_POS_Y, BYTE_DISPLAY); CShowNumber1(stModeInfo.IHWidth, 0); OutputChar('X'); CShowNumber1(ucLen, 0); OutputChar('X'); CShowNumber1(stModeInfo.IVFreq/10, 0); OutputChar('H'); OutputChar('Z'); OutputChar(' '); stModeInfo.IHWidth = IHWidth_Tmp; stModeInfo.IVHeight = IVHeight_Tmp; }
//*** センサ総合 ********************************************************* void Sensors_Display(void) { int ch; Gotoxy(0,6); Setcolor(GREEN,BLACK); Counters_Read(); for(ch=1; ch<=Channel; ch++){ printf(" ch%d Counter :%8.3f[mm] (%6d[pulse])\n",ch ,M[ch].Counter/2000.0*5.0/Reduction_Ratio ,M[ch].Counter); } //カウンタ×4逓倍 for(ch=1; ch<=Channel; ch++){ M[ch].Force = AD_Read(ch)/2047.0*1000.0; printf(" ch%d Load : %6d (%6.3f[N])\n", ch, AD_Read(ch), M[ch].Force); } printf("\n"); Restore(); }
void GameMessageUI::PrintSetDirectionMessage() { char select = NULL; m_CursorPos.x = DIRECTIONMESSAGE_X; m_CursorPos.y = DIRECTIONMESSAGE_Y + MENU_INTERVAL; Gotoxy(DIRECTIONMESSAGE_X, DIRECTIONMESSAGE_Y); printf_s("*배를 배치할 방향을 선택하십시오.*"); Gotoxy(DIRECTIONMESSAGE_X + MENU_INTERVAL, DIRECTIONMESSAGE_Y + MENU_INTERVAL); printf_s("가로 배치"); Gotoxy(DIRECTIONMESSAGE_X + MENU_INTERVAL, DIRECTIONMESSAGE_Y + MENU_INTERVAL * 2); printf_s("세로 배치"); while (select != ENTER) { Gotoxy(m_CursorPos.x, m_CursorPos.y); printf_s("▶"); select = getch(); Gotoxy(m_CursorPos.x, m_CursorPos.y); printf_s(" "); switch (select) { case UP: m_CursorPos.y -= CURSOR_INTERVAL; if (m_CursorPos.y < HORIZON) m_CursorPos.y += CURSOR_INTERVAL; break; case DOWN: m_CursorPos.y += CURSOR_INTERVAL; if (m_CursorPos.y > VERTICAL) m_CursorPos.y -= CURSOR_INTERVAL; break; } } //enter 입력후 내용 지우기 Gotoxy(DIRECTIONMESSAGE_X, DIRECTIONMESSAGE_Y); printf_s(" "); Gotoxy(DIRECTIONMESSAGE_X + MENU_INTERVAL, DIRECTIONMESSAGE_Y + MENU_INTERVAL); printf_s(" "); Gotoxy(DIRECTIONMESSAGE_X + MENU_INTERVAL, DIRECTIONMESSAGE_Y + MENU_INTERVAL * 2); printf_s(" "); }
void GameMessageUI::EraseSetupMessage() { Gotoxy(SETUPMESSAGE_X, SETUPMESSAGE_Y); printf_s(" "); Gotoxy(SETUPMESSAGE_X, SETUPMESSAGE_Y + MESSAGE_INTERVAL); printf_s(" "); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3, SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2 - 2); printf_s(" "); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3 , SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2 - 1); printf_s(" "); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3 , SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2); printf_s(" "); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3 + 2, SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2 - 1); }
void GameMessageUI::PrintSetupMessage(std::string shipName) { Gotoxy(SETUPMESSAGE_X, SETUPMESSAGE_Y); printf_s("** %s 배치 시작 좌표 입력 **", shipName.c_str()); Gotoxy(SETUPMESSAGE_X, SETUPMESSAGE_Y + MESSAGE_INTERVAL); printf_s(" ex) \"a1\"이면 \"a1\"부터 순서대로 배치"); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3 , SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2 - 2); printf_s("┏━┓"); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3, SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2 - 1); printf_s("┃--┃"); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3 , SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2); printf_s("┗━┛"); Gotoxy(SETUPMESSAGE_X + MESSAGE_INTERVAL * 3 + 2, SETUPMESSAGE_Y + MESSAGE_INTERVAL * 2 - 1); }
/*------------------------------------------------------------------------------ Questa sub permette di convertire in una qualsiasi base minore di 10, un numero inserito dall'utente . Viene calcolato il resto della divisione del valore in entrata per la sua base, (questo sarà uno dei valori che andranno a comporre il numero) , il numero viene diviso per la base ed il valore di qusta divisione va in Num. Viene stampato il resto e viene decrementata la colonna . Il procedimento continua finchè il Numero non è 0. Autore : Martin De Luca Data Ultima Modifica : 2/10/2012 ==============================================================================*/ void Convertitore1 (int Num , int Base) { int Resto , Col ; if(Base > 9) printf("Questa versione del programma non supporta questa base"); else { Col = 70 ; do { Resto = Num%Base; Num = Num/Base; Gotoxy(Col,5); printf("%d",Resto); Col = Col - 1 ; } while (Num>0); } }
void DecBin ( int Dec //Numero di input in decimale ) { int Peso; //Variabile che contine i pesi della potenza del due Peso = 1; while(Peso*2<=Dec) Peso=Peso*2; Gotoxy(10,5); do { if (Dec>=Peso) { printf("1"); Dec = Dec-Peso; } else printf("0"); Peso = Peso/2; } while(Peso>0); }
void TMessageEcran::Afficher() const { Gotoxy(MX,MY); cout << MTexteMessage; }
void Print::PrintText() { Gotoxy(0, 1); for (int y = 0; y <= PLAY_LINES; y++) printf("%s", m_ScreenBuffer[y]); }