本文整理汇总了Python中mmfparser.bytereader.ByteReader.writeInt方法的典型用法代码示例。如果您正苦于以下问题:Python ByteReader.writeInt方法的具体用法?Python ByteReader.writeInt怎么用?Python ByteReader.writeInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mmfparser.bytereader.ByteReader
的用法示例。
在下文中一共展示了ByteReader.writeInt方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_shader
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def get_shader(self, name, vert, frag):
writer = ByteReader()
writer.writeInt(len(vert))
writer.write(vert)
writer.writeInt(len(frag))
writer.write(frag)
return str(writer)
示例2: write_fonts
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def write_fonts(out, fonts):
fp = open(out, 'wb')
writer = ByteReader(fp)
writer.writeInt(len(fonts))
for font in fonts:
font.write(writer)
fp.close()
示例3: compress
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def compress(data):
reader = ByteReader()
compressed = zlib.compress(str(data))
reader.writeInt(len(data))
reader.writeInt(len(compressed))
reader.write(compressed)
return reader
示例4: write_runinfo
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def write_runinfo(info):
writer = ByteReader()
writer.writeInt(len(info), True)
for k, v in info.iteritems():
writer.writeInt(len(k), True)
writer.write(k)
for i in xrange(26):
reader.writeByte(v[i], True)
示例5: get_shader
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def get_shader(self, name, vert, frag):
vert = translate_shader_data(vert, 'vertex', 'gles')
frag = translate_shader_data(frag, 'fragment', 'gles')
writer = ByteReader()
writer.writeInt(len(vert))
writer.write(vert)
writer.writeInt(len(frag))
writer.write(frag)
return str(writer)
示例6: write
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def write(self, reader):
newReader = ByteReader()
newReader.writeShort(self.handle)
newReader.writeInt(self.magicNumber)
newReader.writeInt(self.versionLS)
newReader.writeInt(self.versionMS)
newReader.writeString('.'.join([self.name, self.extension]))
newReader.writeString(self.subType)
reader.writeShort(len(newReader) + 2, True)
reader.writeReader(newReader)
示例7: write
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def write(self, reader):
reader.writeIntString(self.name)
reader.writeIntString(self.extension)
reader.writeInt(self.identifier)
newReader = ByteReader()
if not self.extension:
newReader.writeShort(self.player)
newReader.writeShort(self.type)
newReader.writeByte(self.movingAtStart)
newReader.write('\x00' * 3)
newReader.writeInt(self.directionAtStart)
self.loader.write(newReader)
reader.writeIntString(str(newReader))
示例8: get_shader
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def get_shader(self, name, vert, frag):
vert_path = os.path.join(SHADERS_DIR, name + '.vsb')
frag_path = os.path.join(SHADERS_DIR, name + '.psb')
with open(vert_path, 'rb') as fp:
vert_data = fp.read()
with open(frag_path, 'rb') as fp:
frag_data = fp.read()
writer = ByteReader()
writer.writeInt(len(vert_data))
writer.write(vert_data)
writer.writeInt(len(frag_data))
writer.write(frag_data)
return str(writer)
示例9: get_wav
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def get_wav(self):
reader = ByteReader()
reader.write('RIFF')
reader.writeInt(len(self.data) - 44)
reader.write('WAVEfmt ')
reader.writeInt(16, True)
reader.writeShort(self.format, True)
reader.writeShort(self.channel_count, True)
reader.writeInt(self.sample_rate, True)
reader.writeInt(self.byte_rate, True)
reader.writeShort(self.block_align, True)
reader.writeShort(self.bits_per_sample, True)
reader.write('data')
reader.writeInt(self.chunk_size, True)
reader.write(self.data)
return reader
示例10: add_sound
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def add_sound(self, name, ext=None, data=None):
if ext is None:
audio_type = NONE_TYPE
else:
audio_type = AUDIO_TYPES.get(ext, NATIVE_TYPE)
index = len(self.sounds)
sound_id = get_asset_name('SOUND', name, index)
self.sound_ids[name.lower()] = sound_id
self.header.putdefine(sound_id, index)
writer = ByteReader()
writer.writeInt(audio_type)
if data:
writer.writeIntString(data)
self.sounds.append(str(writer))
示例11: write_data
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def write_data(self):
header = ByteReader()
data = ByteReader()
header_size = (len(self.images) + len(self.sounds) + len(self.fonts) +
len(self.shaders)) * 4 + len(self.images) * 2
# image preload
self.use_count_offset = header.tell()
for _ in xrange(len(self.images)):
header.writeShort(0, True)
for image in self.images:
header.writeInt(data.tell() + header_size, True)
data.write(image)
for sound in self.sounds:
header.writeInt(data.tell() + header_size, True)
data.write(sound)
for shader in self.shaders:
header.writeInt(data.tell() + header_size, True)
data.write(shader)
self.fp.write(str(header))
self.fp.write(str(data))
self.image_count = len(self.images)
self.sound_count = len(self.sounds)
self.font_count = len(self.fonts)
self.shader_count = len(self.shaders)
self.sounds = self.images = self.fonts = self.shaders = None
示例12: write
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def write(self, reader):
java = self.settings.get('java', False)
debug = self.settings.get('debug', False)
compressed = not debug and self.settings.get('compressed', True)
reader.writeInt(self.handle, True)
compressedReader = ByteReader()
compressedReader.writeInt(self.checksum)
compressedReader.writeInt(self.references)
compressedReader.writeInt(0) # size
self.value.write(compressedReader)
if not java and compressed:
reader.writeReader(zlibdata.compress(compressedReader))
else:
reader.writeReader(compressedReader)
示例13: write_data
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeInt [as 别名]
def write_data(self):
header = ByteReader()
data = ByteReader()
header_size = ((len(self.images) + len(self.sounds) + len(self.fonts) +
len(self.shaders) + len(self.files)) * 4
+ len(self.images) * 2 + 5 * 4)
# image preload
self.use_count_offset = header.tell()
for _ in xrange(len(self.images)):
header.writeShort(0, True)
start = data.tell()
for image in self.images:
header.writeInt(data.tell() + header_size, True)
data.write(image)
image_size = data.tell() - start
start = data.tell()
for sound in self.sounds:
header.writeInt(data.tell() + header_size, True)
data.write(sound)
sound_size = data.tell() - start
start = data.tell()
for font in self.fonts:
header.writeInt(data.tell() + header_size, True)
data.write(font)
font_size = data.tell() - start
start = data.tell()
for shader in self.shaders:
header.writeInt(data.tell() + header_size, True)
data.write(shader)
shader_size = data.tell() - start
start = data.tell()
for packfile in self.files:
header.writeInt(data.tell() + header_size, True)
data.write(packfile)
packfile_size = data.tell() - start
for size in (image_size, sound_size, font_size, shader_size,
packfile_size):
header.writeInt(size, True)
self.fp.write(str(header))
self.fp.write(str(data))
self.image_count = len(self.images)
self.sound_count = len(self.sounds)
self.font_count = len(self.fonts)
self.shader_count = len(self.shaders)
self.file_count = len(self.files)
self.sounds = self.images = self.fonts = self.shaders = None
self.files = None