コード:
time_t t;
time_t FFF;
time_t GDS,SSK,GPSD;
time_t time(time_t *timer);time_t ppp1,ppp2,ppp3;
・・・(この間、省略します)
//時間取得
SSK=time(&t);
FFF=SSK%60;
SSK-=FFF;
SSK=SSK/60;
GDS=SSK%60;
SSK-=GDS;
SSK=SSK/60;
GPSD=SSK%24-3;
ppp1=GPSD;
ppp2=GDS;
ppp3=FFF;
//マウスポインタの座標を取得
GetMousePoint( &posX, &posY );
for(int il=0;il<=3;++il){
switch(il){
case 1:
if(posX<=600&&posX>=15&&posY<=180&&posY>=60){
if(Data1==0){DrawBox(15,60,600,180,Cr8, TRUE ) ;
DrawString( 259 , 105, "Not Data" , Cr7 );}
if(Data1==1){DrawBox(15,60,600,180,Cr8, TRUE ) ;
DrawFormatString( 35 , 80, Cr7,"Lv.%d",My_Lv1);
DrawFormatString(35,140,Cr7,"%d:",ppp1);
DrawFormatString(55,140,Cr7,"%d:",ppp2);
DrawFormatString(85,140,Cr7,"%d",ppp3);
}
}
break;
case 2:
if(posX<=600&&posX>=15&&posY<=350&&posY>=230){
if(Data2==0){DrawBox(15,230,600,350,Cr8, TRUE ) ;
DrawString( 259 , 275, "Not Data" , Cr7 );}
if(Data2==1){DrawBox(15,230,600,350,Cr8, TRUE ) ;
DrawFormatString( 35 , 250, Cr7,"Lv.%d",My_Lv2);
}
}
break;
case 3:
if(posX<=600&&posX>=15&&posY<=520&&posY>=400){
if(Data3==0){DrawBox(15,400,600,520,Cr8, TRUE ) ;
DrawString( 259 , 445, "Not Data" , Cr7 );}
if(Data3==1){DrawBox(15,400,600,520,Cr8, TRUE ) ;
DrawFormatString( 35 , 420, Cr7,"Lv.%d",My_Lv3);
}
}
break;
default:
if(Data1==0){DrawBox(15,60,600,180,Cr3, TRUE ) ;
DrawString( 259 , 105, "Not Data" , Cr7 );
}
if(Data2==0){DrawBox(15,230,600,350,Cr3, TRUE ) ;
DrawString( 259 , 275, "Not Data" , Cr7 );
}
if(Data3==0){DrawBox(15,400,600,520,Cr3, TRUE ) ;
DrawString( 259 , 445, "Not Data" , Cr7 );
}
if(Data1==1){DrawBox(15,60,600,180,Cr3, TRUE ) ;
DrawFormatString( 35 , 80, Cr7,"Lv.%d",My_Lv1);
DrawFormatString(35,140,Cr7,"%d:",ppp1);
DrawFormatString(55,140,Cr7,"%d:",ppp2);
DrawFormatString(85,140,Cr7,"%d",ppp3);
}
if(Data2==1){DrawBox(15,230,600,350,Cr3, TRUE ) ;
DrawFormatString( 35 , 250, Cr7,"Lv.%d",My_Lv2);
}
if(Data3==1){DrawBox(15,400,600,520,Cr3, TRUE ) ;
DrawFormatString( 35 , 420, Cr7,"Lv.%d",My_Lv3);
}
}
}
if(( GetMouseInput() & MOUSE_INPUT_LEFT )!=0){
for(int oi=0;oi<=3;++oi){
switch(oi){
case 1:
if(posX<=600&&posX>=15&&posY<=180&&posY>=60){
DrawFormatString( 35 , 80, Cr7,"Lv.%d",My_Lv);
Data1=1;My_Lv1=My_Lv;
ppp1=GPSD;
ppp2=GDS;
ppp3=FFF;
fstream file;
file.open("セーブデータ/セーブデータ1.txt", ios::out);
if(! file.is_open()){
return EXIT_FAILURE;
}
file<<My_Lv<<endl;//自分のLv
file<<NPC_Lv<<endl;//相手のLv
file<<MNY<<endl;//お金の残量
file<<My_EXE<<endl;//経験値
file<<p1.HP<<p1.SP<<p1.Striking<<p1.Defense<<p1.Velocity<<p1.SpiritualStrength<<p1.Intellect<<p1.AccuracyOfFire<<endl;//自分の設定値
file<<p2.HP<<p2.SP<<p2.Striking<<p2.Defense<<p2.Velocity<<p2.SpiritualStrength<<p2.Intellect<<p2.AccuracyOfFire<<endl;//相手の設定値
file<<x<<y<<endl;
file<<SSTurn<<endl;
file<<Point<<endl;
file<<My_Lv1<<Data1<<endl;
file.close();
}
break;
case 2:
if(posX<=600&&posX>=15&&posY<=350&&posY>=230){
DrawFormatString( 35 , 250, Cr7,"Lv.%d",My_Lv);
Data2=1;My_Lv2=My_Lv;
DrawFormatString(35,140,Cr7,"%d:",GPSD);
DrawFormatString(55,140,Cr7,"%d:",GDS);
DrawFormatString(85,140,Cr7,"%d",FFF);
fstream file;
file.open("セーブデータ/セーブデータ2.txt", ios::out);
if(! file.is_open()){
return EXIT_FAILURE;
}
file<<My_Lv<<endl;//自分のLv
file<<NPC_Lv<<endl;//相手のLv
file<<MNY<<endl;//お金の残量
file<<My_EXE<<endl;//経験値
file<<p1.HP<<p1.SP<<p1.Striking<<p1.Defense<<p1.Velocity<<p1.SpiritualStrength<<p1.Intellect<<p1.AccuracyOfFire<<endl;//自分の設定値
file<<p2.HP<<p2.SP<<p2.Striking<<p2.Defense<<p2.Velocity<<p2.SpiritualStrength<<p2.Intellect<<p2.AccuracyOfFire<<endl;//相手の設定値
file<<x<<y<<endl;
file<<SSTurn<<endl;
file<<Point<<endl;
file<<My_Lv2<<Data2<<endl;
file.close();
}
break;
case 3:
if(posX<=600&&posX>=15&&posY<=520&&posY>=400){
DrawFormatString( 35 , 420, Cr7,"Lv.%d",My_Lv);
Data3=1;My_Lv3=My_Lv;
DrawFormatString(35,140,Cr7,"%d:",GPSD);
DrawFormatString(55,140,Cr7,"%d:",GDS);
DrawFormatString(85,140,Cr7,"%d",FFF);
fstream file;
file.open("セーブデータ/セーブデータ3.txt", ios::out);
if(! file.is_open()){
return EXIT_FAILURE;
}
file<<My_Lv<<endl;//自分のLv
file<<NPC_Lv<<endl;//相手のLv
file<<MNY<<endl;//お金の残量
file<<My_EXE<<endl;//経験値
file<<p1.HP<<p1.SP<<p1.Striking<<p1.Defense<<p1.Velocity<<p1.SpiritualStrength<<p1.Intellect<<p1.AccuracyOfFire<<endl;//自分の設定値
file<<p2.HP<<p2.SP<<p2.Striking<<p2.Defense<<p2.Velocity<<p2.SpiritualStrength<<p2.Intellect<<p2.AccuracyOfFire<<endl;//相手の設定値
file<<x<<y<<endl;
file<<SSTurn<<endl;
file<<Point<<endl;
file<<My_Lv3<<Data3<<endl;
file.close();
}
break;
}
}
}