LoadGraphで読み込んだjpgファイルの一部がきれいに描画されません。
いったい何が原因でしょうか・・・。
グローバル変数に画像ファイルを代入するのがまずいのでしょうか?
下記、該当部分のソースです。
void MakeMainHandle()
{
int photo;
photo = GetRand(4);
switch (photo)
{
case 0: MainHandle = LoadGraph("素材\\バズリズム.jpg");
break;
case 1: MainHandle = LoadGraph("素材\\君瞳1.jpg");
break;
case 2: MainHandle = LoadGraph("素材\\君瞳2.jpg");
break;
case 3: MainHandle = LoadGraph("素材\\ライブ 4.jpg");
break;
case 4: MainHandle = LoadGraph("素材\\ライブ.jpg");
break;
}
}
void SetHandleAndColor()
{
FontHandle = CreateFontToHandle(NULL, 20, 7);
MSHandle = CreateFontToHandle("MS 明朝", 60, 7);
ClearHandle = LoadGraph("素材\\15th 1.jpg");
MissHandle = LoadGraph("素材\\えげつだね.jpg");
OutHandle = LoadGraph("素材\\煽る田淵.jpg");
Syokupankun = LoadGraph("素材\\しょくぱんくん.jpg");
LIGHTBLUE = GetColor(0, 255, 255);
RED = GetColor(255, 0, 0);
BLACK = GetColor(0, 0, 0);
WHITE = GetColor(255, 255, 255);
YELLOW = GetColor(255, 255, 0);
}
int GameMain(int i, int now)
{
int j, len;
char Typing[2];
int Hit = 0;
int Nowtotal = 0;
int ANSWER_X, ANSWER_Y;
int FONT_SIZE;
int TIMELIMIT,NowTime,CurrentTime,StartTime;
double TimeLimit;
double ElapsedTime = 0.0;
FONT_SIZE = 11;
if ((i % 20 == 0) && (Mode == 2)) MakeMainHandle();
else if ((i == 15) && (Mode != 2))MakeMainHandle();
ANSWER_X = 50;
ANSWER_Y = 80;
TIMELIMIT = 10000;
TimeLimit = 10000.0;
len = GetStringLength(InputAnswer[now]);
if (len >= 20)
{
TIMELIMIT = TIMELIMIT + (int)(len * 0.3 * 1000);
TimeLimit = (double)TIMELIMIT;
}
ClsDrawScreen();
SetFontSize(20);
DrawFormatString(50, 30, BLACK, "%s", Answer[now]);
DrawFormatString(50, 80, BLACK, "%s", InputAnswer[now]);
DrawFormatString(500, 420, BLACK, "%d / %d", i+1, Number);
DrawExtendGraph(10, 200, 380, 450, MainHandle, TRUE);
DrawExtendGraph(450, 100, 600, 250, Syokupankun, TRUE);
StartTime = GetNowCount();
for (j = 0; j < len; j++)
{
if (ProcessMessage() != 0)return -1;
Typing[0] = GetInputChar(TRUE);
Typing[1] = '\0';
if (Typing[0] != '\0' && Typing[0] >= CTRL_CODE_CMP && TimeLimit > 0.0)
{
if (Typing[0] != InputAnswer[now][j])
{
miss++;
if (Mode == 1)
{
Typing[0] = InputAnswer[now][j];
DrawStringToHandle(50, 130, "OUT!!", RED, FontHandle);
DrawExtendGraph(10, 200, 380, 450, OutHandle, TRUE);
DrawStringToHandle(ANSWER_X + j * FONT_SIZE, ANSWER_Y, Typing, RED, FontHandle);
ElapsedTime = (float)CurrentTime / 1000;
totalTime += ElapsedTime;
Nowtotal = miss + Hit;
total += Nowtotal;
return -1;
}
Typing[0] = InputAnswer[now][j];
DrawExtendGraph(10, 200, 380, 450, MissHandle, TRUE);
DrawStringToHandle(ANSWER_X + j * FONT_SIZE, ANSWER_Y, Typing, RED, FontHandle);
j--;
DrawStringToHandle(50, 130, "落ち着いて!!", RED, FontHandle);
DrawStringToHandle(500, 300, "-1秒", RED, FontHandle);
TimeLimit -= 1.0;
WaitTimer(1000);
ClearInputCharBuf();
DrawBox(500, 300, 600, 400, WHITE, TRUE);
DrawBox(50, 100, 450, 150, WHITE, TRUE);
DrawExtendGraph(10, 200, 380, 450, MainHandle, TRUE);
}
else
{
Hit++;
// 正解時の画像を表示
DrawExtendGraph(10, 200, 380, 450, MainHandle, TRUE);
DrawStringToHandle(ANSWER_X + j * FONT_SIZE, ANSWER_Y, Typing, LIGHTBLUE, FontHandle);
}
}
else if(Typing[0] == '\0') j--;
// 制限時間
NowTime = GetNowCount();
CurrentTime = NowTime - StartTime;
TimeLimit = (float)(TIMELIMIT - CurrentTime)/1000;
DrawBox(500, 350, 639, 400, WHITE, TRUE);
DrawFormatString(500, 350, BLACK, "%.3f", TimeLimit);
if (TimeLimit < 0.0)
{
DrawBox(500, 350, 639, 400, WHITE, TRUE);
DrawString(500, 350, "0.0", RED, TRUE);
DrawStringToHandle(50, 130, "OUT!!", RED, FontHandle);
DrawExtendGraph(10, 200, 380, 450, OutHandle, TRUE);
ElapsedTime = (float)CurrentTime/1000;
totalTime += ElapsedTime;
Nowtotal = miss + Hit;
total += Nowtotal;
return -1;
}
WaitTimer(1);
}
ElapsedTime = (float)CurrentTime / 1000;
totalTime += ElapsedTime;
Nowtotal = Hit + miss;
total += Nowtotal;
Correct++;
if (i == (Number -1 ))
{
DrawExtendGraph(10, 200, 380, 450, ClearHandle, TRUE);
DrawStringToHandle(50, 130, "Clear!!", YELLOW, FontHandle);
clear = 1;
}
WaitTimer(200);
ScreenFlip();
return 0;
}