#2
by prog » 8ヶ月前
こちらのようなシンプルなFPS表示プログラムでもFPSが45前後になってしまうのでしょうか?
コード:
#include "DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
// ウインドウモードで起動
ChangeWindowMode( TRUE );
// 画面解像度を設定
SetGraphMode( 1280, 800, 32 );
// VSYNC待ちをしない
SetWaitVSyncFlag( FALSE );
// DXライブラリの初期化
if( DxLib_Init() < 0 ) return -1;
// 描画先を裏画面にする
SetDrawScreen( DX_SCREEN_BACK );
// 変数初期化
int Time = GetNowCount();
int Counter = 0;
int FPS = 0;
// メインループ
while( ProcessMessage() == 0 )
{
// 画面初期化
ClearDrawScreen();
// 画面にFPSを表示する
DrawFormatString( 0, 0, GetColor( 255,255,255 ), "FPS:%d", FPS );
// 裏画面の内容を表画面に反映
ScreenFlip();
// FPSの処理
Counter++;
int Time2 = GetNowCount();
if( Time2 - Time >= 1000 )
{
FPS = Counter;
Counter = 0;
Time = Time2;
}
}
// DXライブラリの後始末
DxLib_End();
// ソフトの終了
return 0;
}
こちらのようなシンプルなFPS表示プログラムでもFPSが45前後になってしまうのでしょうか?
[code]
#include "DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
// ウインドウモードで起動
ChangeWindowMode( TRUE );
// 画面解像度を設定
SetGraphMode( 1280, 800, 32 );
// VSYNC待ちをしない
SetWaitVSyncFlag( FALSE );
// DXライブラリの初期化
if( DxLib_Init() < 0 ) return -1;
// 描画先を裏画面にする
SetDrawScreen( DX_SCREEN_BACK );
// 変数初期化
int Time = GetNowCount();
int Counter = 0;
int FPS = 0;
// メインループ
while( ProcessMessage() == 0 )
{
// 画面初期化
ClearDrawScreen();
// 画面にFPSを表示する
DrawFormatString( 0, 0, GetColor( 255,255,255 ), "FPS:%d", FPS );
// 裏画面の内容を表画面に反映
ScreenFlip();
// FPSの処理
Counter++;
int Time2 = GetNowCount();
if( Time2 - Time >= 1000 )
{
FPS = Counter;
Counter = 0;
Time = Time2;
}
}
// DXライブラリの後始末
DxLib_End();
// ソフトの終了
return 0;
}
[/code]