?? utils.cpp
字號:
#include "utils.h"
#include <math.h>
//--------------------------itos------------------------------------
// converts an integer to a string
//------------------------------------------------------------------
string itos(int arg)
{
ostringstream buffer;
//send the int to the ostringstream
buffer << arg;
//capture the string
return buffer.str();
}
//--------------------------ftos------------------------------------
// converts a float to a string
//------------------------------------------------------------------
string ftos(float arg)
{
ostringstream buffer;
//send the int to the ostringstream
buffer << arg;
//capture the string
return buffer.str();
}
//-------------------------------------Clamp()-----------------------------------------
//
// clamps the first argument between the second two
//
//-------------------------------------------------------------------------------------
void Clamp( double &arg, float min, float max)
{
if (arg < min)
{
arg = min;
}
if (arg > max)
{
arg = max;
}
}
void Clamp( int &arg, int min, int max)
{
if (arg < min)
{
arg = min;
}
if (arg > max)
{
arg = max;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -