Ejemplo n.º 1
0
func main() {
	cc.Game.SetOnStart(func() {
		cc.Log("starts from main.go")
		cc.View().AdjustViewPort(true)
		cc.View().SetDesignResolutionSize(800, 450, cc.SHOW_ALL)
		cc.View().ResizeWithBrowserSize(true)

		cc.LoaderScene().Preload(resouces, func() {
			cc.Director().RunScene(NewHelloWorldScene())
		})
	})

	cc.Game.Run()
}
Ejemplo n.º 2
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()
}
Ejemplo n.º 3
0
func (t *TestController) OnMenuCallback(sender cc.Node) {
	cc.Log("called OnMenuCallback")
	t.yOffset = t.itemMenu.GetPositionY()
	idx := sender.GetLocalZOrder() - 10000

	t.autoTestCurrentTestName = t.testNames[idx].Title
	cc.Log("Load scene:", t.autoTestCurrentTestName)

	testCase := t.testNames[idx]
	res := testCase.Resource
	cc.LoaderScene().Preload(res, func() {
		scene := testCase.TestCase(t)
		if scene != nil {
			cc.Log("Run scene:", t.autoTestCurrentTestName)
			scene.RunThisTest()
		}
	})
}