当前位置: 首页>>代码示例>>C++>>正文


C++ BinaryOutput::writeString方法代码示例

本文整理汇总了C++中BinaryOutput::writeString方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryOutput::writeString方法的具体用法?C++ BinaryOutput::writeString怎么用?C++ BinaryOutput::writeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BinaryOutput的用法示例。


在下文中一共展示了BinaryOutput::writeString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serialize

void ServerDescription::serialize(BinaryOutput& b) const {
    b.writeString(serverName);
    applicationAddress.serialize(b);
    b.writeString(applicationName);
    b.writeInt32(maxClients);
    b.writeInt32(currentClients);
    b.writeString(data);
}
开发者ID:jackpoz,项目名称:G3D-backup,代码行数:8,代码来源:Discovery.cpp

示例2: writeHeader

void writeHeader(BinaryOutput& b, const String& header) {
    debugAssertM(header.size() < HEADER_LENGTH, "This header string is too long");
    b.writeString(header, SpeedLoad::HEADER_LENGTH);
}
开发者ID:elfprince13,项目名称:G3D10,代码行数:4,代码来源:SpeedLoad.cpp

示例3: serialize

	void serialize(BinaryOutput& b) const {
		b.writeInt32(i32);
		b.writeInt64(i64);
		b.writeString(s);
		b.writeFloat32(f);
	}
开发者ID:jackpoz,项目名称:G3D-backup,代码行数:6,代码来源:tReliableConduit.cpp

示例4: encodeTGA

void GImage::encodeTGA(
    BinaryOutput&       out) const {

    out.setEndian(G3D_LITTLE_ENDIAN);

    // ID length
    out.writeUInt8(0);

    // Color map Type
    out.writeUInt8(0);

    // Type
    out.writeUInt8(2);

    // Color map
    out.skip(5);

    // x, y offsets
    out.writeUInt16(0);
    out.writeUInt16(0);

    // Width & height
    out.writeUInt16(m_width);
    out.writeUInt16(m_height);

    // Color depth
    if (m_channels == 1) {
        // Force RGB mode
        out.writeUInt8(8 * 3);
    } else {
        out.writeUInt8(8 * m_channels);
    }

    // Image descriptor
    if (m_channels < 4) {
        // 0 alpha bits
        out.writeUInt8(0);
    } else {
        // 8 alpha bits
        out.writeUInt8(8);
    }

    // Image ID (zero length)

    if (m_channels == 1) {
        // Pixels are upside down in BGR format.
        for (int y = m_height - 1; y >= 0; --y) {
            for (int x = 0; x < m_width; ++x) {
                uint8 p = (m_byte[(y * m_width + x)]);
                out.writeUInt8(p);
                out.writeUInt8(p);
                out.writeUInt8(p);
            }
        }
    } else if (m_channels == 3) {
        // Pixels are upside down in BGR format.
        for (int y = m_height - 1; y >= 0; --y) {
            for (int x = 0; x < m_width; ++x) {
                uint8* p = &(m_byte[3 * (y * m_width + x)]);
                out.writeUInt8(p[2]);
                out.writeUInt8(p[1]);
                out.writeUInt8(p[0]);
            }
        }
    } else {
        // Pixels are upside down in BGRA format.
        for (int y = m_height - 1; y >= 0; --y) {
            for (int x = 0; x < m_width; ++x) {
                uint8* p = &(m_byte[4 * (y * m_width + x)]);
                out.writeUInt8(p[2]);
                out.writeUInt8(p[1]);
                out.writeUInt8(p[0]);
                out.writeUInt8(p[3]);
            }
        }
    }

    // Write "TRUEVISION-XFILE " 18 bytes from the end
    // (with null termination)
    out.writeString("TRUEVISION-XFILE ");
}
开发者ID:Demigodess,项目名称:Darkcore,代码行数:81,代码来源:GImage_tga.cpp


注:本文中的BinaryOutput::writeString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。