wire_protocol.fbs 670 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. namespace wire_protocol;
  2. enum Command : short {
  3. ShiftLeft = 0,
  4. ShiftRight = 1,
  5. Rotate = 2,
  6. Down = 3,
  7. Land = 4,
  8. GetGameState = 5,
  9. }
  10. enum CommandResponseError : short {
  11. OK = 0,
  12. INVALID_COMMAND = 1,
  13. UNKNOWN_COMMAND = 2,
  14. }
  15. table CommandRequest {
  16. command:Command;
  17. }
  18. table Playfield {
  19. rows:short;
  20. cols:short;
  21. cells:[ubyte];
  22. }
  23. table GameState {
  24. rows:short;
  25. cols:short;
  26. next_piece:short;
  27. current_piece:short;
  28. piece_rotation:short;
  29. piece_row:short;
  30. piece_col:short;
  31. score:short;
  32. grid:[ubyte];
  33. }
  34. table CommandResponse {
  35. error:CommandResponseError;
  36. game_state:GameState;
  37. }
  38. root_type CommandRequest;
  39. root_type CommandResponse;