void ServerDescription::serialize(BinaryOutput& b) const { b.writeString(serverName); applicationAddress.serialize(b); b.writeString(applicationName); b.writeInt32(maxClients); b.writeInt32(currentClients); b.writeString(data); }
void writeHeader(BinaryOutput& b, const String& header) { debugAssertM(header.size() < HEADER_LENGTH, "This header string is too long"); b.writeString(header, SpeedLoad::HEADER_LENGTH); }
void serialize(BinaryOutput& b) const { b.writeInt32(i32); b.writeInt64(i64); b.writeString(s); b.writeFloat32(f); }
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 "); }