07/12/31 18:08:38 dm1WMiLE
>>24
fpsはどれくらいでるの?
#include "DxLib.h"
void show_fps()
{
static int frame = 0;
static DWORD dwLastTime = timeGetTime();
DWORD dwTime = timeGetTime();
if(dwTime - dwLastTime >= 1000) {
char str[128];
sprintf(str, "%.1lf", frame*1000.0/(dwTime - dwLastTime));
SetWindowText(str);
frame = 0, dwLastTime = dwTime;
}
frame++;
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
char key[256];
int x=100,y=100,dx=1;
ChangeWindowMode(TRUE);
SetDrawScreen( DX_SCREEN_BACK ) ;
if(DxLib_Init()==-1) return-1;
while(!ProcessMessage() && !ClearDrawScreen() && !GetHitKeyStateAll(key) && key[KEY_INPUT_ESCAPE]==0){
x += dx;
if(x<=0 || x>=540) dx = -dx;
DrawBox(x,y,x+100,y+100,GetColor(255,255,255),TRUE);
ScreenFlip() ;
show_fps();
}
DxLib_End();
return 0;
}