Lines Matching refs:monster
19 through each step necessary to create this monster type using FlatBuffers.
137 [monster.c](https://github.com/dvidelabs/flatcc/blob/master/samples/monster/monster.c)
160 // Example IDL file for our monster's schema.
221 the template to store our `orc` monster. We specify some default values for
278 ./../flatc --cpp monster.fbs
284 ./../flatc --java monster.fbs
290 ./../flatc --csharp monster.fbs
296 ./../flatc --go monster.fbs
302 ./../flatc --python monster.fbs
308 ./../flatc --js monster.fbs
314 ./../flatc --ts monster.fbs
320 ./../flatc --php monster.fbs
326 mkdir -p build/tmp/samples/monster
327 bin/flatcc -a -o build/tmp/samples/monster samples/monster/monster.fbs
329 flatcc/samples/monster/build.sh
335 ./../flatc --dart monster.fbs
341 ./../flatc --lua monster.fbs
347 ./../flatc --lobster monster.fbs
353 ./../flatc --rust monster.fbs
481 local monster = require("MyGame.Sample.Monster")
842 Now let's create our monster, the `orc`. For this `orc`, lets make him
850 Before we serialize a monster, we need to first serialize any objects that are
856 // Serialize a name for our monster, called "Orc".
867 // Serialize a name for our monster, called "Orc".
878 // Serialize a name for our monster, called "Orc".
894 // Serialize a name for our monster, called "Orc".
909 # Serialize a name for our monster, called "Orc".
923 // Serialize a name for our monster, called 'Orc'.
934 // Serialize a name for our monster, called 'Orc'.
945 // Serialize a name for our monster, called "Orc".
956 // Serialize a name for our monster, called "Orc".
970 // Serialize a name for our monster, called "Orc".
980 // Serialize a name for our monster, called "Orc".
996 monster.StartInventoryVector(builder, 10)
1005 // Name of the monster.
1025 adding fields to our monster.
1137 monster.StartWeaponsVector(builder, 2)
1257 monster.StartPathVector(builder, 2)
1285 can serialize the monster itself:
1296 // Finally, create the monster using the `CreateMonster` helper function
1305 // Create our monster using `startMonster()` and `endMonster()`.
1321 // Create our monster using `StartMonster()` and `EndMonster()`.
1337 // Create our monster using `MonsterStart()` and `MonsterEnd()`.
1353 # Create our monster by using `MonsterStart()` and `MonsterEnd()`.
1372 // Create our monster by using `startMonster()` and `endMonster()`.
1389 // Create our monster by using `startMonster()` and `endMonster()`.
1406 // Create our monster by using `StartMonster()` and `EndMonster()`.
1442 final monster = new myGame.MonsterBuilder(builder)
1455 final int orc = monster.finish();
1489 -- Create our monster by using Start() andEnd()
1490 monster.Start(builder)
1491 monster.AddPos(builder, vec3.CreateVec3(builder, 1.0, 2.0, 3.0))
1492 monster.AddHp(builder, 300)
1493 monster.AddName(builder, name)
1494 monster.AddInventory(builder, inv)
1495 monster.AddColor(builder, color.Red)
1496 monster.AddWeapons(builder, weapons)
1497 monster.AddEquippedType(builder, equipment.Weapon)
1498 monster.AddEquipped(builder, axe)
1499 monster.AddPath(builder, path)
1500 local orc = monster.End(builder)
1520 // Create the monster using the `Monster::create` helper function. This
1545 which is why we created all the strings/vectors/tables that this monster refers
1559 manually set each field of your monster, instead of calling `CreateMonster()`.
1580 manually set each field of your monster, instead of calling `create_monster_as_root()`.
1599 // Complete the monster object and make it the buffer root object.
1683 monster.AddEquippedType(builder, equipment.Weapon) -- Union type
1684 monster.AddEquipped(builder, axe) -- Union data
1709 // Call `Finish()` to instruct the builder that this monster is complete.
1718 // Call `finish()` to instruct the builder that this monster is complete.
1724 // Call `Finish()` to instruct the builder that this monster is complete.
1730 // Call `Finish()` to instruct the builder that this monster is complete.
1736 # Call `Finish()` to instruct the builder that this monster is complete.
1742 // Call `finish()` to instruct the builder that this monster is complete.
1749 // Call `finish()` to instruct the builder that this monster is complete.
1756 // Call `finish()` to instruct the builder that this monster is complete.
1768 // Call `finish()` to instruct the builder that this monster is complete.
1774 -- Call 'Finish()' to instruct the builder that this monster is complete.
1780 // Call `Finish()` to instruct the builder that this monster is complete.
1786 // Call `finish()` to instruct the builder that this monster is complete.
1915 Now that we have successfully created an `Orc` FlatBuffer, the monster data can
2028 local monster = require("MyGame.Sample.Monster")
2066 auto monster = GetMonster(buffer_pointer);
2068 // `monster` is of type `Monster *`.
2080 Monster monster = Monster.getRootAsMonster(buf);
2089 var monster = Monster.GetRootAsMonster(buf);
2097 monster := sample.GetRootAsMonster(buf, 0)
2110 monster = MyGame.Sample.Monster.Monster.GetRootAsMonster(buf, 0)
2124 var monster = MyGame.Sample.Monster.getRootAsMonster(buf);
2133 let monster = MyGame.Sample.Monster.getRootAsMonster(buf);
2142 $monster = \MyGame\Sample\Monster::GetRootAsMonster($buf);
2150 ns(Monster_table_t) monster = ns(Monster_as_root(buffer));
2159 myGame.Monster monster = new myGame.Monster(data);
2170 local mon = monster.GetRootAsMonster(buf, 0)
2178 let monster = MyGame_Sample_GetRootAsMonster(buf)
2186 let monster = get_root_as_monster(buf);
2195 auto hp = monster->hp();
2196 auto mana = monster->mana();
2197 auto name = monster->name()->c_str();
2202 short hp = monster.hp();
2203 short mana = monster.mana();
2204 String name = monster.name();
2211 var hp = monster.Hp
2212 var mana = monster.Mana
2213 var name = monster.Name
2218 hp := monster.Hp()
2219 mana := monster.Mana()
2220 name := string(monster.Name()) // Note: `monster.Name()` returns a byte[].
2225 hp = monster.Hp()
2226 mana = monster.Mana()
2227 name = monster.Name()
2232 var hp = $monster.hp();
2233 var mana = $monster.mana();
2234 var name = $monster.name();
2239 let hp = $monster.hp();
2240 let mana = $monster.mana();
2241 let name = $monster.name();
2246 $hp = $monster->getHp();
2247 $mana = $monster->getMana();
2248 $name = monster->getName();
2253 uint16_t hp = ns(Monster_hp(monster));
2254 uint16_t mana = ns(Monster_mana(monster));
2255 flatbuffers_string_t name = ns(Monster_name(monster));
2262 var hp = monster.hp;
2263 var mana = monster.mana;
2264 var name = monster.name;
2276 let hp = monster.hp
2277 let mana = monster.mana
2278 let name = monster.name
2284 let hp = monster.hp();
2285 let mana = monster.mana();
2286 let name = monster.name();
2298 auto pos = monster->pos();
2306 Vec3 pos = monster.pos();
2314 var pos = monster.Pos.Value;
2322 pos := monster.Pos(nil)
2336 pos = monster.Pos()
2344 var pos = monster.pos();
2352 let pos = monster.pos();
2360 $pos = $monster->getPos();
2368 ns(Vec3_struct_t) pos = ns(Monster_pos(monster));
2376 myGame.Vec3 pos = monster.pos;
2392 let pos = monster.pos
2400 let pos = monster.pos().unwrap();
2417 auto inv = monster->inventory(); // A pointer to a `flatbuffers::Vector<>`.
2424 int invLength = monster.inventoryLength();
2425 byte thirdItem = monster.inventory(2);
2430 int invLength = monster.InventoryLength;
2431 var thirdItem = monster.Inventory(2);
2436 invLength := monster.InventoryLength()
2437 thirdItem := monster.Inventory(2)
2442 inv_len = monster.InventoryLength()
2443 third_item = monster.Inventory(2)
2448 var invLength = monster.inventoryLength();
2449 var thirdItem = monster.inventory(2);
2454 let invLength = monster.inventoryLength();
2455 let thirdItem = monster.inventory(2);
2460 $inv_len = $monster->getInventoryLength();
2461 $third_item = $monster->getInventory(2);
2468 flatbuffers_uint8_vec_t inv = ns(Monster_inventory(monster));
2474 int invLength = monster.inventory.length;
2475 var thirdItem = monster.inventory[2];
2486 let inv_len = monster.inventory_length
2487 let third_item = monster.inventory(2)
2493 let inv = monster.inventory().unwrap();
2506 auto weapons = monster->weapons(); // A pointer to a `flatbuffers::Vector<>`.
2514 int weaponsLength = monster.weaponsLength();
2515 String secondWeaponName = monster.weapons(1).name();
2516 short secondWeaponDamage = monster.weapons(1).damage();
2521 int weaponsLength = monster.WeaponsLength;
2522 var secondWeaponName = monster.Weapons(1).Name;
2523 var secondWeaponDamage = monster.Weapons(1).Damage;
2528 weaponLength := monster.WeaponsLength()
2529 weapon := new(sample.Weapon) // We need a `sample.Weapon` to pass into `monster.Weapons()`
2531 if monster.Weapons(weapon, 1) {
2539 weapons_length = monster.WeaponsLength()
2540 second_weapon_name = monster.Weapons(1).Name()
2541 second_weapon_damage = monster.Weapons(1).Damage()
2546 var weaponsLength = monster.weaponsLength();
2547 var secondWeaponName = monster.weapons(1).name();
2548 var secondWeaponDamage = monster.weapons(1).damage();
2553 let weaponsLength = monster.weaponsLength();
2554 let secondWeaponName = monster.weapons(1).name();
2555 let secondWeaponDamage = monster.weapons(1).damage();
2560 $weapons_len = $monster->getWeaponsLength();
2561 $second_weapon_name = $monster->getWeapons(1)->getName();
2562 $second_weapon_damage = $monster->getWeapons(1)->getDamage();
2567 ns(Weapon_vec_t) weapons = ns(Monster_weapons(monster));
2576 int weaponsLength = monster.weapons.length;
2577 var secondWeaponName = monster.weapons[1].name;
2578 var secondWeaponDamage = monster.Weapons[1].damage;
2590 let weapons_length = monster.weapons_length
2591 let second_weapon_name = monster.weapons(1).name
2592 let second_weapon_damage = monster.weapons(1).damage
2598 let weps = monster.weapons().unwrap();
2615 auto union_type = monster.equipped_type();
2618 auto weapon = static_cast<const Weapon*>(monster->equipped()); // Requires `static_cast`
2628 int unionType = monster.EquippedType();
2631 Weapon weapon = (Weapon)monster.equipped(new Weapon()); // Requires explicit cast
2641 var unionType = monster.EquippedType;
2644 var weapon = monster.Equipped<Weapon>().Value;
2654 // `monster.Equipped()` function.
2657 if monster.Equipped(unionTable) {
2658 unionType := monster.EquippedType()
2663 // `monster.Equipped()`.
2675 union_type = monster.EquippedType()
2678 # `monster.Equipped()` returns a `flatbuffers.Table`, which can be used to
2681 union_weapon.Init(monster.Equipped().Bytes, monster.Equipped().Pos)
2689 var unionType = monster.equippedType();
2692 var weapon_name = monster.equipped(new MyGame.Sample.Weapon()).name(); // 'Axe'
2693 var weapon_damage = monster.equipped(new MyGame.Sample.Weapon()).damage(); // 5
2699 let unionType = monster.equippedType();
2702 let weapon_name = monster.equipped(new MyGame.Sample.Weapon()).name(); // 'Axe'
2703 let weapon_damage = monster.equipped(new MyGame.Sample.Weapon()).damage(); // 5
2709 $union_type = $monster->getEquippedType();
2712 $weapon_name = $monster->getEquipped(new \MyGame\Sample\Weapon())->getName(); // "Axe"
2713 $weapon_damage = $monster->getEquipped(new \MyGame\Sample\Weapon())->getDamage(); // 5
2720 if (ns(Monster_equipped_type(monster)) == ns(Equipment_Weapon)) {
2723 ns(Weapon_table_t) weapon = ns(Monster_equipped(monster));
2731 var unionType = monster.equippedType.value;
2756 union_type = monster.equipped_type
2759 // `monster.equipped_as_Weapon` returns a FlatBuffer handle much like normal table fields,
2761 let union_weapon = monster.equipped_as_Weapon
2773 if monster.equipped_type() == Equipment::Weapon {
2774 let equipped = monster.equipped_as_weapon().unwrap();
2801 auto monster = GetMutableMonster(buffer_pointer); // non-const
2802 monster->mutate_hp(10); // Set the table `hp` field.
2803 monster->mutable_pos()->mutate_z(4); // Set struct field.
2804 monster->mutable_inventory()->Mutate(0, 1); // Set vector element.
2809 Monster monster = Monster.getRootAsMonster(buf);
2810 monster.mutateHp(10); // Set table field.
2811 monster.pos().mutateZ(4); // Set struct field.
2812 monster.mutateInventory(0, 1); // Set vector element.
2817 var monster = Monster.GetRootAsMonster(buf);
2818 monster.MutateHp(10); // Set table field.
2819 monster.Pos.MutateZ(4); // Set struct field.
2820 monster.MutateInventory(0, 1); // Set vector element.
2908 Lets say you have a JSON file that describes your monster. In this example,
2926 our `monster.fbs` schema to produce a FlatBuffer binary file.
2929 ./../flatc -b monster.fbs monsterdata.json