タイトル画面で"GameStart","Option","quit"というコマンドを準備し
上下キーを押すことでコマンドを選択し、そのコマンドが明るくなるというコードを書きたいのですが
①負の数の剰余ができないようで上キーを押しても"GameStart"から"Quit"への移動ができない
②下キーを一度おしても移動ができない。押しっぱなしにすると動くのですが。
③いろいろいじっているうちに、いつの間にか音楽が再生されなくなりました。なぜでしょうか?
以上よろしくお願いいたします。本当に困っています。どうか助けてください。
while(ProcessMessage()==0){ ClsDrawScreen(); switch(game_state){ case 0://タイトル LoadGraphScreen(0,0,"dat/title.png",FALSE); PlaySound("dat/closedover.mp3",DX_PLAYTYPE_BACK); SetDrawBright(256,256,256); LoadGraphScreen(360,260,"dat/gamestart.png",TRUE); SetDrawBright(128,128,128); LoadGraphScreen(360,315,"dat/option.png",TRUE); LoadGraphScreen(355,375,"dat/quit.png",TRUE); SetDrawBright(256,256,256); if(CheckHitKey(KEY_INPUT_DOWN)==1)i++; if(CheckHitKey(KEY_INPUT_UP)==1)i--; i=i%3; if(i==0){ SetDrawBright(256,256,256); LoadGraphScreen(360,260,"dat/gamestart.png",TRUE); SetDrawBright(128,128,128); LoadGraphScreen(360,315,"dat/option.png",TRUE); LoadGraphScreen(360,375,"dat/quit.png",TRUE); SetDrawBright(256,256,256); } if(i==1){ SetDrawBright(128,128,128); LoadGraphScreen(360,260,"dat/gamestart.png",TRUE); SetDrawBright(256,256,256); LoadGraphScreen(360,315,"dat/option.png",TRUE); SetDrawBright(128,128,128); LoadGraphScreen(360,375,"dat/quit.png",TRUE); SetDrawBright(256,256,256); } if(i==2){ SetDrawBright(128,128,128); LoadGraphScreen(360,260,"dat/gamestart.png",TRUE); LoadGraphScreen(360,315,"dat/option.png",TRUE); SetDrawBright(256,256,256); LoadGraphScreen(360,375,"dat/quit.png",TRUE); SetDrawBright(256,256,256); } printfDx("i=%d",i); ScreenFlip(); break; ScreenFlip(); } DxLib_End(); return 0; }