Documentation ¶
Index ¶
- Constants
- Variables
- func DrawBigText(state GameState, color color.Color, screen *ebiten.Image)
- func DrawCaption(state GameState, color color.Color, screen *ebiten.Image)
- func InitFonts()
- func IsKeyJustPressed(action UserAction, key ebiten.Key) bool
- func IsKeyJustReleased(action UserAction, key ebiten.Key) bool
- func ListenAndServe(g *Game)
- type Ball
- type CloseResponse
- type Connections
- type Game
- type GameState
- type KeyAction
- type Paddle
- type PlayerConnection
- type Position
- type StateResponse
- type UserAction
Constants ¶
View Source
const ( InitBallVelocity = 5.0 InitPaddleSpeed = 10.0 SpeedUpdateCount = 6 SpeedIncrement = 0.5 )
View Source
const ( WindowWidth = 800 WindowHeight = 600 )
View Source
const ( InitPaddleWidth = 20 InitPaddleHeight = 100 InitPaddleShift = 50 )
View Source
const (
InitBallRadius = 10.0
)
Variables ¶
View Source
var ( BgColor = color.Black ObjColor = color.RGBA{120, 226, 160, 255} )
View Source
var ( ArcadeFont font.Face SmallArcadeFont font.Face )
Functions ¶
func IsKeyJustPressed ¶
func IsKeyJustPressed(action UserAction, key ebiten.Key) bool
func IsKeyJustReleased ¶
func IsKeyJustReleased(action UserAction, key ebiten.Key) bool
func ListenAndServe ¶
func ListenAndServe(g *Game)
Types ¶
type CloseResponse ¶
type Connections ¶
type Connections = map[net.Conn]PlayerConnection
type Game ¶
type Game struct { State GameState Ball *Ball Player1 *Paddle Player2 *Paddle Rally int Level int MaxScore int Ws Connections // contains filtered or unexported fields }
func (*Game) UpdateGameState ¶
func (g *Game) UpdateGameState(action UserAction) error
type Paddle ¶
type Paddle struct { Position Score int Speed float32 Width int Height int Up ebiten.Key Down ebiten.Key PlayerName string // contains filtered or unexported fields }
Paddle is a pong paddle
func (*Paddle) GetPlayerState ¶
func (*Paddle) Update ¶
func (p *Paddle) Update(action UserAction)
type PlayerConnection ¶
type StateResponse ¶
type UserAction ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.