Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
2e3d3cbc
Commit
2e3d3cbc
authored
Apr 02, 2018
by
David Stephan
Committed by
Wouter van Oortmerssen
Apr 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typos in C++ tutorial (#4685)
CreateMonster and MonsterBuilder examples fixed for C++
parent
d3a00f77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
Tutorial.md
docs/source/Tutorial.md
+8
-6
No files found.
docs/source/Tutorial.md
View file @
2e3d3cbc
...
...
@@ -949,15 +949,18 @@ can serialize the monster itself:
<div
class=
"language-cpp"
>
~~~
{.cpp}
// Create the position struct
auto position = Vec3(1.0f, 2.0f, 3.0f);
// Set his hit points to 300 and his mana to 150.
int hp = 300;
int mana = 150;
// Finally, create the monster using the `CreateMonster` helper function
// to set all fields.
auto orc = CreateMonster(builder,
Vec3(1.0f, 2.0f, 3.0f), mana, hp, name
,
inventory, Color_Red, weapons, Equipment_Weapon
,
axe.Union(),
path);
auto orc = CreateMonster(builder,
&position, mana, hp, name, inventory
,
Color_Red, weapons, Equipment_Weapon, axe.Union()
,
path);
~~~
</div>
<div
class=
"language-java"
>
...
...
@@ -1120,15 +1123,14 @@ a bit more flexibility.
// You can use this code instead of `CreateMonster()`, to create our orc
// manually.
MonsterBuilder monster_builder(builder);
monster_builder.add_pos(&pos);
auto pos = Vec3(1.0f, 2.0f, 3.0f);
monster_builder.add_pos(&position);
monster_builder.add_hp(hp);
monster_builder.add_name(name);
monster_builder.add_inventory(inventory);
monster_builder.add_color(Color_Red);
monster_builder.add_weapons(weapons);
monster_builder.add_equipped_type(Equipment_Weapon);
monster_builder.add_equpped(axe.Union());
monster_builder.add_equ
i
pped(axe.Union());
auto orc = monster_builder.Finish();
~~~
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment