agario

package module
v0.0.0-...-142005a Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownMessage = errors.New("agario: received unknown message type")

Functions

func GetCurrentLocation

func GetCurrentLocation() (currentLocation string, recommendedServer string, err error)

Types

type Cell

type Cell struct {
	ID   uint32
	Name string

	Position mgl32.Vec2 // Current position
	Heading  mgl32.Vec2 // Heading as normalized vector

	Size int32

	Color color.Color

	IsVirus bool
}

func (*Cell) Speed

func (c *Cell) Speed() float32

func (*Cell) SplitDistance

func (c *Cell) SplitDistance() float32

type CellDestroyed

type CellDestroyed struct {
	Attacker uint32
	Victim   uint32
}

type CellUpdate

type CellUpdate struct {
	ID uint32

	Point

	Size int16

	R byte
	G byte
	B byte

	Virus    bool
	Agitated bool

	Name string
}

type Connection

type Connection struct {
	Addr net.Addr
	// contains filtered or unexported fields
}

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Read

func (c *Connection) Read() (msg Message, err error)

func (*Connection) SendNickname

func (c *Connection) SendNickname(nickname string) error

func (*Connection) SendSplit

func (c *Connection) SendSplit() error

func (*Connection) SendTarget

func (c *Connection) SendTarget(x, y float64) error

type Game

type Game struct {
	*sync.Mutex

	Leaderboard []*LeaderboardItem

	Board *MessageCanvasSize

	MyIDs map[uint32]struct{}
	Cells map[uint32]*Cell
	// contains filtered or unexported fields
}

func NewGame

func NewGame(c *Connection) *Game

func (*Game) Close

func (g *Game) Close() error

func (*Game) RunOnce

func (g *Game) RunOnce(timeout bool) bool

func (*Game) SendNickname

func (g *Game) SendNickname(nickname string)

func (*Game) SetTargetPos

func (g *Game) SetTargetPos(x_, y_ float32)

func (*Game) Split

func (g *Game) Split()

type Info

type Info struct {
	Regions []*Region
}

func GetInfo

func GetInfo() (*Info, error)

type LeaderboardItem

type LeaderboardItem struct {
	ID   uint32
	Name string
}

type Message

type Message interface{}

type MessageCanvasSize

type MessageCanvasSize struct {
	Left   float64
	Bottom float64
	Right  float64
	Top    float64
}

type MessageHello

type MessageHello struct{}

type MessageLeaderboard

type MessageLeaderboard struct {
	Items []*LeaderboardItem
}

type MessageMyID

type MessageMyID struct {
	MyCell uint32
}

type MessageTeamLeaderboard

type MessageTeamLeaderboard struct {
	Red   float32
	Green float32
	Blue  float32
}

type MessageUpdate

type MessageUpdate struct {
	Destroyed []*CellDestroyed
	Updated   []*CellUpdate
	Clean     []uint32
}

type Point

type Point struct {
	X, Y int16
}

type Region

type Region struct {
	Region   string
	GameMode string

	Players int
	Realms  int
	Servers int
}

func (*Region) Connect

func (r *Region) Connect() (*Connection, error)

type TickFunc

type TickFunc func(g *Game)

Jump to

Keyboard shortcuts

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