Exemplo n.º 1
0
func (t *TestScene) OnMainMenuCallback(_ cc.Node) {
	cc.Log("begin OnMainMenuCallback")
	scene := cc.NewScene()
	layer := t.controller.Clone().Layer
	scene.AddChild(layer)
	//TODO transition progress
	cc.Director().RunScene(scene)
}
Exemplo n.º 2
0
func NewHelloWorldScene() cc.Scene {
	scene := cc.NewScene()
	scene.SetOnEnter(func() {
		scene.OnEnterSuper()
		layer := NewHelloWorldLayer()
		scene.AddChild(layer)
	})
	return scene
}
Exemplo n.º 3
0
func main() {
	cc.Game.SetOnStart(func() {
		cc.Log("starts from main.go", "begin tests")
		cc.View().AdjustViewPort(true)
		cc.View().SetDesignResolutionSize(800, 450, cc.SHOW_ALL)
		cc.View().ResizeWithBrowserSize(true)

		cc.LoaderScene().Preload(resources, func() {
			scene := cc.NewScene()
			scene.AddChild(test.NewTestController(testNames, resources).Layer)
			cc.Director().RunScene(scene)
		})
	})

	cc.Game.Run()
}
Exemplo n.º 4
0
func NewTestScene(controller *TestController) *TestScene {
	testScene := &TestScene{
		Scene:      cc.NewScene(),
		controller: controller,
	}

	label := cc.NewLabelTTF("Main Menu", "Arial", 20)
	menuItem := cc.NewMenuItemLabelAllArgs(label, testScene.OnMainMenuCallback, testScene.Scene)
	menuItem.SetPosition(cc.NewPoint(cc.WinSize().Width()-50, 25))

	menu := cc.NewMenu(menuItem)
	menu.SetPosition(cc.NewPoint(0, 0))

	testScene.Scene.AddChildWithOrder(menu, 1)

	return testScene
}