画面をクリアする処理を挟むと高速で点滅を繰り返して見づらいことこの上無く
描画する画像を増やした瞬間目に見えて処理が重くなります。
描画処理に問題があるのかFPSがうまく制御できてないのか原因に見当がつかずお手上げです。
どなたかアドバイスお願いします。
int wait(){//ここでFPS制御
static DWORD lasttime=0;
DWORD time=timeGetTime();
if(FPS>(time-lasttime)){
Sleep(FPS-(time-lasttime));
}
lasttime=time;
return 0;
}
int oGameMain(class Graphic *app){
static int mode=INITIAL;
static unit *hoge=NULL;
for(;app->RunMessageLoop();){
switch (mode){
case INITIAL:{
//unit hoge(app);
hoge = new unit(app);
mode = MAIN;
}
break;
case MAIN:
GetKey(hoge);
app->ClearScreen();
app->paint(hoge->Graphic, hoge->x,hoge->y);
app->paint(hoge->Graphic, hoge->x+50,hoge->y);
//app->paint(hoge->Graphic, hoge->x-50,hoge->y);
//mode=END;//仮置き
wait();
break;
case END:
return 0;
break;
}
}
return 0;
}