Documentation ¶
Index ¶
- func ClearPixels(pixels []byte)
- func Init(windowWidth, windowHeight int)
- func InitState()
- func Lerp(a, b, percent float32) float32
- func Scores() [][]byte
- func SetState(newState State)
- func SetupControllers() []*sdl.GameController
- type Ball
- type Color
- type Object
- type Paddle
- type Pos
- type Score
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(windowWidth, windowHeight int)
Init initializes the game library with the given window width and height
func InitState ¶
func InitState()
InitState is a helper to initialize the game state to the start state
func Scores ¶
func Scores() [][]byte
Scores returns a slice of byte slice(scores represented as bits)
func SetState ¶
func SetState(newState State)
SetState updates the current game state with the newState
func SetupControllers ¶
func SetupControllers() []*sdl.GameController
SetupControllers setups game controllers/joysticks and returns the list of game controllers attached
Types ¶
type Ball ¶
type Ball struct { Pos // contains filtered or unexported fields }
Ball represents the ball in the pong game
type Object ¶
type Object interface {
Draw()
}
Object is an interface to game objects like paddle, ball, score etc
type Paddle ¶
type Paddle struct { Pos // contains filtered or unexported fields }
Paddle represents the paddle in the pong game
func (*Paddle) ResetScore ¶
func (p *Paddle) ResetScore()
ResetScore resets the paddle/player score to zero
Click to show internal directories.
Click to hide internal directories.