Skip to content

Commit

Permalink
update(cimgui-go): handle breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Oct 29, 2024
1 parent 6cbdf32 commit a3fc6ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
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

0 comments on commit a3fc6ed

Please sign in to comment.