gdvariant

package module
v0.0.0-...-1d346ba Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: MIT Imports: 7 Imported by: 2

README

gdvariant

Go based Encoding/Decoding of Godot Variant types

Status

This package is in an alpha state, and not fully implemented. Enough parts of the spec are implemented that fit my immediate needs.

There is enough implemented to get a good idea of how the rest can be implemented, PRs welcome.

Documentation

Index

Constants

View Source
const (
	NullType         uint32 = iota
	BoolType                = 1
	IntegerType             = 2
	FloatType               = 3
	StringType              = 4
	Vector2Type             = 5
	Rect2Type               = 6
	Vector3Type             = 7
	Matrix32Type            = 8
	PlaneType               = 9
	QuaternionType          = 10
	AabbType                = 11 //(rect3)
	Matrix3x3Type           = 12
	TransformType           = 13 // (matrix 4x3)
	ColorType               = 14
	ImageType               = 15
	NodePathType            = 16 // path
	RidType                 = 17 // (unsupported)
	ObjectType              = 18 // (unsupported)
	InputEventType          = 19
	DictionaryType          = 20
	ArrayType               = 21
	ByteArrayType           = 22
	IntegerArrayType        = 23
	FloatArrayType          = 24
	StringArrayType         = 25
	Vector2ArrayType        = 26
	Vector3ArrayType        = 27
	ColorArrayType          = 28
)

Variables

This section is empty.

Functions

func Float32FromBytes

func Float32FromBytes(bytes []byte) float32

func Float32ToBytes

func Float32ToBytes(float float32) []byte

func Int32FromBytes

func Int32FromBytes(bytes []byte) int32

func ReadFloat32

func ReadFloat32(r io.Reader) (float32, error)

func ReadHeaderFromBytes

func ReadHeaderFromBytes(bytes []byte) uint32

func ReadInt32

func ReadInt32(r io.Reader) (i int32, err error)

func WriteFloat32

func WriteFloat32(w io.Writer, float float32) error

func WriteHeader

func WriteHeader(w io.Writer, header uint32) error

func WriteInt32

func WriteInt32(w io.Writer, i int32) error

func WriteUint32

func WriteUint32(w io.Writer, i uint32) error

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(i interface{}) error

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(i interface{}) error

type Float

type Float float32

func (Float) MarshalVariant

func (f Float) MarshalVariant() ([]byte, error)

func (*Float) UnmarshalVariant

func (f *Float) UnmarshalVariant(data []byte) error

type Integer

type Integer int32

func (Integer) MarshalVariant

func (i Integer) MarshalVariant() ([]byte, error)

func (*Integer) UnmarshalVariant

func (i *Integer) UnmarshalVariant(data []byte) error

type VariantMarshaler

type VariantMarshaler interface {
	MarshalVariant() ([]byte, error)
}

type VariantUnmarshaler

type VariantUnmarshaler interface {
	UnmarshalVariant([]byte) error
}

type Vector3

type Vector3 struct {
	X, Y, Z float32
}

func (Vector3) MarshalVariant

func (v Vector3) MarshalVariant() ([]byte, error)

func (*Vector3) UnmarshalVariant

func (v *Vector3) UnmarshalVariant(data []byte) error

Jump to

Keyboard shortcuts

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