当前位置: 首页>>代码示例>>Golang>>正文


Golang engine.NewComponent函数代码示例

本文整理汇总了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}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:7,代码来源:AudioListener.go

示例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}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:10,代码来源:ShipController.go

示例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
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:16,代码来源:AudioSource.go

示例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
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:18,代码来源:UIText.go

示例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
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:23,代码来源:Client.go

示例6: NewDestoyable

func NewDestoyable(hp float32, team int) *Destoyable {
	return &Destoyable{BaseComponent: engine.NewComponent(), FullHP: hp, Alive: true, HP: hp, Team: team}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:3,代码来源:Destroyable.go

示例7: NewCameraCtl

func NewCameraCtl(speed float64) *CameraController {
	return &CameraController{engine.NewComponent(), speed}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:3,代码来源:Camera.go

示例8: NewUpText

func NewUpText(c string) *upText {
	return &upText{engine.NewComponent(), nil, nil, c}
}
开发者ID:banad,项目名称:PirateLand,代码行数:3,代码来源:upText.go

示例9: NewMap

func NewMap(tex *engine.Texture, uv engine.AnimatedUV) *Map {

	return &Map{BaseComponent: engine.NewComponent(),
		Sprite: engine.NewSprite3(tex, uv)}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:5,代码来源:Map.go

示例10: NewMissle

func NewMissle(speed float32) *Missle {
	return &Missle{BaseComponent: engine.NewComponent(), Speed: speed}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:3,代码来源:Missle.go

示例11: NewPowerUp

func NewPowerUp(typ Power) *PowerUp {
	return &PowerUp{BaseComponent: engine.NewComponent(), Type: typ}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:3,代码来源:PowerUp.go

示例12: NewPlayerController

func NewPlayerController() *PlayerController {
	return &PlayerController{engine.NewComponent(), 10, 20000, nil, -1, nil, nil, make([]*engine.GameObject, 0)}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:3,代码来源:PlayerController.go

示例13: NewEnemeyAI

func NewEnemeyAI(target *engine.GameObject, typ EnemeyType) *EnemeyAI {
	return &EnemeyAI{BaseComponent: engine.NewComponent(), Target: target, Type: typ}
}
开发者ID:gulinfang,项目名称:GarageEngine,代码行数:3,代码来源:EnemeyAI.go

示例14: NewBack

func NewBack() *back {
	return &back{engine.NewComponent()}
}
开发者ID:banad,项目名称:PirateLand,代码行数:3,代码来源:background.go

示例15: NewItem

func NewItem(coll func(*engine.GameObject)) *Item {
	return &Item{engine.NewComponent(), coll, false}
}
开发者ID:banad,项目名称:PirateLand,代码行数:3,代码来源:item.go


注:本文中的github.com/vova616/GarageEngine/engine.NewComponent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。