當前位置: 首頁>>代碼示例>>Golang>>正文


Golang gl.StartDriver函數代碼示例

本文整理匯總了Golang中github.com/google/gxui/drivers/gl.StartDriver函數的典型用法代碼示例。如果您正苦於以下問題:Golang StartDriver函數的具體用法?Golang StartDriver怎麽用?Golang StartDriver使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了StartDriver函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: gxuiOpenWindow

func gxuiOpenWindow(width uint, height uint, dblBuf *doublebuffer.DoubleBuffer, commands chan Message, events chan Message) {
	gl.StartDriver(func(driver gxui.Driver) {
		theme := flags.CreateTheme(driver)
		window := theme.CreateWindow(int(width), int(height), "MyGameEngine")
		window.SetScale(flags.DefaultScaleFactor)
		screen := theme.CreateImage()
		window.AddChild(screen)
		window.OnClose(func() {
			driver.Terminate()
			events <- Message{MESSAGE_EXIT, 0}
		})
		window.OnKeyDown(func(e gxui.KeyboardEvent) {
			fmt.Println("keydown") // FIXME: without this line, randomly crash ...
			events <- Message{MESSAGE_KEY_DOWN, int(e.Key)}
		})

		// repaint function
		go func() {
			for {
				<-commands
				last := screen.Texture()
				driver.CallSync(func() {
					texture := driver.CreateTexture(dblBuf.GetPreviousImage().GetBuffer(), 1)
					screen.SetTexture(texture)
					if last != nil {
						last.Release()
					}
				})
			}
		}()
	})
}
開發者ID:reachtheflow,項目名稱:gotris,代碼行數:32,代碼來源:gsxui.go

示例2: main

func main() {
	f, err := os.Open("mesh.json")
	if err != nil {
		log.Fatal(err)
	}
	if err := json.NewDecoder(f).Decode(&list); err != nil {
		log.Fatal(err)
	}
	vertices = list.Vertices
	triangles = list.Triangles
	dijkstra.CreateMatrixFromMesh(Mesh{vertices, triangles})
	gl.StartDriver(appMain)
}
開發者ID:lazytiger,項目名稱:navmesh,代碼行數:13,代碼來源:main.go

示例3: main

func main() {
	log.SetFlags(log.Lshortfile | log.Ldate)

	meshFileName := "../mesh.json"

	data, err := ioutil.ReadFile(meshFileName)
	if err != nil {
		log.Fatal(err)
	}
	nmj = new(navmesh.NavMeshJson)
	err = json.Unmarshal(data, nmj)
	if err != nil {
		log.Fatal(err)
	}

	n_m, err := navmesh.NewNavMesh(meshFileName)
	if err != nil {
		log.Fatal(err)
	}
	nm = n_m
	nmastar = navmesh.NewNavMeshAStar(nm)

	gl.StartDriver(appMain)

	//
	//	ps, isWalk := nm.FindPath(179, 41, 178, 886)
	//	log.Println(isWalk, ps)
	//	if isWalk {
	//		fn := "tt.cpuprof"
	//		f, err := os.Create(fn)
	//		if err != nil {
	//			log.Fatal(err)
	//		}
	//		err = pprof.StartCPUProfile(f)
	//		if err != nil {
	//			log.Fatal(err)
	//		}
	//		max := int64(100000)
	//		st := time.Now()
	//		for i := int64(0); i < max; i++ {
	//			nm.FindPath(179, 41, 178, 886)
	//		}
	//		nt := time.Since(st)
	//		log.Println(nt, nt.Nanoseconds()/max)

	//		pprof.StopCPUProfile()
	//	}
}
開發者ID:gbember,項目名稱:gt,代碼行數:48,代碼來源:main.go

示例4: GUImain

func GUImain() {
	FieldNames = []string{
		"chan size",
		"blur",
		"cpus", // 1- MAX_CPUS (8?)
		"update freq",
		"colour basis",       // any of rgb
		"echospacing",        // float between 0 and 1 determining how much to progress through set before ES
		"flip draw",          // technically a bool
		"intermediate steps", // also a bool
		"seed colour",        // any of 0x000000 - 0xFFFFFF
		//"seed chroma",	// colour to ignore in initial image
		//"seed duplicates", // bool; attemp to reseed seen colours
		//"seed image",	// uploaded image
		//"seed culling rate", // % of pixels to reject from seed image
		"start X",
		"start Y",
		"tag",
		"width",
		"height",
	}
	gl.StartDriver(appMain)

}
開發者ID:Kapura,項目名稱:pixelart,代碼行數:24,代碼來源:ui.go

示例5: main

func main() {
	gl.StartDriver(appMain)
}
開發者ID:oOLokiOo,項目名稱:random-film,代碼行數:3,代碼來源:main.go

示例6: main

func main() {
	flag.Parse()
	gl.StartDriver(appMain)
}
開發者ID:ww24,項目名稱:goss,代碼行數:4,代碼來源:main.go

示例7: main

func main() {
	gl.StartDriver(dashboard.Initdashboard)
}
開發者ID:jonysugianto,項目名稱:adminkost,代碼行數:3,代碼來源:tut3.go

示例8: ShowWindow

func ShowWindow() {
	gl.StartDriver(mainView)
}
開發者ID:blanc01,項目名稱:snmp,代碼行數:3,代碼來源:snmpWindow.go

示例9: Start

func Start() {
	gl.StartDriver(appMain)
}
開發者ID:kelwang,項目名稱:godu-pan,代碼行數:3,代碼來源:ui.go

示例10: main

func main() {
	initWallet()
	gl.StartDriver(appMain)
}
開發者ID:FactomProject,項目名稱:GUIWallet,代碼行數:4,代碼來源:main.go


注:本文中的github.com/google/gxui/drivers/gl.StartDriver函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。