hide other windows when not paused

This commit is contained in:
Edgaru089 2022-02-26 13:55:07 +08:00
parent aa3ad851cf
commit a71acc22a0
3 changed files with 62 additions and 58 deletions

View File

@ -84,6 +84,9 @@ func (g *Game) imgui() {
}
}
if g.paused {
imgui.ShowDemoWindow(nil)
if imgui.BeginV("Player", nil, imgui.WindowFlagsAlwaysAutoResize) {
pos := g.player.Position()
vel := g.player.Speed()
@ -144,6 +147,7 @@ func (g *Game) imgui() {
}
imgui.End()
}
imgui.BackgroundDrawList().AddRectFilledV(imgui.Vec2{X: float32(io.DisplaySize[0]/2 - 12), Y: float32(io.DisplaySize[1]/2 - 1)}, imgui.Vec2{X: float32(io.DisplaySize[0]/2 + 12), Y: float32(io.DisplaySize[1]/2 + 1)}, imgui.Packed(color.White), 0, 0)
imgui.BackgroundDrawList().AddRectFilledV(imgui.Vec2{X: float32(io.DisplaySize[0]/2 - 1), Y: float32(io.DisplaySize[1]/2 - 12)}, imgui.Vec2{X: float32(io.DisplaySize[0]/2 + 1), Y: float32(io.DisplaySize[1]/2 + 12)}, imgui.Packed(color.White), 0, 0)

View File

@ -16,7 +16,6 @@ import (
"edgaru089.ml/go/gl01/internal/world/worldgen"
"github.com/go-gl/glfw/v3.3/glfw"
"github.com/go-gl/mathgl/mgl64"
"github.com/inkyblackness/imgui-go/v4"
)
const (
@ -307,7 +306,6 @@ func (g *Game) Update(win *glfw.Window, delta time.Duration) {
io.Diagnostics.Times.Logic = clock.Restart()
imgui.ShowDemoWindow(nil)
g.imgui()
io.Diagnostics.Times.GUI = clock.Restart()
}

View File

@ -335,11 +335,13 @@ func (g *Game) Render(win *glfw.Window) {
g.ResizeDisplay(io.DisplaySize)
}
if g.paused {
imgui.SliderFloat3("Sun", &sun, -1, 1)
normalSun := itype.Vec3f(sun).Normalize()
imgui.SliderFloat("Water Alpha", &alpha, 0, 1)
imgui.SliderFloat("Gamma", &gamma, 1.6, 2.8)
imgui.SliderFloat("Exposure", &exposure, 0, 2)
}
normalSun := itype.Vec3f(sun).Normalize()
gl.Enable(gl.CULL_FACE)
gl.Enable(gl.DEPTH_TEST)