本文整理匯總了Python中Struct.Struct.float方法的典型用法代碼示例。如果您正苦於以下問題:Python Struct.float方法的具體用法?Python Struct.float怎麽用?Python Struct.float使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Struct.Struct
的用法示例。
在下文中一共展示了Struct.float方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Atom
# 需要導入模塊: from Struct import Struct [as 別名]
# 或者: from Struct.Struct import float [as 別名]
def Atom(self, name, fourcc, data):
#print '\t' + fourcc
count = Struct.uint16(data[0x10:0x12], endian='>')
# file('rlat/%s.%s' % (name, fourcc), 'wb').write(data[:0x18])
triplets = []
# Calculate offset to triplets (added by dasda).
off = Struct.uint16(data[4:6], endian='<') * 8 + 16;
for i in xrange(count):
af = Struct.float(data[off:off+4], endian='>')
bf = Struct.float(data[off+4:off+8], endian='>')
cf = Struct.float(data[off+8:off+0xC], endian='>')
triplets.append((af, bf, cf))
off += 0xC
if fourcc == 'RLPA':
self.brlyt.Objects[name].RLPA(triplets, self.Loop)
elif fourcc == 'RLVC':
self.brlyt.Objects[name].RLVC(triplets, self.Loop)
elif fourcc == 'RLTS':
self.brlyt.Objects[name].RLTS(triplets, self.Loop)
elif fourcc == 'RLMC':
self.brlyt.Objects[name].RLMC(triplets, self.Loop)
else:
for trip in triplets:
print '\t\tTriplet: %f %f %f' % trip
示例2: PIC1
# 需要導入模塊: from Struct import Struct [as 別名]
# 或者: from Struct.Struct import float [as 別名]
def PIC1(self, data):
wii.chexdump(data)
name = data[0xC:].split('\0', 1)[0]
mat = Struct.uint16(data[0x5C:0x5E], endian='>')
mat = self.Materials[mat]
xs = Struct.float(data[0x44:0x48], endian='>')
ys = Struct.float(data[0x48:0x4C], endian='>')
x = Struct.float(data[0x24:0x28], endian='>')
y = Struct.float(data[0x28:0x2C], endian='>')
#print 'Picture %s maps to material %s' % (name, mat[0])
#print '\t%fx%f (%f, %f)' % (xs, ys, x, y)
p=Picture(name, mat, [x, y, xs, ys])
self.PanePath[-1].Add(p)
self.Objects[name] = p
示例3: PAN1
# 需要導入模塊: from Struct import Struct [as 別名]
# 或者: from Struct.Struct import float [as 別名]
def PAN1(self, data):
wii.chexdump(data)
name = data[0xC:].split('\0', 1)[0]
x = Struct.float(data[0x24:0x28], endian='>')
y = Struct.float(data[0x28:0x2C], endian='>')
a = Struct.float(data[0x3C:0x40], endian='>')
b = Struct.float(data[0x40:0x44], endian='>')
xs = Struct.float(data[0x44:0x48], endian='>')
ys = Struct.float(data[0x48:0x4C], endian='>')
coords = [x, y, xs, ys]
#print 'Pane %s:' % name, coords+[a,b]
self.CurPane = Pane(name, coords)
示例4: PAN1
# 需要導入模塊: from Struct import Struct [as 別名]
# 或者: from Struct.Struct import float [as 別名]
def PAN1(self, data):
wii.chexdump(data)
name = data[0xC:].split("\0", 1)[0]
x = Struct.float(data[0x24:0x28], endian=">")
y = Struct.float(data[0x28:0x2C], endian=">")
a = Struct.float(data[0x3C:0x40], endian=">")
b = Struct.float(data[0x40:0x44], endian=">")
xs = Struct.float(data[0x44:0x48], endian=">")
ys = Struct.float(data[0x48:0x4C], endian=">")
coords = [x, y, xs, ys]
print "Pane %s:" % name, coords + [a, b]
self.CurPane = Pane(name, coords)