yumson-17と申します。
早速、質問なんですが、
エンターが押されてから、5秒後と10秒後に効果音を鳴らすようなプログラムを考えているのですが、音が鳴りません。
自分で考えたプログラムは、
#include"DxLib.h"
int White = GetColor(255,255,255);
int Key[256];
int StartTime , Time;
int GetHitKeyStateAll_2(int GetHitKeyStateAll_InputKey[]){
char GetHitKeyStateAll_Key[256];
GetHitKeyStateAll( GetHitKeyStateAll_Key );
for(int i=0;i<256;i++){
if(GetHitKeyStateAll_Key[i]==1) GetHitKeyStateAll_InputKey[i]++;
else GetHitKeyStateAll_InputKey[i]=0;
}
return 0;
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
ChangeWindowMode(TRUE);
if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;
int Sound1 = LoadSoundMem("test1.mp3");
int Sound2 = LoadSoundMem("test2.mp3");
while(ProcessMessage()==0 && ClearDrawScreen()==0 && GetHitKeyStateAll_2(Key)==0 && Key[KEY_INPUT_ESCAPE]==0){
if(Key[KEY_INPUT_RETURN]==1){
StartTime = GetNowCount();
}
Time = GetNowCount() - StartTime;
if(Time == 5000){
PlaySoundMem( Sound1 , DX_PLAYTYPE_BACK );
}
if(Time == 10000){
PlaySoundMem( Sound2 , DX_PLAYTYPE_BACK );
}
ScreenFlip();
}
DxLib_End();
return 0;
}
よろしくお願いします。