本文整理汇总了C++中common::String::FloatValue方法的典型用法代码示例。如果您正苦于以下问题:C++ String::FloatValue方法的具体用法?C++ String::FloatValue怎么用?C++ String::FloatValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::String
的用法示例。
在下文中一共展示了String::FloatValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
bool TerrainApp::Init()
{
Common::INIFile inif;
inif.SetFilename(m_sConfigFilename);
inif.Open();
Common::String sTemp;
inif.GetINI("Window", "Title", m_sTitle);
inif.GetINI("Window", "Width", sTemp);
m_Width = sTemp.IntValue();
inif.GetINI("Window", "Height", sTemp);
m_Height = sTemp.IntValue();
if(!InitWindow()) // Initialize the window
{
return false;
}
gLog.WriteLine("Window created OK!");
// Inititalize the D3D
Render::RenderCoreDesc rcdesc;
memset(&rcdesc, 0, sizeof(rcdesc));
rcdesc.m_hWnd = m_hWnd; // HWND
inif.GetINI("Render", "Adapter", sTemp);
rcdesc.m_Adapter = sTemp.IntValue(); // Adapter
inif.GetINI("HardwareRequirements", "DeviceType", sTemp);
rcdesc.m_DeviceType = Render::IntToDevType((unsigned int)sTemp.IntValue()); // D3D device type
inif.GetINI("Render", "ColorBits", sTemp);
rcdesc.m_DisplayColorBits = sTemp.IntValue(); // Display color bits
inif.GetINI("HardwareRequirements", "UsesMixedVertexProcessing", sTemp);
rcdesc.HR_UsesMixedVP = (bool)sTemp.IntValue();
inif.GetINI("HardwareRequirements", "MinimumStencilBits", sTemp);
rcdesc.HR_MinStencilBits = sTemp.IntValue();
rcdesc.m_PresentParameters.BackBufferWidth = m_Width;
rcdesc.m_PresentParameters.BackBufferHeight = m_Height;
rcdesc.m_PresentParameters.hDeviceWindow = m_hWnd;
inif.GetINI("Render", "IsFullscreen", sTemp);
rcdesc.m_PresentParameters.Windowed = !((bool)sTemp.IntValue());
gLog.WriteLine("Try to initialize D3D...");
if(!g_GetRenderCore()->Init(rcdesc)) //********** ==> Initializing D3D RenderCore
{
gLog.WriteLine("D3D initialization failed!");
return false;
}
gLog.WriteLine("D3D initialized OK!");
inif.GetINI("Terrain", "Name", sTemp);
g_GetTerrainTree()->SetName(sTemp);
inif.SetFilename(sTemp + ".ttd");
inif.Open();
inif.GetINI("TreeInfo", "CPX", sTemp);
float cpx = sTemp.FloatValue();
inif.GetINI("TreeInfo", "CPY", sTemp);
float cpy = sTemp.FloatValue();
inif.GetINI("TreeInfo", "CPZ", sTemp);
float cpz = sTemp.FloatValue();
g_GetTerrainTree()->CreateD3DResources();
g_GetTerrainTree()->CreateQuadTree(cpx, cpy, cpz);
inif.Close();
m_Camera.Init(Maths::Vector3F(cpx, cpy + 256.f, cpz), Maths::Vector3F(cpx, cpy + 256.f, cpz + 100.f),
Maths::Vector3F(0.f, 1.f, 0.f), 5.f, 30000.f, PI / 3, (float)m_Height / (float)m_Width);
m_Camera.GetViewMatrix(m_mtxView);
m_Camera.GetProjectionMatrix(m_mtxProj);
m_pVB = g_GetRenderCore()->CreateVertexBuffer(3, sizeof(TEST_VERTEX), TEST_VERTEX_FVF);
void* pVB = 0;
m_pVB->Lock(0, 0, &pVB, 0);
TEST_VERTEX varray[] =
{
0, cpy + 256.f, 0, D3DCOLOR_XRGB(0, 255, 0),
1024, cpy + 256.f, -1024, D3DCOLOR_XRGB(0, 255, 0),
-1024, cpy + 256.f, -1024, D3DCOLOR_XRGB(0, 0, 255)
};
memcpy(pVB, varray, 3 * sizeof(TEST_VERTEX));
m_pVB->Unlock();
return true;
}