本文整理汇总了Golang中github.com/vova616/GarageEngine/engine.NewComponent函数的典型用法代码示例。如果您正苦于以下问题:Golang NewComponent函数的具体用法?Golang NewComponent怎么用?Golang NewComponent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewComponent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewAudioListener
func NewAudioListener() *AudioListener {
if Listener == nil {
Listener = new(openal.Listener)
Listener.SetOrientation(0, 0, -1, 0, 1, 0)
}
return &AudioListener{engine.NewComponent(), Listener}
}
示例2: NewShipController
func NewShipController() *ShipController {
misslesDirection := [][]engine.Vector{{{0, 1, 0}, {0, 1, 0}},
{{-0.2, 1, 0}, {0.2, 1, 0}, {0, 1, 0}},
{{-0.2, 1, 0}, {0.2, 1, 0}, {0, 1, 0}, {-0.2, 1, 0}, {0.2, 1, 0}}}
misslePositions := []engine.Vector{{-28, 10, 0}, {28, 10, 0}, {0, 20, 0}, {-28, 40, 0}, {28, 40, 0}}
return &ShipController{engine.NewComponent(), 500000, 250, nil, misslePositions, misslesDirection, 0, len(misslesDirection) - 1,
time.Now(), nil, nil, true, nil, nil, nil, []engine.Vector{{-0.1, -0.51, 0}, {0.1, -0.51, 0}}, nil}
}
示例3: NewAudioSource
func NewAudioSource(clip AudioClip) *AudioSource {
as := &AudioSource{engine.NewComponent(), openal.NewSource(), false, InverseDistanceClamped, nil, nil, nil, true, false, 0}
if clip != nil {
c, e := clip.Clone()
if e != nil {
panic(e)
}
as.Clip = c
}
as.source.SetMinGain(0)
as.source.SetMaxGain(1)
if clip.AudioFormat() == Mono16 || clip.AudioFormat() == Mono8 {
as.Set2D()
}
return as
}
示例4: NewUIText
func NewUIText(font *engine.Font, text string) *UIText {
if font == nil {
return nil
}
uitext := &UIText{BaseComponent: engine.NewComponent(),
Font: font,
text: text,
buffer: engine.GenBuffer(),
align: engine.AlignCenter,
writeable: false,
tabSize: 4,
Color: engine.Color_White}
uitext.setString(text)
input.AddCharCallback(func(rn rune) { uitext.charCallback(rn) })
return uitext
}
示例5: Connect
func Connect(name string, errChan *chan error) {
*errChan = make(chan error)
/*
addr, err := net.ResolveTCPAddr("tcp", ServerIP)
if err != nil {
*errChan <- err
return
}
*/
//con, err := net.DialTCP("tcp", nil, addr)
con, err := net.DialTimeout("tcp", ServerIP, time.Second*4)
if err != nil {
con, err = net.DialTimeout("tcp", ServerLocalIP, time.Second*4)
if err != nil {
*errChan <- fmt.Errorf("Game Server is down :(.")
return
}
}
tcpCon := con.(*net.TCPConn)
MyClient = &Client{BaseComponent: engine.NewComponent(), Socket: tcpCon, Name: name, Encoder: gob.NewEncoder(tcpCon), Decoder: gob.NewDecoder(tcpCon), Jobs: make(chan func(), 1000), GameJobs: make(chan func(), 1000)}
go MyClient.Run()
LoginErrChan = *errChan
}
示例6: NewDestoyable
func NewDestoyable(hp float32, team int) *Destoyable {
return &Destoyable{BaseComponent: engine.NewComponent(), FullHP: hp, Alive: true, HP: hp, Team: team}
}
示例7: NewCameraCtl
func NewCameraCtl(speed float64) *CameraController {
return &CameraController{engine.NewComponent(), speed}
}
示例8: NewUpText
func NewUpText(c string) *upText {
return &upText{engine.NewComponent(), nil, nil, c}
}
示例9: NewMap
func NewMap(tex *engine.Texture, uv engine.AnimatedUV) *Map {
return &Map{BaseComponent: engine.NewComponent(),
Sprite: engine.NewSprite3(tex, uv)}
}
示例10: NewMissle
func NewMissle(speed float32) *Missle {
return &Missle{BaseComponent: engine.NewComponent(), Speed: speed}
}
示例11: NewPowerUp
func NewPowerUp(typ Power) *PowerUp {
return &PowerUp{BaseComponent: engine.NewComponent(), Type: typ}
}
示例12: NewPlayerController
func NewPlayerController() *PlayerController {
return &PlayerController{engine.NewComponent(), 10, 20000, nil, -1, nil, nil, make([]*engine.GameObject, 0)}
}
示例13: NewEnemeyAI
func NewEnemeyAI(target *engine.GameObject, typ EnemeyType) *EnemeyAI {
return &EnemeyAI{BaseComponent: engine.NewComponent(), Target: target, Type: typ}
}
示例14: NewBack
func NewBack() *back {
return &back{engine.NewComponent()}
}
示例15: NewItem
func NewItem(coll func(*engine.GameObject)) *Item {
return &Item{engine.NewComponent(), coll, false}
}