Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
well, the previous command didn't work well, now everything is compatible with cimgui-go v1.0.0
  • Loading branch information
gucio321 committed Sep 24, 2024
1 parent b308e45 commit 522ce5e
Show file tree
Hide file tree
Showing 28 changed files with 404 additions and 350 deletions.
10 changes: 6 additions & 4 deletions Context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"fmt"
"sync"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/backend"
"github.com/AllenDang/cimgui-go/backend/glfwbackend"
"github.com/AllenDang/cimgui-go/imgui"
"gopkg.in/eapache/queue.v1"
)

Expand Down Expand Up @@ -42,7 +44,7 @@ type state struct {
}

type context struct {
backend imgui.Backend[imgui.GLFWWindowFlags]
backend backend.Backend[glfwbackend.GLFWWindowFlags]

isRunning bool

Expand All @@ -64,7 +66,7 @@ type context struct {
m *sync.Mutex
}

func CreateContext(b imgui.Backend[imgui.GLFWWindowFlags]) *context {
func CreateContext(b backend.Backend[glfwbackend.GLFWWindowFlags]) *context {
result := context{
cssStylesheet: make(cssStylesheet),
backend: b,
Expand Down Expand Up @@ -125,7 +127,7 @@ func (c *context) cleanState() {
c.widgetIndex = make(map[string]int)
}

func (c *context) Backend() imgui.Backend[imgui.GLFWWindowFlags] {
func (c *context) Backend() backend.Backend[glfwbackend.GLFWWindowFlags] {
return c.backend
}

Expand Down
2 changes: 1 addition & 1 deletion Direction.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package giu

import imgui "github.com/AllenDang/cimgui-go"
import "github.com/AllenDang/cimgui-go/imgui"

// Direction represents a ArrowButton direction.
type Direction imgui.Dir
Expand Down
2 changes: 1 addition & 1 deletion Events.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package giu

import imgui "github.com/AllenDang/cimgui-go"
import "github.com/AllenDang/cimgui-go/imgui"

// MouseButton represents imgui.MouseButton.
type MouseButton imgui.MouseButton
Expand Down
2 changes: 1 addition & 1 deletion ExtraWidgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"image"
"time"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
)

var _ Widget = &SplitterWidget{}
Expand Down
80 changes: 42 additions & 38 deletions Flags.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package giu

import imgui "github.com/AllenDang/cimgui-go"
import (
"github.com/AllenDang/cimgui-go/backend/glfwbackend"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/AllenDang/cimgui-go/implot"
)

// InputTextFlags represents input text flags.
type InputTextFlags imgui.InputTextFlags
Expand Down Expand Up @@ -51,7 +55,7 @@ const (
)

// WindowFlags represents a window flags (see (*WindowWidget).Flags.
type WindowFlags imgui.GLFWWindowFlags
type WindowFlags glfwbackend.GLFWWindowFlags

// window flags.
const (
Expand Down Expand Up @@ -145,7 +149,7 @@ const (
// SelectableFlagsNone default = 0.
SelectableFlagsNone = SelectableFlags(imgui.SelectableFlagsNone)
// SelectableFlagsDontClosePopups makes clicking the selectable not close any parent popup windows.
SelectableFlagsDontClosePopups = SelectableFlags(imgui.SelectableFlagsDontClosePopups)
SelectableFlagsDontClosePopups = SelectableFlags(imgui.SelectableFlagsNoAutoClosePopups)
// SelectableFlagsSpanAllColumns allows the selectable frame to span all columns (text will still fit in current column).
SelectableFlagsSpanAllColumns = SelectableFlags(imgui.SelectableFlagsSpanAllColumns)
// SelectableFlagsAllowDoubleClick generates press events on double clicks too.
Expand Down Expand Up @@ -463,47 +467,47 @@ const (
SliderFlagsInvalidMask = SliderFlags(imgui.SliderFlagsInvalidMask)
)

// PlotFlags represents imgui.PlotFlags.
type PlotFlags imgui.PlotFlags
// PlotFlags represents implot.PlotFlags.
type PlotFlags implot.PlotFlags

// plot flags.
const (
PlotFlagsNone = PlotFlags(imgui.PlotFlagsNone)
PlotFlagsNoTitle = PlotFlags(imgui.PlotFlagsNoTitle)
PlotFlagsNoLegend = PlotFlags(imgui.PlotFlagsNoLegend)
PlotFlagsNoMenus = PlotFlags(imgui.PlotFlagsNoMenus)
PlotFlagsNoBoxSelect = PlotFlags(imgui.PlotFlagsNoBoxSelect)
// PlotFlagsNoMousePos = PlotFlags(imgui.PlotFlagsNoMousePos)
// PlotFlagsNoHighlight = PlotFlags(imgui.PlotFlagsNoHighlight)
// PlotFlagsNoChild = PlotFlags(imgui.PlotFlagsNoChild).
PlotFlagsEqual = PlotFlags(imgui.PlotFlagsEqual)
// PlotFlagsYAxis2 = PlotFlags(imgui.PlotFlagsYAxis2)
// PlotFlagsYAxis3 = PlotFlags(imgui.PlotFlagsYAxis3)
// PlotFlagsQuery = PlotFlags(imgui.PlotFlagsQuery)
PlotFlagsCrosshairs = PlotFlags(imgui.PlotFlagsCrosshairs)
// PlotFlagsAntiAliased = PlotFlags(imgui.PlotFlagsAntiAliased)
PlotFlagsCanvasOnly = PlotFlags(imgui.PlotFlagsCanvasOnly)
PlotFlagsNone = PlotFlags(implot.PlotFlagsNone)
PlotFlagsNoTitle = PlotFlags(implot.PlotFlagsNoTitle)
PlotFlagsNoLegend = PlotFlags(implot.PlotFlagsNoLegend)
PlotFlagsNoMenus = PlotFlags(implot.PlotFlagsNoMenus)
PlotFlagsNoBoxSelect = PlotFlags(implot.PlotFlagsNoBoxSelect)
// PlotFlagsNoMousePos = PlotFlags(implot.PlotFlagsNoMousePos)
// PlotFlagsNoHighlight = PlotFlags(implot.PlotFlagsNoHighlight)
// PlotFlagsNoChild = PlotFlags(implot.PlotFlagsNoChild).
PlotFlagsEqual = PlotFlags(implot.PlotFlagsEqual)
// PlotFlagsYAxis2 = PlotFlags(implot.PlotFlagsYAxis2)
// PlotFlagsYAxis3 = PlotFlags(implot.PlotFlagsYAxis3)
// PlotFlagsQuery = PlotFlags(implot.PlotFlagsQuery)
PlotFlagsCrosshairs = PlotFlags(implot.PlotFlagsCrosshairs)
// PlotFlagsAntiAliased = PlotFlags(implot.PlotFlagsAntiAliased)
PlotFlagsCanvasOnly = PlotFlags(implot.PlotFlagsCanvasOnly)
)

// PlotAxisFlags represents imgui.PlotAxisFlags.
type PlotAxisFlags imgui.PlotAxisFlags
// PlotAxisFlags represents implot.PlotAxisFlags.
type PlotAxisFlags implot.PlotAxisFlags

// plot axis flags.
const (
PlotAxisFlagsNone PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsNone)
PlotAxisFlagsNoLabel PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsNoLabel)
PlotAxisFlagsNoGridLines PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsNoGridLines)
PlotAxisFlagsNoTickMarks PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsNoTickMarks)
PlotAxisFlagsNoTickLabels PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsNoTickLabels)
PlotAxisFlagsForeground PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsForeground)
// PlotAxisFlagsLogScale PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsLogScale)
// PlotAxisFlagsTime PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsTime)
PlotAxisFlagsInvert PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsInvert)
PlotAxisFlagsNoInitialFit PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsNoInitialFit)
PlotAxisFlagsAutoFit PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsAutoFit)
PlotAxisFlagsRangeFit PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsRangeFit)
PlotAxisFlagsLockMin PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsLockMin)
PlotAxisFlagsLockMax PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsLockMax)
PlotAxisFlagsLock PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsLock)
PlotAxisFlagsNoDecorations PlotAxisFlags = PlotAxisFlags(imgui.PlotAxisFlagsNoDecorations)
PlotAxisFlagsNone PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsNone)
PlotAxisFlagsNoLabel PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsNoLabel)
PlotAxisFlagsNoGridLines PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsNoGridLines)
PlotAxisFlagsNoTickMarks PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsNoTickMarks)
PlotAxisFlagsNoTickLabels PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsNoTickLabels)
PlotAxisFlagsForeground PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsForeground)
// PlotAxisFlagsLogScale PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsLogScale)
// PlotAxisFlagsTime PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsTime)
PlotAxisFlagsInvert PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsInvert)
PlotAxisFlagsNoInitialFit PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsNoInitialFit)
PlotAxisFlagsAutoFit PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsAutoFit)
PlotAxisFlagsRangeFit PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsRangeFit)
PlotAxisFlagsLockMin PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsLockMin)
PlotAxisFlagsLockMax PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsLockMax)
PlotAxisFlagsLock PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsLock)
PlotAxisFlagsNoDecorations PlotAxisFlags = PlotAxisFlags(implot.PlotAxisFlagsNoDecorations)
)
2 changes: 1 addition & 1 deletion FontAtlasProsessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"sync"
"unsafe"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
"github.com/AllenDang/go-findfont"
)

Expand Down
2 changes: 1 addition & 1 deletion ImageWidgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"reflect"
"time"

imgui "github.com/AllenDang/cimgui-go"
"github.com/AllenDang/cimgui-go/imgui"
)

var _ Widget = &ImageWidget{}
Expand Down
Loading

0 comments on commit 522ce5e

Please sign in to comment.