Example #1
0
func (state *State) Render(window *glfw.Window) {
	if !state.Dirty {
		return
	}
	state.Dirty = false

	state.Reset(window)
	state.Time = time.Now()
	state.UpdateInput(window)

	hue := float32(state.Time.UnixNano()/1e6%360) / 360.0
	Highlight = ui.ColorHSLA(hue, 0.7, 0.7, 1.0)

	w, h := window.GetSize()
	root := &ui.Context{
		Backend: state.Backend,
		Input:   state.Input,
		Area:    ui.Block(0, 0, float32(w), float32(h)),
	}

	if root.Input.Mouse.Drag != nil {
		if !root.Input.Mouse.Drag(root) {
			root.Input.Mouse.Drag = nil
		}
	}

	state.Backend.SetBack(ui.ColorHex(0xEEEEEEFF))
	state.Backend.SetFore(ui.ColorHex(0xCCCCCCFF))
	state.Backend.SetFontColor(ui.ColorHex(0x000000FF))

	view := NewView(state, root, &state.Timeline)
	view.Render()
}
Example #2
0
func IDColor(id trace.ID) ui.Color {
	h := float32((id*31)%256) / 256.0
	return ui.ColorHSLA(h, 0.7, 0.8, 1)
}