示例#1
0
文件: main.go 项目: walesey/go-engine
func createWindow(controllerManager *glfwController.ControllerManager) (window *ui.Window, content *ui.Container) {
	// Create window with size
	window = ui.NewWindow()
	window.SetScale(mgl32.Vec2{300, 0}.Vec3(0))

	// create a click and drag tab
	tab := ui.NewContainer()
	tab.SetBackgroundColor(70, 70, 170, 255)
	tab.SetHeight(40)

	// create a content container
	content = ui.NewContainer()
	content.SetBackgroundColor(200, 200, 200, 255)
	content.SetPadding(ui.NewMargin(10))

	// Add all the containers to the window
	mainContainer := ui.NewContainer()
	mainContainer.AddChildren(tab, content)
	window.SetElement(mainContainer)

	// create uiController
	uiController := ui.NewUiController(window)
	controllerManager.AddController(uiController.(glfwController.Controller))
	ui.ClickAndDragWindow(window, tab.Hitbox, uiController)

	return
}
示例#2
0
文件: ui.go 项目: walesey/go-engine
func (e *Editor) defaultWindow() (window *ui.Window, container *ui.Container, tab *ui.Container) {
	window = ui.NewWindow()

	tab = ui.NewContainer()
	tab.SetBackgroundColor(70, 70, 70, 255)
	tab.SetHeight(40)

	mainContainer := ui.NewContainer()
	window.SetElement(mainContainer)
	container = ui.NewContainer()
	container.SetBackgroundColor(200, 200, 200, 255)
	mainContainer.AddChildren(tab, container)
	ui.ClickAndDragWindow(window, tab.Hitbox, e.customController)

	return
}