func NewAudioListener() *AudioListener {
	if Listener == nil {
		Listener = new(openal.Listener)
		Listener.SetOrientation(0, 0, -1, 0, 1, 0)
	}
	return &AudioListener{engine.NewComponent(), Listener}
}
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}
}
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
}
Exemple #4
0
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
}
Exemple #5
0
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
}
func NewDestoyable(hp float32, team int) *Destoyable {
	return &Destoyable{BaseComponent: engine.NewComponent(), FullHP: hp, Alive: true, HP: hp, Team: team}
}
Exemple #7
0
func NewCameraCtl(speed float64) *CameraController {
	return &CameraController{engine.NewComponent(), speed}
}
Exemple #8
0
func NewUpText(c string) *upText {
	return &upText{engine.NewComponent(), nil, nil, c}
}
Exemple #9
0
func NewMap(tex *engine.Texture, uv engine.AnimatedUV) *Map {

	return &Map{BaseComponent: engine.NewComponent(),
		Sprite: engine.NewSprite3(tex, uv)}
}
Exemple #10
0
func NewMissle(speed float32) *Missle {
	return &Missle{BaseComponent: engine.NewComponent(), Speed: speed}
}
Exemple #11
0
func NewPowerUp(typ Power) *PowerUp {
	return &PowerUp{BaseComponent: engine.NewComponent(), Type: typ}
}
func NewPlayerController() *PlayerController {
	return &PlayerController{engine.NewComponent(), 10, 20000, nil, -1, nil, nil, make([]*engine.GameObject, 0)}
}
Exemple #13
0
func NewEnemeyAI(target *engine.GameObject, typ EnemeyType) *EnemeyAI {
	return &EnemeyAI{BaseComponent: engine.NewComponent(), Target: target, Type: typ}
}
Exemple #14
0
func NewBack() *back {
	return &back{engine.NewComponent()}
}
Exemple #15
0
func NewItem(coll func(*engine.GameObject)) *Item {
	return &Item{engine.NewComponent(), coll, false}
}
Exemple #16
0
func NewBar(width float32) *Bar {
	return &Bar{engine.NewComponent(), false, 0, width, nil, nil}
}
func NewMouseDebugger() *MouseDebugger {
	return &MouseDebugger{engine.NewComponent()}
}
Exemple #18
0
func NewChest(ty int) *Chest {
	return &Chest{engine.NewComponent(), ty, false, false}
}
func NewResizeScript(minX, mediumX, maxX, minY, mediumY, maxY float32) *ResizeScript {
	return &ResizeScript{BaseComponent: engine.NewComponent(), MinX: minX, MediumX: mediumX, MaxX: maxX, MinY: minY, MediumY: mediumY, MaxY: maxY, Speed: 3}
}
Exemple #20
0
func newTweens(t *Tween) *Tweens {
	ts := &Tweens{engine.NewComponent(), make([]*Tween, 0, 2)}
	ts.AddTween(t)
	return ts
}
func NewPlayerController(player *Player) *PlayerController {
	return &PlayerController{engine.NewComponent(), player, nil, nil, 200}
}
Exemple #22
0
func NewCollider() *Collider {
	return &Collider{engine.NewComponent(), nil}
}
Exemple #23
0
func NewEnemy(Hp *GUI.Bar) *Enemy {
	return &Enemy{engine.NewComponent(), 0, 100, 100, Hp, false, false, true, false, false, true, false, 60, 0, 0, 3000, nil, engine.Vector{0, 0, 0}, engine.StartCoroutine(func() {})}

}
Exemple #24
0
func NewBackground(sprite *engine.Sprite) *Background {
	return &Background{BaseComponent: engine.NewComponent(), sprite: sprite}
}
Exemple #25
0
func NewRotator() *Rotator {
	return &Rotator{engine.NewComponent()}
}
func NewDamageDealer(dmg float32) *DamageDealer {
	return &DamageDealer{BaseComponent: engine.NewComponent(), Damage: dmg}
}
Exemple #27
0
func NewUIButton(ClickCallback func(), HoverCallback func(bool)) *UIButton {
	return &UIButton{engine.NewComponent(), ClickCallback, HoverCallback, false}
}
Exemple #28
0
func NewChud() *Chud {
	return &Chud{engine.NewComponent(), nil, nil, nil, nil, nil}
}
func NewSmoothFollow(target *engine.GameObject, speed float32, maxdis float32) *SmoothFollow {
	return &SmoothFollow{engine.NewComponent(), target, speed, maxdis}
}
Exemple #30
0
func NewController() *Controller {
	return &Controller{engine.NewComponent(), 100}
}