當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。