Files
flatbuffers/tests/MyGame/Example/Vec3.cs
Mormegil e3b432cba8 Enums use native enums in C#
Enums should not be (badly) emulated with classes in C# but should
use native C# enums instead. Java implementation made an explicit
choice not to use the (more complex) Java enums, but C# enums are
just light-weight syntactic coating over integral types.

Fixes issue #171.

Change-Id: I9f4d6ba5324400a1e52982e49b58603cb7d7cca7
2015-04-13 10:40:30 -07:00

39 lines
1.1 KiB
C#

// automatically generated, do not modify
namespace MyGame.Example
{
using FlatBuffers;
public sealed class Vec3 : Struct {
public Vec3 __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
public float X() { return bb.GetFloat(bb_pos + 0); }
public float Y() { return bb.GetFloat(bb_pos + 4); }
public float Z() { return bb.GetFloat(bb_pos + 8); }
public double Test1() { return bb.GetDouble(bb_pos + 16); }
public Color Test2() { return (Color)bb.GetSbyte(bb_pos + 24); }
public Test Test3() { return Test3(new Test()); }
public Test Test3(Test obj) { return obj.__init(bb_pos + 26, bb); }
public static int CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, Color Test2, short Test_A, sbyte Test_B) {
builder.Prep(16, 32);
builder.Pad(2);
builder.Prep(2, 4);
builder.Pad(1);
builder.PutSbyte(Test_B);
builder.PutShort(Test_A);
builder.Pad(1);
builder.PutSbyte((sbyte)(Test2));
builder.PutDouble(Test1);
builder.Pad(4);
builder.PutFloat(Z);
builder.PutFloat(Y);
builder.PutFloat(X);
return builder.Offset();
}
};
}