本文整理汇总了Python中mmfparser.bytereader.ByteReader.writeShort方法的典型用法代码示例。如果您正苦于以下问题:Python ByteReader.writeShort方法的具体用法?Python ByteReader.writeShort怎么用?Python ByteReader.writeShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mmfparser.bytereader.ByteReader
的用法示例。
在下文中一共展示了ByteReader.writeShort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_data
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [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
示例2: add_image
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [as 别名]
def add_image(self, hot_x, hot_y, act_x, act_y, data):
writer = ByteReader()
writer.writeShort(hot_x)
writer.writeShort(hot_y)
writer.writeShort(act_x)
writer.writeShort(act_y)
writer.writeIntString(data)
self.images.append(str(writer))
示例3: write_data
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [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
示例4: write_preload
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [as 别名]
def write_preload(self, images):
self.fp.seek(self.use_count_offset)
data = ByteReader()
for handle in images:
data.writeShort(handle, True)
for handle in xrange(self.image_count):
if handle in images:
continue
data.writeShort(handle, True)
self.fp.write(str(data))
示例5: write
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [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)
示例6: write
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [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))
示例7: write
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [as 别名]
def write(self, reader):
reader.writeShort(self.objectType)
reader.writeShort(self.num)
if self.objectType == 0 and self.num == 0:
return
dataReader = ByteReader()
if (self.objectType in expression_system
and self.num in expression_system[self.objectType]):
self.loader.write(dataReader)
elif self.objectType >= 2 or self.objectType == -7:
dataReader.writeShort(self.objectInfo, True)
dataReader.writeShort(self.objectInfoList)
if self.num in expression_extension:
self.loader.write(dataReader)
reader.writeShort(len(dataReader) + 6, True)
reader.writeReader(dataReader)
示例8: get_wav
# 需要导入模块: from mmfparser.bytereader import ByteReader [as 别名]
# 或者: from mmfparser.bytereader.ByteReader import writeShort [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