ホーム画面(main(void))でゲームの画面(game(void))に行こうとすると
突然止まります
問題点と解決策がわからないので教えてください
#include "DxLib.h"
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "exofb.h"
int Key[256];
int font = CreateFontToHandle( "メイリオ",70,3,DX_FONTTYPE_ANTIALIASING_EDGE);
int game(void);
int chu(void);
int extra(void);
int help(void);
int option(void);
int GpUpDateKey(){
char tmpKey[256];
GetHitKeyStateAll(tmpKey);
for (int i=0; i<256; i++ ){
if(tmpKey[i] != 0){
Key[i]++;
} else {
Key[i] = 0;
}
}
return 0;
}
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){
ChangeWindowMode(TRUE);
DxLib_Init();
MenuElement_t MenuElement[5]={
{ 80, 100, "ゲームスタート" },
{ 100, 150, "おまけ" },
{ 100, 200, "ヘルプ" },
{ 100, 250, "コンフィグ" },
{ 100, 300, "ゲーム終了" },
};
int SelectNum = 0;
while( ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && GpUpDateKey()==0 ){
if( Key[ KEY_INPUT_DOWN ] == 1 ){
SelectNum = ( SelectNum + 1 ) % 5;
}
if( Key[ KEY_INPUT_UP ] == 1 ){
SelectNum = ( SelectNum + 4 ) % 5;
}
if( Key[ KEY_INPUT_DOWN ] == 1 || Key[ KEY_INPUT_UP ] == 1 ){
for( int i=0; i<5; i++ ){
if( i == SelectNum ){
MenuElement[i].x = 80;
} else {
MenuElement[i].x = 100;
}
}
}
for( int i=0; i<5; i++ ){
DrawFormatString( MenuElement[i].x, MenuElement[i].y, GetColor(255,255,255), MenuElement[i].name );
}
if( Key[KEY_INPUT_RETURN] != 0 ){
switch(SelectNum%5){
default:
exit(0);
break;
case 0:
game();
break;
case 1:
extra();
break;
case 2:
help();
break;
case 3:
option();
break;
}
}
}
DxLib_End();
return 0;
}
int game(void){
DrawBox( 0, 0, 320, 240, GetColor( 255,0,0 ), TRUE ) ;
DrawFormatStringToHandle(20,120,GetColor(255,255,255),font,"READY?") ;
DrawBox( 320, 0, 640, 240, GetColor( 0,0,255 ), TRUE ) ;
DrawBox( 0, 240, 320, 480, GetColor( 0,200,0 ), TRUE ) ;
DrawBox( 320, 240, 640, 480, GetColor( 255,0,255 ), TRUE ) ;
while(Key[ KEY_INPUT_Q ] == 0){
if( Key[ KEY_INPUT_Q ] == 1 ){chu();}
}
return 0;
}
int chu(void){
int jadge = 0;
while(jadge == 0){
double size = 1.0;
int omo[4] = {0};
int shitei = 0;
int x = 1;
omo[0],omo[1],omo[2],omo[3],shitei = lod(x);
DrawBox( 0, 0, 320, 240, GetColor( 255,0,0 ), TRUE ) ;
DrawBox( 320, 0, 640, 240, GetColor( 0,0,255 ), TRUE ) ;
DrawBox( 0, 240, 320, 480, GetColor( 0,200,0 ), TRUE ) ;
DrawBox( 320, 240, 640, 480, GetColor( 255,0,255 ), TRUE ) ;
DrawFormatStringToHandle(20,120,GetColor(255,255,255),font,"%d",omo[0]) ;
DrawFormatStringToHandle(340,120,GetColor(255,255,255),font,"%d",omo[1]) ;
DrawFormatStringToHandle(20,360,GetColor(255,255,255),font,"%d",omo[2]) ;
DrawFormatStringToHandle(340,360,GetColor(255,255,255),font,"%d",omo[3]) ;
if( Key[ KEY_INPUT_Q ] == 1 ){
if(shitei = 0){
x++;
}else{
DrawBox( 0, 0, 639, 479, GetColor( 0,0,0 ), TRUE ) ;
DrawStringToHandle( 200, 160, "GAME OVER", GetColor(255,255,255), font );
jadge++;
}
}
if( Key[ KEY_INPUT_P ] == 1 ){
if(shitei = 1){
x++;
}else{
DrawBox( 0, 0, 639, 479, GetColor( 0,0,0 ), TRUE ) ;
DrawStringToHandle( 200, 160, "GAME OVER", GetColor(255,255,255), font );
jadge++;
}
}
if( Key[ KEY_INPUT_C ] == 1 ){
if(shitei = 2){
x++;
}else{
DrawBox( 0, 0, 639, 479, GetColor( 0,0,0 ), TRUE ) ;
DrawStringToHandle( 200, 160, "GAME OVER", GetColor(255,255,255), font );
jadge++;
}
}
if( Key[ KEY_INPUT_M ] == 1 ){
if(shitei = 3){
x++;
}else{
DrawBox( 0, 0, 639, 479, GetColor( 0,0,0 ), TRUE ) ;
DrawStringToHandle( 200, 160, "GAME OVER", GetColor(255,255,255), font );
jadge++;
}
}
}
return 0;
}
int extra(void){
return 0;
}
int help(void){
return 0;
}
int option(void){
return 0;
}
そして自作のexofb.hは
typedef enum {
eScene_Menu,
eScene_Game,
eScene_Config,
} eScene ;
typedef struct{
int x, y; // 座標格納用変数
char name[128]; // 項目名格納用変数
} MenuElement_t ;
int lod(double custom){ //customで2^xのxを得る
int kae[4] = {0}; //
int kaem[10] = {0};//同じ数を付けないようにするためのロック変数
int ransu; //
int count = 0;
int checkok = 0;
int redm = 0;
int lucky;
custom = pow(2,custom); //ここで2^xの形にする
SRand((unsigned int)time(NULL));
while(checkok!=0){
while(count <= 3){
ransu = GetRand(9);
switch(ransu){
default:
break;
case 0:
if(kaem[0]=0){
kae[count] = custom;
lucky = count;
count++;
kaem[0]++;
}
break;
case 1:
if(kaem[1]=0,custom!=1){
kae[count] = custom+2;
count++;
kaem[1]++;
}
break;
case 2:
if(kaem[2]=0,custom>=2){
kae[count] = custom-2;
count++;
kaem[2]++;
}
break;
case 3:
if(kaem[3]=0){
kae[count] = custom-6;
count++;
kaem[3]++;
}
break;
case 4:
if(kaem[4]=0){
kae[count] = custom+72;
count++;
kaem[4]++;
}
break;
case 5:
if(kaem[5]=0){
kae[count] = custom*6;
count++;
kaem[5]++;
}
break;
case 6:
if(kaem[6]=0,custom>=6){
kae[count] = custom-28;
count++;
kaem[6]++;
}
break;
case 7:
if(kaem[7]=0){
kae[count] = custom+10;
count++;
kaem[7]++;
}
break;
case 8:
if(kaem[8]=0){
kae[count] = custom-1;
count++;
kaem[8]++;
}
break;
case 9:
if(kaem[9]=0){
kae[count] = custom+1;
count++;
kaem[9]++;
}
break;
}
}
if(kaem[0]=0){
count = 0;
while(redm <= 9){
kaem[redm] = 0;
redm++;
}
}else{
checkok++;
}
}
return kae[0],kae[1],kae[2],kae[3],lucky;
}