Documentation ¶
Overview ¶
This package provides most commonly used types in Amphion.
Index ¶
- Constants
- func ByteArrayToInt(arr []byte) int
- func ByteArrayToInt64(arr []byte) int64
- func CopyByteArray(src []byte, target []byte, start, length int) error
- func Float32ToByteArray(num float32) []byte
- func Float64ToByteArray(num float64) []byte
- func Int64ToByteArray(num int64) []byte
- func IntToByteArray(num int32) []byte
- type ByteArrayCodable
- type ByteArrayDecodable
- type ByteArrayEncodable
- type Color
- type Int32Vector2
- type Int32Vector3
- type IntVector2
- type IntVector3
- func (v IntVector3) Add(v2 IntVector3) IntVector3
- func (v IntVector3) EncodeToByteArray() []byte
- func (v IntVector3) Equals(other interface{}) bool
- func (v IntVector3) Multiply(v2 IntVector3) IntVector3
- func (v IntVector3) Ndc(screen IntVector3) Vector3
- func (v IntVector3) SetXYZ(x, y, z int)
- func (v IntVector3) Sub(v2 IntVector3) IntVector3
- func (v IntVector3) ToFloat() Vector3
- func (v IntVector3) ToInt32() Int32Vector3
- func (v IntVector3) ToMap() SiMap
- func (v IntVector3) ToString() string
- type Mappable
- type ResId
- type SiMap
- func (m SiMap) ContainsKey(key string) bool
- func (m SiMap) GetBool(key string) bool
- func (m SiMap) GetFloat32(key string) float32
- func (m SiMap) GetFloat64(key string) float64
- func (m SiMap) GetInt(key string) int
- func (m SiMap) GetInt32(key string) int32
- func (m SiMap) GetInt64(key string) int64
- func (m SiMap) GetString(key string) string
- type Stringable
- type TextAlign
- type Unmappable
- type Unstringable
- type Vector2
- type Vector3
- func (v Vector3) Add(v2 Vector3) Vector3
- func (v Vector3) EncodeToByteArray() []byte
- func (v Vector3) Equals(other interface{}) bool
- func (v *Vector3) FromMap(siMap SiMap)
- func (v Vector3) Multiply(v2 Vector3) Vector3
- func (v Vector3) Ndc(screen Vector3) Vector3
- func (v Vector3) Round() IntVector3
- func (v Vector3) SetXYZ(x, y, z float32)
- func (v Vector3) String() string
- func (v Vector3) Sub(v2 Vector3) Vector3
- func (v Vector3) ToMap() SiMap
- type Vector4
Constants ¶
const ( MatchParent = -2147483648 WrapContent = -2147483647 CenterInParent = -2147483646 )
Variables ¶
This section is empty.
Functions ¶
func ByteArrayToInt ¶
func ByteArrayToInt64 ¶
func Float32ToByteArray ¶
func Float64ToByteArray ¶
func Int64ToByteArray ¶
func IntToByteArray ¶
Types ¶
type ByteArrayCodable ¶
type ByteArrayCodable interface { ByteArrayEncodable ByteArrayDecodable }
type ByteArrayDecodable ¶
type ByteArrayDecodable interface {
DecodeFromByteArray([]byte)
}
type ByteArrayEncodable ¶
type ByteArrayEncodable interface {
EncodeToByteArray() []byte
}
type Color ¶
type Color struct {
R, G, B, A byte
}
Color represents a color in RGBA format.
func BlackColor ¶
func BlackColor() Color
func GreenColor ¶
func GreenColor() Color
func NewColor ¶
func NewColor(params ...interface{}) Color
Creates new Color struct using the specified arguments. This function can accept the following arguments: - a color hex string, - 1 byte value for grayscale color, - 3 byte values for RGB color, - 4 byte values for RGBA color. If the given arguments cannot be interpreted as a color returns black color.
func ParseHexColor ¶ added in v0.1.7
Parses color hex string in format #rrggbbaa, #rrggbb, #rgba or #rgb to a Color struct.
func TransparentColor ¶
func TransparentColor() Color
func WhiteColor ¶
func WhiteColor() Color
func (*Color) EncodeToByteArray ¶
func (*Color) FromString ¶ added in v0.1.7
type Int32Vector2 ¶
type Int32Vector2 struct {
X, Y int32
}
type Int32Vector3 ¶
type Int32Vector3 struct {
X, Y, Z int32
}
type IntVector2 ¶
type IntVector2 struct {
X, Y int
}
func NewIntVector2 ¶
func NewIntVector2(x, y int) IntVector2
func (IntVector2) Add ¶
func (v IntVector2) Add(other IntVector2) IntVector2
func (IntVector2) Sub ¶
func (v IntVector2) Sub(other IntVector2) IntVector2
func (IntVector2) ToFloat ¶
func (v IntVector2) ToFloat() Vector2
func (IntVector2) ToFloat3 ¶
func (v IntVector2) ToFloat3() Vector3
type IntVector3 ¶
type IntVector3 struct {
X, Y, Z int
}
Represents a point in 3D space only in integer values
func NewIntVector3 ¶
func NewIntVector3(x, y, z int) IntVector3
func OneIntVector ¶
func OneIntVector() IntVector3
func ZeroIntVector ¶
func ZeroIntVector() IntVector3
func (IntVector3) Add ¶
func (v IntVector3) Add(v2 IntVector3) IntVector3
Returns a new vector - the sum of two vectors
func (IntVector3) EncodeToByteArray ¶
func (v IntVector3) EncodeToByteArray() []byte
func (IntVector3) Equals ¶
func (v IntVector3) Equals(other interface{}) bool
Checks if the vector is the same as other vector
func (IntVector3) Multiply ¶
func (v IntVector3) Multiply(v2 IntVector3) IntVector3
Returns new vector - multiplication of two vectors
func (IntVector3) Ndc ¶
func (v IntVector3) Ndc(screen IntVector3) Vector3
Transforms vector ro normalized device coordinates vector
func (IntVector3) SetXYZ ¶
func (v IntVector3) SetXYZ(x, y, z int)
func (IntVector3) Sub ¶
func (v IntVector3) Sub(v2 IntVector3) IntVector3
Returns a new vector - v-v2
func (IntVector3) ToFloat ¶
func (v IntVector3) ToFloat() Vector3
func (IntVector3) ToInt32 ¶
func (v IntVector3) ToInt32() Int32Vector3
func (IntVector3) ToMap ¶
func (v IntVector3) ToMap() SiMap
func (IntVector3) ToString ¶
func (v IntVector3) ToString() string
type SiMap ¶
type SiMap map[string]interface{}
SiMap provides an abstraction over Go's map[string]interface{}.
func RequireSiMap ¶
func RequireSiMap(i interface{}) SiMap
func (SiMap) ContainsKey ¶ added in v0.2.0
func (SiMap) GetFloat32 ¶ added in v0.1.7
func (SiMap) GetFloat64 ¶ added in v0.1.7
type Stringable ¶ added in v0.1.7
type Stringable interface {
ToString() string
}
Interface for values that can be serialized as string.
type Unmappable ¶
type Unmappable interface {
FromMap(siMap SiMap)
}
type Unstringable ¶ added in v0.1.7
type Unstringable interface {
FromString(src string)
}
Interface for values that can be deserialized from string.
type Vector3 ¶
type Vector3 struct {
X, Y, Z float32
}
Represents a point in 3D space
func NewVector3 ¶
func NewVector3FromMap ¶
func ZeroVector ¶
func ZeroVector() Vector3