具体的に何がしたいのかというと、ひらがなカタカナ54音の画像の分割して読み取り書き込んだ文字列によってそれに合った画像を表示していくというものなのですが。口では説明しにくいので実際にソースを書いてみたいと思います。
#include <DxLib.h>
#include <stdio.h>
#define CHARCODE "54音.jpg"
void CreateCharCode();
void DrawString(const char*);
int n[240];
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
DxLib::ChangeWindowMode(true);
DxLib::DxLib_Init();
//54音+aの表示
CreateCharCode();
count = 0;
DrawString("もじれつ");
DxLib::WaitKey();
DxLib::DxLib_End();
}
void CreateCharCode(){
DxLib::LoadDivGraph(CHARCODE,240,24,11,int(400/24),int(240/10),n);
int count=0;
for(int i=0; i<24; i++)
for(int j=0; j<11; j++ ){
DxLib::DrawGraph(int(450/24)*i,int(270/10)*j,n[count],NULL);
count++;
}
}
void DrawString(const char* s){
int c = 文字を文字コードに変換する関数(s[i])-177;
if( c = 0 ){ //'あ'の画像の表示
Draw( 10*count , 350 , n[c] , NULL );
}
}
技術不足でうまく伝わるのを祈るしかないのですが、お願いします。