Пример #1
0
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()
					}
				})
			}
		}()
	})
}
Пример #2
0
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)
}
Пример #3
0
Файл: main.go Проект: gbember/gt
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()
	//	}
}
Пример #4
0
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)

}
Пример #5
0
func main() {
	gl.StartDriver(appMain)
}
Пример #6
0
Файл: main.go Проект: ww24/goss
func main() {
	flag.Parse()
	gl.StartDriver(appMain)
}
Пример #7
0
func main() {
	gl.StartDriver(dashboard.Initdashboard)
}
Пример #8
0
func ShowWindow() {
	gl.StartDriver(mainView)
}
Пример #9
0
func Start() {
	gl.StartDriver(appMain)
}
Пример #10
0
func main() {
	initWallet()
	gl.StartDriver(appMain)
}