wire_protocol.fbs 658 B

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