wire_protocol.fbs 732 B

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