| 1 |
<!DOCTYPE html> |
| 2 |
<html><head> |
| 3 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 4 |
<title>test.fbs</title> |
| 5 |
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (FlatBuffers) - Theme (Breeze Dark)"/> |
| 6 |
</head><body style="background-color:#232629;color:#cfcfc2"><pre> |
| 7 |
<span style="color:#7a7c7d;">// Example IDL file for our monster's schema.</span> |
| 8 |
|
| 9 |
<span style="font-weight:bold;">namespace</span> MyGame.Sample; |
| 10 |
|
| 11 |
<span style="font-weight:bold;">enum</span> Color:<span style="color:#2980b9;">byte</span> { Red = <span style="color:#f67400;">0</span>, Green, Blue = <span style="color:#f67400;">2</span> } |
| 12 |
|
| 13 |
<span style="font-weight:bold;">union</span> Equipment { Weapon } <span style="color:#7a7c7d;">// Optionally add more tables.</span> |
| 14 |
|
| 15 |
<span style="font-weight:bold;">struct</span> Vec3 { |
| 16 |
x:<span style="color:#2980b9;">float</span>; |
| 17 |
y:<span style="color:#2980b9;">float</span>; |
| 18 |
z:<span style="color:#2980b9;">float</span>; |
| 19 |
} |
| 20 |
|
| 21 |
<span style="font-weight:bold;">table</span> Monster { |
| 22 |
pos:Vec3; <span style="color:#7a7c7d;">// Struct.</span> |
| 23 |
mana:<span style="color:#2980b9;">short</span> = <span style="color:#f67400;">150</span>; |
| 24 |
hp:<span style="color:#2980b9;">short</span> = <span style="color:#f67400;">100</span>; |
| 25 |
name:<span style="color:#2980b9;">string</span>; |
| 26 |
friendly:<span style="color:#2980b9;">bool</span> = <span style="color:#f67400;">false</span> (<span style="font-weight:bold;">deprecated</span>); |
| 27 |
inventory:[<span style="color:#2980b9;">ubyte</span>]; <span style="color:#7a7c7d;">// Vector of scalars.</span> |
| 28 |
color:Color = Blue; <span style="color:#7a7c7d;">// Enum.</span> |
| 29 |
weapons:[Weapon]; <span style="color:#7a7c7d;">// Vector of tables.</span> |
| 30 |
equipped:Equipment; <span style="color:#7a7c7d;">// Union.</span> |
| 31 |
path:[Vec3]; <span style="color:#7a7c7d;">// Vector of structs.</span> |
| 32 |
} |
| 33 |
|
| 34 |
<span style="font-weight:bold;">table</span> Weapon { |
| 35 |
name:<span style="color:#2980b9;">string</span>; |
| 36 |
damage:<span style="color:#2980b9;">short</span>; |
| 37 |
} |
| 38 |
|
| 39 |
<span style="font-weight:bold;">root_type</span> Monster; |
| 40 |
</pre></body></html> |