SDXFrameWork 0.10 SDXFrameWork

- Main Page
- Related Pages
- Classes

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Static Public Member Functions | List of all members
SDX::Time Class Reference

時間と日付を取得する関数群. More...

`#include <Time.h>`

## Static Public Member Functions
static void | ResetCount ()
| 時間の初期化. More...
static double | GetNowCount ()
| リセット後の経過時間のミリ秒で取得(小数点以下). More...
static void | GetDate (tm *現在時刻)
| 日付を取得. More...
static double | GetFPS ()
| FPSを取得. More...
static void | ResetFPS ()
| FPSの計測開始. More...
static void | CheckFPS ()
| FPS計測を更新. More...
static void | StartWatch ()
| 処理時間計測開始. More...
static void | DrawWatch (const Point &座標, const char *描画文字列)
| 処理時間計測終了. More...

## Detailed Description

時間と日付を取得する関数群.

わりと標準ライブラリで良い感じはある.

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//時間を取得したり計測する
#include <SDXFramework.h>
bool SampleTime()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
Time::ResetFPS();
Time::ResetCount();
int count = 0;
while (System::Update())
{
count++;
Time::CheckFPS();//FramePerSecondを更新
Drawing::String({ 10, 10 }, Color::White, { "FPS:", Time::GetFPS(), "\nNow:", Time::GetNowCount() });
tm date;
Time::GetDate(&date);
Drawing::String({ 10, 100 }, Color::White, { date.tm_year + 1900, "年 ", date.tm_mon + 1, "月 ", date.tm_mday, "日" });
Time::StartWatch();//処理時間の計測開始
for (int a = 0; a < 100; ++a)
{
Drawing::Circle({ 200, 100, 20 }, Color::White , 5);
}
Time::DrawWatch({ 10, 220 }, "○描画100回の処理時間:");
for (int a = 0; a < 100; ++a)
{
Drawing::Rect({ 210, 110, 40 ,40}, Color::White,true);
}
Time::DrawWatch({ 10, 240 }, "□描画100回の処理時間:");
if (Input::key.Return.on){ break;}//Enterで終了
}
System::End();
return true;
}

## Member Function Documentation

static void SDX::Time::ResetCount | ( |  | ) |
| static

時間の初期化.

static double SDX::Time::GetNowCount | ( |  | ) |
| static

リセット後の経過時間のミリ秒で取得(小数点以下).

static void SDX::Time::GetDate | ( | tm * | 現在時刻 | ) |
| static

日付を取得.

static double SDX::Time::GetFPS | ( |  | ) |
| static

FPSを取得.

static void SDX::Time::ResetFPS | ( |  | ) |
| static

FPSの計測開始.

static void SDX::Time::CheckFPS | ( |  | ) |
| static

FPS計測を更新.

static void SDX::Time::StartWatch | ( |  | ) |
| static

処理時間計測開始.

static void SDX::Time::DrawWatch | ( | const Point & | 座標,
|  | const char * | 描画文字列
| ) |  |
| static

処理時間計測終了.

StartWatchからの経過時間をミリ秒単位で描画
続けてDrawWatchする事も可能