この間当たり判定で質問させて頂いたものですがvisual studio 2010で下記のソースをビルドするとちゃんと動くのですが、できたexeファイルを実行してもfpsが表示されるだけで弾も自機も表示されなくて調べても原因が分からなかったので質問させて頂きました。ソースは下記のものです
#include <DxLib.h>
#include <math.h>
int count = 0;
typedef struct{
float x,y;
int direction,speed;
int img ;
} ch_t , aodama ;
void fps(){
int i;
static int t=0,ave=0,f[60];
f[count%60]=GetNowCount()-t;
t=GetNowCount();
if(count%60==59){
ave=0;
for(i=0;i<60;i++)
ave+=f[i];
ave/=60;
}
if(ave!=0){
DrawFormatString(550, 450,GetColor(255,255,255),"%.1fFPS",1000.0/(double)ave);
}
return;
}
inline RECT GetRect( int x1, int y1, int x2, int y2 ) {
RECT rc;
rc.left = x1; rc.top = y1; rc.right = x2; rc.bottom = y2;
return rc;
}
inline bool HitCheckRect( const RECT& r1, const RECT& r2 ) {
return ((r1.left <= r2.right) && (r2.left < r1.right) && (r1.top <= r2.bottom) && (r2.top < r1.bottom));
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
char Key[256];
aodama aodama[300];
int hayasa = 3;
int num = 0,x,y;
if( ChangeWindowMode(TRUE) != DX_CHANGESCREEN_OK || DxLib_Init() == -1 ) return -1;
float fsin[360],fcos[360];
int i;
for(i=0;i<360;i++)
{
fsin[i]=(float)sin(i*3.1415926535/180);
fcos[i]=(float)cos(i*3.1415926535/180);
}
for(i=0;i<100;i++)
{
aodama[i].direction=-1;
}
SetDrawScreen( DX_SCREEN_BACK ) ;
int GrHandle ;
GrHandle = LoadGraph( "aodama.bmp" ) ;
ChangeWindowMode( TRUE ) ;
if( DxLib_Init() == -1 ) return -1 ;
int image;
ch_t ch;
image = LoadGraph( "ziki.png" ) ;
ch.x =320;
ch.y =440;
DrawGraph( 0 , 0 , image , FALSE ) ;
int ziki_w, ziki_h, aodama_w, aodama_h;
GetGraphSize( image, &ziki_w, &ziki_h );
GetGraphSize( GrHandle, &aodama_w, &aodama_h );
while(!ProcessMessage() && !ClearDrawScreen() && !GetHitKeyStateAll( Key ) && !Key[KEY_INPUT_ESCAPE]){
{
hayasa=+1;
if( Key[ KEY_INPUT_RIGHT ] == 1 )
ch.x++ ;
if(ch.x>590.0)
ch.x=590.0;
{if( Key[ KEY_INPUT_LEFT ] == 1 )
ch.x-- ;
{if(ch.x<10.0)
ch.x=10.0;
} }
if( Key[ KEY_INPUT_UP ] == 1 )
ch.y-- ;
if(ch.y<15.0)
ch.y=15.0;
if( Key[ KEY_INPUT_DOWN ] == 1 )
ch.y++ ;
if(ch.y>420.0)
ch.y=420.0;
ch.img=image;
DrawGraph( ch.x , ch.y , ch.img , TRUE ) ;
}
for(i=0;i<100;i++)
{
if(aodama[i].direction==-1)
{
aodama[i].direction=num;
aodama[i].x=320;
aodama[i].y=0;
aodama[i].speed=hayasa;
num+=17;
num%=360;
hayasa +=3;
hayasa %=10;
if(hayasa==0)
{
hayasa= 2;
}
}
else
{
aodama[i].x += (fcos[aodama[i].direction]) * (float)aodama[i].speed;
aodama[i].y += (fsin[aodama[i].direction]) * (float)aodama[i].speed;
if(aodama[i].x>639||aodama[i].x<0||aodama[i].y>479||aodama[i].y<0)
{
aodama[i].direction=-1;
}
}
if(aodama[i].direction>-1)
{
x=(int)aodama[i].x;
y=(int)aodama[i].y;
DrawGraph( x , y , GrHandle , TRUE ) ;
}
}
for ( i = 0; i < 100; i++ ) {
if ( aodama[i].direction == -1 )
continue;
if (
HitCheckRect(
GetRect( (int)ch.x, (int)ch.y, (int)ch.x + ziki_w, (int)ch.y + ziki_h ),
GetRect( (int)aodama[i].x, (int)aodama[i].y, (int)aodama[i].x + aodama_w, (int)aodama[i].y + aodama_h )
)
) {
WaitKey();
return 0;
}
}
fps();
count++;
ScreenFlip();
}
WaitKey();
DxLib_End();
return 0;
}
もう一度言いますとビルドは普通にできますが、その時できたexeで起動するとfpsだけしか表示されないのです。