diff --git a/_examples/main.go b/_examples/main.go index 8ada750..da88925 100644 --- a/_examples/main.go +++ b/_examples/main.go @@ -5,8 +5,8 @@ import ( "golang.org/x/image/colornames" + "github.com/AllenDang/cimgui-go/imgui" "github.com/AllenDang/giu" - "github.com/AllenDang/imgui-go" animations "github.com/gucio321/giu-animations/v2" ) diff --git a/animator.go b/animator.go index ed271b7..97d1714 100644 --- a/animator.go +++ b/animator.go @@ -30,7 +30,7 @@ var ( // please open an issue in source repository. type AnimatorWidget struct { // giu ID used for storing internal state - id string + id giu.ID // playback properties duration time.Duration @@ -66,7 +66,7 @@ func Animator(a Animation) *AnimatorWidget { // sometimes when using sub-animators inside of Transition, it may happen // that the second AnimatorWidget will receive the same ID as the previous one. // It may cause unexpected behaviors. -func (a *AnimatorWidget) ID(newID string) *AnimatorWidget { +func (a *AnimatorWidget) ID(newID giu.ID) *AnimatorWidget { a.id = newID return a diff --git a/color_flow.go b/color_flow.go index ff22e3e..f1b30c5 100644 --- a/color_flow.go +++ b/color_flow.go @@ -3,8 +3,8 @@ package animations import ( "image/color" + "github.com/AllenDang/cimgui-go/imgui" "github.com/AllenDang/giu" - "github.com/AllenDang/imgui-go" ) var _ Animation = &ColorFlowAnimation{} @@ -12,7 +12,7 @@ var _ Animation = &ColorFlowAnimation{} // ColorFlowAnimation makes a smooth flow from one color to another // on all specified StyleColor variables. type ColorFlowAnimation struct { - id string + id giu.ID giu.Widget applyingStyles []giu.StyleColorID @@ -29,10 +29,10 @@ func ColorFlowStyle( widget, []giu.StyleColorID{normal, destiny}, func() color.RGBA { - return giu.Vec4ToRGBA(imgui.CurrentStyle().GetColor(imgui.StyleColorID(normal))) + return giu.Vec4ToRGBA(*imgui.StyleColorVec4(imgui.Col(normal))) }, func() color.RGBA { - return giu.Vec4ToRGBA(imgui.CurrentStyle().GetColor(imgui.StyleColorID(destiny))) + return giu.Vec4ToRGBA(*imgui.StyleColorVec4(imgui.Col(destiny))) }, ) } diff --git a/go.mod b/go.mod index f61355b..a358188 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,24 @@ module github.com/gucio321/giu-animations/v2 -go 1.19 +go 1.22 + +toolchain go1.23.1 require ( - github.com/AllenDang/giu v0.6.3-0.20221213134548-da051513855e - github.com/AllenDang/imgui-go v1.12.1-0.20221124025851-59b862ca5a0c + github.com/AllenDang/cimgui-go v1.0.1 + github.com/AllenDang/giu v0.9.0 ) require ( github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 // indirect github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 // indirect - github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect - github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b // indirect - github.com/mazznoer/csscolorparser v0.1.3 // indirect - github.com/napsy/go-css v0.0.0-20221107082635-4ed403047a64 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - github.com/sahilm/fuzzy v0.1.0 // indirect - golang.org/x/image v0.18.0 // indirect - golang.org/x/sys v0.5.0 // indirect + github.com/mazznoer/csscolorparser v0.1.5 // indirect + github.com/napsy/go-css v0.0.0-20230611142900-9dd118f3874c // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + github.com/sahilm/fuzzy v0.1.1 // indirect + golang.design/x/hotkey v0.4.1 // indirect + golang.design/x/mainthread v0.3.0 // indirect + golang.org/x/image v0.20.0 // indirect + golang.org/x/sys v0.25.0 // indirect gopkg.in/eapache/queue.v1 v1.1.0 // indirect ) - -replace github.com/AllenDang/giu => github.com/gucio321/giu v0.6.3-0.20230216184243-00bc8eae4793 diff --git a/go.sum b/go.sum index 956f857..b7f16db 100644 --- a/go.sum +++ b/go.sum @@ -1,39 +1,42 @@ +github.com/AllenDang/cimgui-go v1.0.1 h1:wByh6LaBj+g8FJSSWA0FdxbrWjv+51CSz809f4O+97E= +github.com/AllenDang/cimgui-go v1.0.1/go.mod h1:H3N42+ltguWTxs2wCKnmutpKhnUdqGadSmbXvW1TKDs= +github.com/AllenDang/giu v0.8.1 h1:tWApn79v2Vima4aPzmuWkBB+TEmXufXDeHdXWIcSvSk= +github.com/AllenDang/giu v0.8.1/go.mod h1:ut6UO5zmkYfvQB7rdPDS9yb2EnfpRvlTv2Qht4bqzK8= +github.com/AllenDang/giu v0.8.2-0.20241004081602-bf0e86eecea6 h1:1Nz6I/pJyRI2sLFzwR40SH32REHBmt5YJQSloTYtOfo= +github.com/AllenDang/giu v0.8.2-0.20241004081602-bf0e86eecea6/go.mod h1:mrRY0l6wOnjzHSlLdQ0+Pb4yZs7NjaNe8HyjtilVQf8= +github.com/AllenDang/giu v0.9.0 h1:ysGA7dKEWnc1AUKuftwAmOcquF7nwKhYCxWlMGzrDXQ= +github.com/AllenDang/giu v0.9.0/go.mod h1:mrRY0l6wOnjzHSlLdQ0+Pb4yZs7NjaNe8HyjtilVQf8= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8 h1:dKZMqib/yUDoCFigmz2agG8geZ/e3iRq304/KJXqKyw= github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8/go.mod h1:b4uuDd0s6KRIPa84cEEchdQ9ICh7K0OryZHbSzMca9k= -github.com/AllenDang/imgui-go v1.12.1-0.20221124025851-59b862ca5a0c h1:kiXjH0n0KzOpvhgy3nDFkPmKfg4A+QWsEOwxwWy6yuI= -github.com/AllenDang/imgui-go v1.12.1-0.20221124025851-59b862ca5a0c/go.mod h1:kuPs9RWleaUuK7D49bE6HPxyRA36Lp4ICKGp+5OnnbY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 h1:baVdMKlASEHrj19iqjARrPbaRisD7EuZEVJj6ZMLl1Q= github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3/go.mod h1:VEPNJUlxl5KdWjDvz6Q1l+rJlxF2i6xqDeGuGAxa87M= -github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk= -github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOYguHqHjSkDACcgoPIz3w0Dis/zJ1wyHHHU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/gucio321/giu v0.6.3-0.20230216184243-00bc8eae4793 h1:xQLDGC4A6zlp2Rf4GScfgSggmtT9Y36LuT/x3kGawLw= -github.com/gucio321/giu v0.6.3-0.20230216184243-00bc8eae4793/go.mod h1:hSaf4jvGDy8PcRYGTAneUN4aV3rjDhMLylFQcQqCYS0= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/mazznoer/csscolorparser v0.1.3 h1:vug4zh6loQxAUxfU1DZEu70gTPufDPspamZlHAkKcxE= -github.com/mazznoer/csscolorparser v0.1.3/go.mod h1:Aj22+L/rYN/Y6bj3bYqO3N6g1dtdHtGfQ32xZ5PJQic= -github.com/napsy/go-css v0.0.0-20221107082635-4ed403047a64 h1:7LWtWY3Ei9ghnamqn8xCu7LOXAKaQrcfbcf0sU33LG4= -github.com/napsy/go-css v0.0.0-20221107082635-4ed403047a64/go.mod h1:HqZYcKcNnv50fgOTdGUn9YbJa2qC9oJ3kLnyrwwVzUI= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mazznoer/csscolorparser v0.1.5 h1:Wr4uNIE+pHWN3TqZn2SGpA2nLRG064gB7WdSfSS5cz4= +github.com/mazznoer/csscolorparser v0.1.5/go.mod h1:OQRVvgCyHDCAquR1YWfSwwaDcM0LhnSffGnlbOew/3I= +github.com/napsy/go-css v0.0.0-20230611142900-9dd118f3874c h1:La4rUnvsKPtQ468QEIAprCeAFdIRigErRuws3EhOkNw= +github.com/napsy/go-css v0.0.0-20230611142900-9dd118f3874c/go.mod h1:HqZYcKcNnv50fgOTdGUn9YbJa2qC9oJ3kLnyrwwVzUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI= -github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= -golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= +github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.design/x/hotkey v0.4.1 h1:zLP/2Pztl4WjyxURdW84GoZ5LUrr6hr69CzJFJ5U1go= +golang.design/x/hotkey v0.4.1/go.mod h1:M8SGcwFYHnKRa83FpTFQoZvPO5vVT+kWPztFqTQKmXA= +golang.design/x/mainthread v0.3.0 h1:UwFus0lcPodNpMOGoQMe87jSFwbSsEY//CA7yVmu4j8= +golang.design/x/mainthread v0.3.0/go.mod h1:vYX7cF2b3pTJMGM/hc13NmN6kblKnf4/IyvHeu259L0= +golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw= +golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM= +golang.org/x/sys v0.0.0-20201022201747-fb209a7c41cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/eapache/queue.v1 v1.1.0 h1:EldqoJEGtXYiVCMRo2C9mePO2UUGnYn2+qLmlQSqPdc= gopkg.in/eapache/queue.v1 v1.1.0/go.mod h1:wNtmx1/O7kZSR9zNT1TTOJ7GLpm3Vn7srzlfylFbQwU= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/helpers.go b/helpers.go index 55cbaa5..7b994db 100644 --- a/helpers.go +++ b/helpers.go @@ -1,6 +1,6 @@ package animations -import "github.com/AllenDang/imgui-go" +import "github.com/AllenDang/cimgui-go/imgui" func vecSum(vec1, vec2 imgui.Vec2) imgui.Vec2 { return imgui.Vec2{ diff --git a/math.go b/math.go index 7090ede..f1ebc97 100644 --- a/math.go +++ b/math.go @@ -3,7 +3,7 @@ package animations import ( "math" - "github.com/AllenDang/imgui-go" + "github.com/AllenDang/cimgui-go/imgui" ) func factorial(n int) int { diff --git a/move.go b/move.go index 6ee3cfb..9f99a35 100644 --- a/move.go +++ b/move.go @@ -3,8 +3,8 @@ package animations import ( "log" + "github.com/AllenDang/cimgui-go/imgui" "github.com/AllenDang/giu" - "github.com/AllenDang/imgui-go" ) var _ Animation = &MoveAnimation{} @@ -12,7 +12,7 @@ var _ Animation = &MoveAnimation{} // MoveAnimation moves animation widget from start position to destination. // You can also specify animation Bézier curve's points. type MoveAnimation struct { - id string + id giu.ID widget func(starter StarterFunc) giu.Widget steps []*MoveStep diff --git a/move_step.go b/move_step.go index 9d8076c..d9bd8bb 100644 --- a/move_step.go +++ b/move_step.go @@ -1,6 +1,6 @@ package animations -import "github.com/AllenDang/imgui-go" +import "github.com/AllenDang/cimgui-go/imgui" // MoveStep represents animation single key frame in context of MoveAnimation. // If Relative() not set, positionDelta is relative to this in animation previous step. diff --git a/transition.go b/transition.go index 5d74bf0..6e2d74a 100644 --- a/transition.go +++ b/transition.go @@ -1,7 +1,7 @@ package animations import ( - "github.com/AllenDang/imgui-go" + "github.com/AllenDang/cimgui-go/imgui" ) var _ Animation = &TransitionAnimation{}