本文整理汇总了C++中IODevice::write_float方法的典型用法代码示例。如果您正苦于以下问题:C++ IODevice::write_float方法的具体用法?C++ IODevice::write_float怎么用?C++ IODevice::write_float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IODevice
的用法示例。
在下文中一共展示了IODevice::write_float方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void CollisionOutline_Impl::save(IODevice &output_source) const
{
/* fileformat:
uint32 type // file type identifier
uint8 version // file version
uint32 width // width of the outline
uint32 height // height of the outline
float32 x-pos // of enclosing disc
float32 y-pos // of enclosing disc
float32 radius // of enclosing disc
uint32 num_contours
uint32 num_points contour 1
float32 px1
float32 py1
float32 px2
float32 py2
... contour 1 data ...
uint32 num_points contour 2
... contour 2 data ...
uint32 num_points contour N
... contour N data ...
*/
// file type identifier
output_source.write_uint32( 0x16082004 );
// fileformat version
output_source.write_uint8(1);
// width
output_source.write_int32(width);
// height
output_source.write_int32(height);
// x-pos of enclosing disc
output_source.write_float((float)minimum_enclosing_disc.position.x);
// y-pos of enclosing disc
output_source.write_float((float)minimum_enclosing_disc.position.y);
// radius of enclosing disc
output_source.write_float((float)minimum_enclosing_disc.radius);
// number of contours
output_source.write_uint32(contours.size());
std::vector<Contour>::const_iterator it_cont;
for( it_cont = contours.begin(); it_cont != contours.end(); ++it_cont )
{
// number of points in contours
output_source.write_uint32((*it_cont).get_points().size());
std::vector<Pointf>::const_iterator it;
for( it = (*it_cont).get_points().begin(); it != (*it_cont).get_points().end(); ++it )
{
// x,y of points
output_source.write_float((float)(*it).x);
output_source.write_float((float)(*it).y);
}
}
}