Skip to content

Instantly share code, notes, and snippets.

@alphaKAI
Created December 12, 2012 04:36
Show Gist options
  • Save alphaKAI/4264894 to your computer and use it in GitHub Desktop.
Save alphaKAI/4264894 to your computer and use it in GitHub Desktop.
(」・ω・)」うー!(/・ω・)/にゃー!なプログラム(Ubuntu 12.10 bashで動作確認)
#include <stdio.h>
#include <unistd.h>
#define ESC 0x1B
#if __unix || __linux || __FreeBSD__ || __NetBSD__
#include <unistd.h>
#define SLEEP sleep(1);
#endif
#if _WIN32 || _WIN64
#include <Windows.h>
#define SLEEP Sleep(1000);
#endif
/*
カラーな (」・ω・)」うー!(/・ω・)/にゃー!な プログラム
Ubuntu 12.10 bashで動作を確認
*/
int main(void){
int i;
int x,y;
int num;
x=8;
y=8;
/* 準備 */
printf("%c[2J", ESC);
printf("%c[40m", ESC);
for(i=1; i<=11; i++){
if(i==1){
printf("%c[2J", ESC);
}
else{
printf("%c[31m", ESC);//文字色赤
printf("%c[%d;%dH (」・ω・)」うー!\n\n\n\n\n\n\n\n\n\n\n\n\n", ESC, y, x);
SLEEP
printf("%c[%d;%dH (/・ω・)/にゃー!\n", ESC, y+1, x+5);
//printf("%c[m", ESC);//文字色デフォルトに戻す
SLEEP
printf("%c[33m", ESC);//文字色黄色
printf("%c[%d;%dH (」・ω・)」うー!(/・ω・)/にゃー!\n", ESC, y+2, x+10);
//printf("%c[m", ESC);//文字色戻す
SLEEP
printf("%c[2J", ESC);//画面クリア
}
}
printf("\033[49m");
printf("\033[39m");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment