blob: 440313a9e0ea167ec98151922b6a3cfaaff11f19 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.game.tennis;
@discoverable
protocol TennisService {
GetState() -> (struct {
state GameState;
});
RegisterPaddle(resource struct {
player_name string;
paddle client_end:Paddle;
});
};
type GameState = struct {
ballX float64;
ballY float64;
player_1_y float64; // player 1 is on the left side of the screen
player_2_y float64;
player_1_score int64;
player_2_score int64;
time int64; // start of each game is zero, represents in-game time steps elapsed
game_num int64; // increments by one any time a new game starts, 0 if not enough players yet
player_1_name string;
player_2_name string;
};
protocol Paddle {
NewGame(struct {
is_player_2 bool;
});
-> Up();
-> Down();
-> Stop();
};