shared

package
v0.0.0-...-27af21b Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketUserJoin int32 = iota
	PacketUserLeave
	PacketAction
	PacketSendMessage
	PacketChunks
	PacketPlayerJoined
	PacketPlayerSelfJoined
	PacketPlayerDisconnected
	PacketUpdatePosition
	PacketUpdateSprite
	PacketUpdatePlayer
	PacketUpdateZombie
	PacketRemoveZombie
	PacketUseItem
	PacketSetHostile
)
View Source
const (
	// Actions
	ActionMoveUp int32 = iota
	ActionMoveDown
	ActionMoveLeft
	ActionMoveRight
	ActionToggleHostile
)
View Source
const (
	TerrainNothing byte = iota
	TerrainWater
	TerrainSand
	TerrainGrass
)
View Source
const (
	BlockNothing byte = iota
	BlockTree
	BlockGrass
	BlockWater
	BlockSand
)

Variables

View Source
var (
	TerrainStyles = map[byte]tcell.Style{
		TerrainNothing: StyleDefault,
		TerrainWater:   tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorBlue),
		TerrainSand:    tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorYellow),
		TerrainGrass:   tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorGreen),
	}

	Terrain = map[byte]byte{
		BlockNothing: ' ',
		BlockTree:    'T',
		BlockGrass:   ' ',
		BlockWater:   '~',
		BlockSand:    '.',
	}
)
View Source
var (
	StyleDefault = tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorWhite)
)

Functions

func GetTerrainStyle

func GetTerrainStyle(height byte) tcell.Style

func GetTerrainType

func GetTerrainType(height byte) byte

func IsMovementAction

func IsMovementAction(a int32) bool

Types

type RawPacket

type RawPacket struct {
	Type byte
	Data []byte
}

func NewRawPacket

func NewRawPacket(data []byte) *RawPacket

func (*RawPacket) ToBytes

func (p *RawPacket) ToBytes() []byte

Jump to

Keyboard shortcuts

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