#include "DxLib.h"
int DrawGraphicString(int x,int y,const char *strings,int *phFont,int transflag=TRUE)
{
int i;
int cx = x;
for(i=0;strings[i] != NULL;i++)
{
int tx=0,ty=0;
unsigned char tchar = (unsigned char)strings[i];
int ch = phFont[tchar];
if(0 != GetGraphSize(ch,&tx,&ty))
return -1;
if(0 != DrawGraph(cx,y,ch,transflag))
return -1;
cx += tx;
}
return 0;
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
ChangeWindowMode(TRUE);
if( DxLib_Init() == -1 ) // DXライブラリ初期化処理
{
return -1; // エラーが起きたら直ちに終了
}
SetDrawScreen(DX_SCREEN_BACK);//描画先をバックバッファに指定
//フォントハンドル
int hFont[256];
// フォントグラフィック読み込み
if(-1==LoadDivGraph("dkingyo_nysl_font02.bmp",256,16,16,16,16,hFont)){
goto End;
}
//main loop
{
const char *strs[]={
"Colud you tell me how to use DxLib ?",
"I like DxLib!!",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"I'm d.Kingyo!! DxLibFan owner",
"I think... DxLib is an excellent library.",
"3D can be done and it is glad.",
"I can't use English!! oh! NOOOOOOOOOH!!!!!!",
":-) orz :^| (^_^)v (-_-) m(_ _)m OTL" ,
"I like C/C++ computer programming language",
"can't support HIRAGANA and KATAKANA",
" and KANZI but HANKAKU KATAKANA ok",
"アイウエオ カキクケコ サシスセソ ワオン ",
"http://d.hatena.ne.jp/studiokingyo/",
NULL
};
int i,counter=0,font_counter=0;
while(ProcessMessage()!=-1){
if(CheckHitKey(KEY_INPUT_ESCAPE))
break;
ClsDrawScreen();
for(i=0;strs[i] != NULL;i++)
{
DrawGraphicString(0,i*32,strs[i],hFont);
}
{
char sliding_str[256];
for(int j=0;j<256;j++)
{
sliding_str[j] = (font_counter+j) & 0xff;
}
DrawGraphicString(0,480 - 16,sliding_str,hFont);
if(counter % 7 == 0){
font_counter++;
}
if(font_counter >= 256) font_counter = 0;
counter++;
}
Sleep(10);
ScreenFlip();
}
}
End:
DxLib_End() ; // DXライブラリ使用の終了処理
return 0 ; // ソフトの終了
}
|