pongclient

package
v0.0.0-...-c06bead Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2018 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PongClient

type PongClient struct {
	Conn          *grpc.ClientConn
	Context       context.Context
	PongerService pb.PongerClient
	// contains filtered or unexported fields
}

func Get

func Get() *PongClient

Get the singleton

func (*PongClient) GetBallPosition

func (pc *PongClient) GetBallPosition() (int, int, error)

GetBallPosition retrieve the ball position from the server we expect then the client to correct its own state if needed

func (*PongClient) GetOpponent

func (pc *PongClient) GetOpponent(player *pong.Player) (int, int, int, error)

GetOpponent get opponent position client will update its state from this

func (*PongClient) GetScore

func (pc *PongClient) GetScore(g *pong.Game)

func (*PongClient) Identify

func (pc *PongClient) Identify() int32

Identify the client we retrieve the Handshake used for further discussion with the server. We return the assigned player number (by the server)

func (*PongClient) SendPlayerPosition

func (pc *PongClient) SendPlayerPosition(player *pong.Player) (int, int, error)

SendPlayerPosition send the current position of the player passed as parameter to the server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL