本文整理匯總了Golang中github.com/google/flatbuffers/go.Builder.PrependFloat32Slot方法的典型用法代碼示例。如果您正苦於以下問題:Golang Builder.PrependFloat32Slot方法的具體用法?Golang Builder.PrependFloat32Slot怎麽用?Golang Builder.PrependFloat32Slot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/flatbuffers/go.Builder
的用法示例。
在下文中一共展示了Builder.PrependFloat32Slot方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: WeaponAddX
func WeaponAddX(builder *flatbuffers.Builder, x float32) { builder.PrependFloat32Slot(1, x, 0) }
示例2: MonsterAddTestf3
func MonsterAddTestf3(builder *flatbuffers.Builder, testf3 float32) {
builder.PrependFloat32Slot(27, testf3, 0.0)
}
示例3: MonsterAddTestf
func MonsterAddTestf(builder *flatbuffers.Builder, testf float32) {
builder.PrependFloat32Slot(25, testf, 3.14159)
}
示例4: MonsterAddTestf2
func MonsterAddTestf2(builder *flatbuffers.Builder, testf2 float32) {
builder.PrependFloat32Slot(26, testf2, 3.0)
}
示例5: CheckByteLayout
//.........這裏部分代碼省略.........
5, 0, // start of value 2
10, 0, 0, 0, // offset for start of vtable (int32)
0, // padding
77, // value 2
66, // value 1
55, // value 0
12, 0, 0, 0, // root of table: points to object
8, 0, // vtable bytes
8, 0, // size of object
7, 0, // start of value 0
6, 0, // start of value 1
8, 0, 0, 0, // offset for start of vtable (int32)
0, 0, // padding
44, // value 1
33, // value 0
})
// test 18: a bunch of bools
b = flatbuffers.NewBuilder(0)
b.StartObject(8)
b.PrependBoolSlot(0, true, false)
b.PrependBoolSlot(1, true, false)
b.PrependBoolSlot(2, true, false)
b.PrependBoolSlot(3, true, false)
b.PrependBoolSlot(4, true, false)
b.PrependBoolSlot(5, true, false)
b.PrependBoolSlot(6, true, false)
b.PrependBoolSlot(7, true, false)
off = b.EndObject()
b.Finish(off)
check([]byte{
24, 0, 0, 0, // root of table: points to vtable offset
20, 0, // vtable bytes
12, 0, // size of object
11, 0, // start of value 0
10, 0, // start of value 1
9, 0, // start of value 2
8, 0, // start of value 3
7, 0, // start of value 4
6, 0, // start of value 5
5, 0, // start of value 6
4, 0, // start of value 7
20, 0, 0, 0, // vtable offset
1, // value 7
1, // value 6
1, // value 5
1, // value 4
1, // value 3
1, // value 2
1, // value 1
1, // value 0
})
// test 19: three bools
b = flatbuffers.NewBuilder(0)
b.StartObject(3)
b.PrependBoolSlot(0, true, false)
b.PrependBoolSlot(1, true, false)
b.PrependBoolSlot(2, true, false)
off = b.EndObject()
b.Finish(off)
check([]byte{
16, 0, 0, 0, // root of table: points to vtable offset
0, 0, // padding
10, 0, // vtable bytes
8, 0, // size of object
7, 0, // start of value 0
6, 0, // start of value 1
5, 0, // start of value 2
10, 0, 0, 0, // vtable offset from here
0, // padding
1, // value 2
1, // value 1
1, // value 0
})
// test 20: some floats
b = flatbuffers.NewBuilder(0)
b.StartObject(1)
b.PrependFloat32Slot(0, 1.0, 0.0)
off = b.EndObject()
check([]byte{
6, 0, // vtable bytes
8, 0, // size of object
4, 0, // start of value 0
6, 0, 0, 0, // vtable offset
0, 0, 128, 63, // value 0
})
}