トップページ > 過去ログ > 記事閲覧
ゲームウィンドウが表示されません
名前:みっちー 日時: 2011/06/18 11:14

デバックまたはリリースでプログラムを実行してもゲーム画面がいつまっでたってもたちあがらないです ソースのせますので見ていただけますか void MyMain(){ int o=0; for(int i=0;i<15;i++){//iイコール敵機の数 敵機セット ENEMYPOS *a=&enemynumber[i]; if(a->use==TRUE){ if((direction<=a->x) &&((direction+640)>=a->x)){ float p=5.f/5000.f; //拡大率 p=p*(a->z); float posx=a->x-direction; DrawAnimation(posx,250,p,0,0,&image[3],0,0); o++; }//範囲外は描画しない mainfighter(a);//enemyposに自機ベクトルを足す addvectorpos(a);//enemyposにベクトル合成 if((a->x)<0||(a->z)>5000||(a->x)>1920)a->use=FALSE; } else{ enemy(a);//敵ランダム表示 } } if(o==0){ int col=GetColor(128,128,128); DrawBox(640,480,640,480,col,TRUE); } int key = GetJoypadInputState( DX_INPUT_KEY_PAD1 ); if (key & PAD_INPUT_RIGHT){ direction+=10; if(direction>=1280)direction=1280; } if (key & PAD_INPUT_LEFT){ direction-=10; if(direction<=0)direction=0; } } void enemy(ENEMYPOS *a)//敵機ランダム表示for maimain.cpp { a->use=TRUE; (a->x)=GetRand(1920);//enemy pos (a->z)=0;//enemy position (a->angle)=GetRand(180);//enemy direction (a->speed)=GetRand(100)+50; /////////////////////////////////////////////////////////////////// if((a->angle==0)||(a->angle==180)){ //0deg=-,180deg=+ if(a->angle==0)a->vector.x=-(a->speed); else a->vector.x=(a->speed); a->vector.y=0; } if((a->angle>0)&&(a->angle<90)){ a->vector.y=(sin((float)(a->angle)*(a->speed))); a->vector.x=-(cos((float)(a->angle)*(a->speed))); } if(a->angle==90){ a->vector.x=0.f; a->vector.y=(a->speed); } if((a->angle>90)&&(a->angle<180)) { a->vector.y=(sin((float)(a->angle)*(a->speed))); a->vector.x=-(cos((float)(a->angle)*(a->speed))); } } //enemyposに自機ベクトルを足す void mainfighter(ENEMYPOS *a){ float c=50.f;//速さ50 float b=c/960;//1あたりのヴェクトル if(a->x==960){ a->z=(a->z)+c*g_frametime; } if(a->x==0||a->x==1920){ if(a->x==0)a->x=a->x-c*g_frametime; else a->x=a->x+c*g_frametime; } if((a->x)>960&&(a->x)<1920){ float f=((a->x)-960)*b; a->x=(a->x)+f*g_frametime;//X float s=(960-((a->x)-960))*b; a->z=(a->z)+s*g_frametime;//Z } if((a->x)>0&&(a->x)<960){ float u=(a->x)*b; a->z=(a->z)+u*g_frametime;//Z float v=(960-(a->x))*b; a->x=(a->x)-v*g_frametime;//X } } void addvectorpos(ENEMYPOS *a){ a->x=a->x+(a->vector.x); a->z=a->z+(a->vector.y); } Allpurence AddVectorInFrameTime(Allpurence pos, Allpurence speed){//サンプルコード Allpurence result; result.x = pos.x + speed.x * g_frametime; result.y = pos.y + speed.y * g_frametime; return result; } //そのX座標版とY座標版 int XInView(float inx){ return (int)(inx - 0); } int YInView(float iny){ return (int)(iny - 0); } void DrawAnimation(float x, float y, double ExtRate, double Angle,int TurnFlag, int *imgarray, int allframe, float fps){ //現在の経過秒数を求める float t = (float)( GetNowCount() & INT_MAX ); //表示すべきコマ数を求める int animpat = (int)(t/(1000/fps)) % allframe; //そのコマを描画 DrawRotaGraph(XInView(x),YInView(y), ExtRate, Angle, imgarray[animpat], TRUE, TurnFlag); }

Page: 1 |

Re: ゲームウィンドウが表示されません ( No.1 )
名前:いっち 日時:2011/06/18 12:37

通常、DxLib_Init が成功した時点でウィンドウが表示されます。 ウィンドウが全く表示されないのであれば DxLib_Init までの処理をまずはご確認下さい。
Re: ゲームウィンドウが表示されません ( No.2 )
名前:みっちー 日時:2011/06/18 14:23

Dx_Lib_Initで画面表示できました ありがとうございます

Page: 1 |