Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Packer {
- public static function pack(data:Array<FastFloat>):haxe.io.Bytes {
- var i = 0;
- inline function get() return data[i++];
- final out = new haxe.io.BytesOutput();
- while (i < data.length) {
- final type:RecorderData = cast get();
- out.writeInt8(cast type);
- switch (type) {
- case FrameBegin:
- case Begin:
- out.writeInt32(cast get());
- case SetColor:
- out.writeInt32(cast get());
- case DrawImage:
- out.writeInt8(cast get());
- out.writeFloat(get());
- out.writeFloat(get());
- case DrawScaledSubImage:
- out.writeInt8(cast get());
- out.writeFloat(get());
- out.writeFloat(get());
- out.writeFloat(get());
- out.writeFloat(get());
- out.writeFloat(get());
- out.writeFloat(get());
- out.writeFloat(get());
- out.writeFloat(get());
- case End:
- case FrameEnd:
- }
- }
- return out.getBytes();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement