示例#1
0
func main() {

	fmt.Println("starting")
	GT.EngineStart()

	s, _ := Graphics.NewBasicScene()

	// create text rendering components
	textRend := Components.NewTextRenderer()
	textRend.SetFont("Raleway")
	textRend.SetText("Hello World From GT!?")
	textRend.SetSize(14)
	textRend.SetColor(1, .2, .1, 1)

	textRend2 := Components.NewTextRenderer()
	textRend2.SetFont("Fantasque Sans Mono Regular")
	textRend2.SetSize(60)
	textRend2.SetText("Hello World Pt.2")

	// create nodes for them so we can apply transformation
	node1 := Components.NewNode("Text1")
	node1.Transform().Translate(100, 100, 0)
	node1.AddComponent(textRend)

	node2 := Components.NewNode("Text2")
	node2.Transform().Rotate(.3, 0, 0, 1)
	node2.Transform().Translate(150, 150, 0)
	node2.AddComponent(textRend2)

	s.RootNode.AddNode(node1)
	s.RootNode.AddNode(node2)

	s.Start()

}
示例#2
0
func main() {

	fmt.Println("starting")
	GT.EngineStart()

	s, _ := Graphics.NewBasicScene()

	nodebak := Components.NewNode("Person")
	nodebak.Transform().Translate(100, 100)

	node := Components.NewNode("Person2")

	textRend := Components.NewTextRenderer()
	textRend.SetFont("Raleway")
	textRend.SetText("Hello World From GT!?")

	textRend.SetSize(14)
	textRend.SetColor(1, .2, .1, 1)
	node.Transform().Translate(150, 100)

	textRend2 := Components.NewTextRenderer()
	textRend2.SetFont("Fantasque Sans Mono Regular")
	textRend2.SetSize(60)
	textRend2.SetText("This is Second Font Fantasque Bold")

	rend := Components.NewSpriteRenderer()
	rend.SetImage(GT.AssetsImages + "test.png")
	nodebak.Transform().Scale(.5, .5)
	nodebak.Transform().Rotate(1.2)
	nodebak.AddComponent(rend)
	nodebak.AddComponent(textRend2)
	node.AddComponent(textRend)
	s.RootNode.AddNode(node)
	s.RootNode.AddNode(nodebak)

	s.Start()

}