Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade cimgui go to v1.1.0 #895

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions FontAtlasProsessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"unsafe"

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

Expand Down Expand Up @@ -300,7 +301,7 @@ func (a *FontAtlas) rebuildFontAtlas() {
} else {
fontConfig.SetFontDataOwnedByAtlas(false)
fonts.AddFontFromMemoryTTFV(
uintptr(unsafe.Pointer(imgui.SliceToPtr(fontInfo.fontByte))),
uintptr(unsafe.Pointer(utils.SliceToPtr(fontInfo.fontByte))),
int32(len(fontInfo.fontByte)),
fontInfo.size,
fontConfig,
Expand Down Expand Up @@ -338,7 +339,7 @@ func (a *FontAtlas) rebuildFontAtlas() {
fontConfig := imgui.NewFontConfig()
fontConfig.SetFontDataOwnedByAtlas(false)
f = fonts.AddFontFromMemoryTTFV(
uintptr(unsafe.Pointer(imgui.SliceToPtr(fontInfo.fontByte))),
uintptr(unsafe.Pointer(utils.SliceToPtr(fontInfo.fontByte))),
int32(len(fontInfo.fontByte)),
fontInfo.size,
fontConfig,
Expand Down
23 changes: 12 additions & 11 deletions Plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"image"

"github.com/AllenDang/cimgui-go/implot"
"github.com/AllenDang/cimgui-go/utils"
)

type (
Expand Down Expand Up @@ -238,7 +239,7 @@ func (p *PlotCanvasWidget) Build() {
if len(p.xTicksValue) > 0 {
implot.PlotSetupAxisTicksdoublePtrV(
implot.AxisX1,
&p.xTicksValue,
utils.SliceToPtr(p.xTicksValue),
int32(len(p.xTicksValue)),
p.xTicksLabel,
p.xTicksShowDefault,
Expand All @@ -248,7 +249,7 @@ func (p *PlotCanvasWidget) Build() {
if len(p.yTicksValue) > 0 {
implot.PlotSetupAxisTicksdoublePtrV(
implot.AxisY1,
&p.yTicksValue,
utils.SliceToPtr(p.yTicksValue),
int32(len(p.yTicksValue)),
p.yTicksLabel,
p.yTicksShowDefault,
Expand Down Expand Up @@ -340,7 +341,7 @@ func (p *BarPlot) Offset(offset int) *BarPlot {
func (p *BarPlot) Plot() {
implot.PlotPlotBarsdoublePtrIntV(
p.title,
&p.data,
utils.SliceToPtr(p.data),
int32(len(p.data)),
p.width,
p.shift,
Expand Down Expand Up @@ -392,7 +393,7 @@ func (p *BarHPlot) Offset(offset int) *BarHPlot {
func (p *BarHPlot) Plot() {
implot.PlotPlotBarsdoublePtrIntV(
Context.FontAtlas.RegisterString(p.title),
&p.data,
utils.SliceToPtr(p.data),
int32(len(p.data)),
p.height,
p.shift,
Expand Down Expand Up @@ -454,7 +455,7 @@ func (p *LinePlot) Plot() {

implot.PlotPlotLinedoublePtrIntV(
Context.FontAtlas.RegisterString(p.title),
&p.values,
utils.SliceToPtr(p.values),
int32(len(p.values)),
p.xScale,
p.x0,
Expand Down Expand Up @@ -499,8 +500,8 @@ func (p *LineXYPlot) Plot() {
implot.PlotSetAxis(implot.PlotAxisEnum(p.yAxis))
implot.PlotPlotLinedoublePtrdoublePtrV(
Context.FontAtlas.RegisterString(p.title),
&p.xs,
&p.ys,
utils.SliceToPtr(p.xs),
utils.SliceToPtr(p.ys),
int32(len(p.xs)),
0, // flags
int32(p.offset),
Expand Down Expand Up @@ -560,7 +561,7 @@ func (p *PieChartPlot) Plot() {

implot.PlotPlotPieChartdoublePtrStrV(
Context.FontAtlas.RegisterStringSlice(p.labels),
&p.values,
utils.SliceToPtr(p.values),
int32(len(p.values)),
p.x,
p.y,
Expand Down Expand Up @@ -612,7 +613,7 @@ func (p *ScatterPlot) Offset(offset int) *ScatterPlot {
func (p *ScatterPlot) Plot() {
implot.PlotPlotScatterdoublePtrIntV(
Context.FontAtlas.RegisterString(p.label),
&p.values,
utils.SliceToPtr(p.values),
int32(len(p.values)),
p.xscale,
p.x0,
Expand Down Expand Up @@ -649,8 +650,8 @@ func (p *ScatterXYPlot) Offset(offset int) *ScatterXYPlot {
func (p *ScatterXYPlot) Plot() {
implot.PlotPlotScatterdoublePtrdoublePtrV(
Context.FontAtlas.RegisterString(p.label),
&p.xs,
&p.ys,
utils.SliceToPtr(p.xs),
utils.SliceToPtr(p.ys),
int32(len(p.xs)),
0, // TODO: implement
int32(p.offset),
Expand Down
3 changes: 2 additions & 1 deletion examples/paint/toolbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/fs"

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

g "github.com/AllenDang/giu"
)
Expand Down Expand Up @@ -112,7 +113,7 @@ func colorPopup(ce *color.RGBA, fe g.ColorEditFlags) {
g.Context.FontAtlas.RegisterString("##COLOR_POPUP##me"),
&col,
imgui.ColorEditFlags(fe),
refCol,
utils.SliceToPtr(refCol),
) {
*ce = g.Vec4ToRGBA(imgui.Vec4{
X: col[0],
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.0
toolchain go1.23.1

require (
github.com/AllenDang/cimgui-go v1.0.4-0.20241026200445-990a0e771992
github.com/AllenDang/cimgui-go v1.1.0
github.com/AllenDang/go-findfont v0.0.0-20200702051237-9f180485aeb8
github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3
github.com/mazznoer/csscolorparser v0.1.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/AllenDang/cimgui-go v1.0.4-0.20241026200445-990a0e771992 h1:gLSKrpQ89PEJQ9t2EzTcblz7qsAQvLoCjDLdt5s7RFI=
github.com/AllenDang/cimgui-go v1.0.4-0.20241026200445-990a0e771992/go.mod h1:aY20nGDN5w+zaGAmRV24bKI/OYVmEptB0qlr5z/0OoI=
github.com/AllenDang/cimgui-go v1.1.0 h1:hltblxjy6Q+/TxOQLjI45yVlCn/DQSC9DLTtKc8PhfQ=
github.com/AllenDang/cimgui-go v1.1.0/go.mod h1:v5iftKz+rJRG6TArxibxqqOhVqUyzMkqbX90iC2Mqe0=
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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
Loading