Skip to content

Commit

Permalink
update implot func names
Browse files Browse the repository at this point in the history
sed -i -e 's/implot\.Plot/implot\./g' -e 's/imnodes\.ImNodes/imnodes\./g' *go
  • Loading branch information
gucio321 committed Nov 5, 2024
1 parent e635f21 commit 106165f
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 126 deletions.
70 changes: 35 additions & 35 deletions Flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,47 +471,47 @@ const (
SliderFlagsInvalidMask = SliderFlags(imgui.SliderFlagsInvalidMask)
)

// PlotFlags represents implot.PlotFlags.
type PlotFlags implot.PlotFlags
// PlotFlags represents implot.Flags.
type PlotFlags implot.Flags

// plot flags.
const (
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)
PlotFlagsNone = PlotFlags(implot.FlagsNone)
PlotFlagsNoTitle = PlotFlags(implot.FlagsNoTitle)
PlotFlagsNoLegend = PlotFlags(implot.FlagsNoLegend)
PlotFlagsNoMenus = PlotFlags(implot.FlagsNoMenus)
PlotFlagsNoBoxSelect = PlotFlags(implot.FlagsNoBoxSelect)
// PlotFlagsNoMousePos = PlotFlags(implot.FlagsNoMousePos)
// PlotFlagsNoHighlight = PlotFlags(implot.FlagsNoHighlight)
// PlotFlagsNoChild = PlotFlags(implot.FlagsNoChild).
PlotFlagsEqual = PlotFlags(implot.FlagsEqual)
// PlotFlagsYAxis2 = PlotFlags(implot.FlagsYAxis2)
// PlotFlagsYAxis3 = PlotFlags(implot.FlagsYAxis3)
// PlotFlagsQuery = PlotFlags(implot.FlagsQuery)
PlotFlagsCrosshairs = PlotFlags(implot.FlagsCrosshairs)
// PlotFlagsAntiAliased = PlotFlags(implot.FlagsAntiAliased)
PlotFlagsCanvasOnly = PlotFlags(implot.FlagsCanvasOnly)
)

// PlotAxisFlags represents implot.PlotAxisFlags.
type PlotAxisFlags implot.PlotAxisFlags
// PlotAxisFlags represents implot.AxisFlags.
type PlotAxisFlags implot.AxisFlags

// plot axis flags.
const (
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)
PlotAxisFlagsNone PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNone)
PlotAxisFlagsNoLabel PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoLabel)
PlotAxisFlagsNoGridLines PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoGridLines)
PlotAxisFlagsNoTickMarks PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoTickMarks)
PlotAxisFlagsNoTickLabels PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoTickLabels)
PlotAxisFlagsForeground PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsForeground)
// PlotAxisFlagsLogScale PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLogScale)
// PlotAxisFlagsTime PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsTime)
PlotAxisFlagsInvert PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsInvert)
PlotAxisFlagsNoInitialFit PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoInitialFit)
PlotAxisFlagsAutoFit PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsAutoFit)
PlotAxisFlagsRangeFit PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsRangeFit)
PlotAxisFlagsLockMin PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLockMin)
PlotAxisFlagsLockMax PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLockMax)
PlotAxisFlagsLock PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLock)
PlotAxisFlagsNoDecorations PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoDecorations)
)
8 changes: 4 additions & 4 deletions MasterWindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ type MasterWindow struct {
func NewMasterWindow(title string, width, height int, flags MasterWindowFlags) *MasterWindow {
imGuiContext := imgui.CreateContext()

implot.PlotCreateContext()
imnodes.ImNodesCreateContext()
implot.CreateContext()
imnodes.CreateContext()

io := imgui.CurrentIO()

Expand Down Expand Up @@ -226,8 +226,8 @@ func (w *MasterWindow) afterRender() {
}

func (w *MasterWindow) beforeDestroy() {
implot.PlotDestroyContext()
imnodes.ImNodesDestroyContext()
implot.DestroyContext()
imnodes.DestroyContext()
}

func (w *MasterWindow) render() {
Expand Down
66 changes: 33 additions & 33 deletions Plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

type (
// PlotXAxis allows to chose X axis.
PlotXAxis = implot.PlotAxisEnum
PlotXAxis = implot.AxisEnum
// PlotYAxis allows to chose Y axis.
PlotYAxis = implot.PlotAxisEnum
PlotYAxis = implot.AxisEnum
)

// Available axes.
Expand Down Expand Up @@ -218,26 +218,26 @@ func (p *PlotCanvasWidget) Build() {
return
}

if implot.PlotBeginPlotV(
if implot.BeginPlotV(
Context.FontAtlas.RegisterString(p.title),
ToVec2(image.Pt(p.width, p.height)),
implot.PlotFlags(p.flags),
implot.Flags(p.flags),
) {
implot.PlotSetupAxisLimitsV(
implot.SetupAxisLimitsV(
implot.AxisX1,
p.xMin,
p.xMax,
implot.PlotCond(p.axisLimitCondition),
implot.Cond(p.axisLimitCondition),
)
implot.PlotSetupAxisLimitsV(
implot.SetupAxisLimitsV(
implot.AxisY1,
p.yMin,
p.yMax,
implot.PlotCond(p.axisLimitCondition),
implot.Cond(p.axisLimitCondition),
)

if len(p.xTicksValue) > 0 {
implot.PlotSetupAxisTicksdoublePtrV(
implot.SetupAxisTicksdoublePtrV(
implot.AxisX1,
utils.SliceToPtr(p.xTicksValue),
int32(len(p.xTicksValue)),
Expand All @@ -247,7 +247,7 @@ func (p *PlotCanvasWidget) Build() {
}

if len(p.yTicksValue) > 0 {
implot.PlotSetupAxisTicksdoublePtrV(
implot.SetupAxisTicksdoublePtrV(
implot.AxisY1,
utils.SliceToPtr(p.yTicksValue),
int32(len(p.yTicksValue)),
Expand All @@ -256,46 +256,46 @@ func (p *PlotCanvasWidget) Build() {
)
}

implot.PlotSetupAxisV(
implot.SetupAxisV(
implot.AxisX1,
Context.FontAtlas.RegisterString(p.xLabel),
implot.PlotAxisFlags(p.xFlags),
implot.AxisFlags(p.xFlags),
)

implot.PlotSetupAxisV(
implot.SetupAxisV(
implot.AxisY1,
Context.FontAtlas.RegisterString(p.yLabel),
implot.PlotAxisFlags(p.yFlags),
implot.AxisFlags(p.yFlags),
)

if p.y2Label != "" {
implot.PlotSetupAxisV(
implot.SetupAxisV(
implot.AxisY2,
Context.FontAtlas.RegisterString(p.y2Label),
implot.PlotAxisFlags(p.y2Flags),
implot.AxisFlags(p.y2Flags),
)
}

if p.y3Label != "" {
implot.PlotSetupAxisV(
implot.SetupAxisV(
implot.AxisY3,
Context.FontAtlas.RegisterString(p.y3Label),
implot.PlotAxisFlags(p.y3Flags),
implot.AxisFlags(p.y3Flags),
)
}

for _, plot := range p.plots {
plot.Plot()
}

implot.PlotEndPlot()
implot.EndPlot()
}
}

// SwitchPlotAxes switches plot axes.
func SwitchPlotAxes(x PlotXAxis, y PlotYAxis) PlotWidget {
return Custom(func() {
implot.PlotSetAxes(x, y)
implot.SetAxes(x, y)
})
}

Expand Down Expand Up @@ -339,7 +339,7 @@ func (p *BarPlot) Offset(offset int) *BarPlot {

// Plot implements Plot interface.
func (p *BarPlot) Plot() {
implot.PlotPlotBarsdoublePtrIntV(
implot.PlotBarsdoublePtrIntV(
p.title,
utils.SliceToPtr(p.data),
int32(len(p.data)),
Expand Down Expand Up @@ -391,13 +391,13 @@ func (p *BarHPlot) Offset(offset int) *BarHPlot {

// Plot implements plot interface.
func (p *BarHPlot) Plot() {
implot.PlotPlotBarsdoublePtrIntV(
implot.PlotBarsdoublePtrIntV(
Context.FontAtlas.RegisterString(p.title),
utils.SliceToPtr(p.data),
int32(len(p.data)),
p.height,
p.shift,
implot.PlotBarsFlagsHorizontal,
implot.BarsFlagsHorizontal,
int32(p.offset),
0,
)
Expand Down Expand Up @@ -449,11 +449,11 @@ func (p *LinePlot) Offset(offset int) *LinePlot {

// Plot implements Plot interface.
func (p *LinePlot) Plot() {
implot.PlotSetAxis(
implot.PlotAxisEnum(p.yAxis),
implot.SetAxis(
implot.AxisEnum(p.yAxis),
)

implot.PlotPlotLinedoublePtrIntV(
implot.PlotLinedoublePtrIntV(
Context.FontAtlas.RegisterString(p.title),
utils.SliceToPtr(p.values),
int32(len(p.values)),
Expand Down Expand Up @@ -497,8 +497,8 @@ func (p *LineXYPlot) Offset(offset int) *LineXYPlot {

// Plot implements Plot interface.
func (p *LineXYPlot) Plot() {
implot.PlotSetAxis(implot.PlotAxisEnum(p.yAxis))
implot.PlotPlotLinedoublePtrdoublePtrV(
implot.SetAxis(implot.AxisEnum(p.yAxis))
implot.PlotLinedoublePtrdoublePtrV(
Context.FontAtlas.RegisterString(p.title),
utils.SliceToPtr(p.xs),
utils.SliceToPtr(p.ys),
Expand Down Expand Up @@ -554,12 +554,12 @@ func (p *PieChartPlot) Angle0(a float64) *PieChartPlot {

// Plot implements Plot interface.
func (p *PieChartPlot) Plot() {
var flags implot.PlotPieChartFlags
var flags implot.PieChartFlags
if p.normalize {
flags |= implot.PlotPieChartFlagsNormalize
flags |= implot.PieChartFlagsNormalize
}

implot.PlotPlotPieChartdoublePtrStrV(
implot.PlotPieChartdoublePtrStrV(
Context.FontAtlas.RegisterStringSlice(p.labels),
utils.SliceToPtr(p.values),
int32(len(p.values)),
Expand Down Expand Up @@ -611,7 +611,7 @@ func (p *ScatterPlot) Offset(offset int) *ScatterPlot {

// Plot implements Plot interface.
func (p *ScatterPlot) Plot() {
implot.PlotPlotScatterdoublePtrIntV(
implot.PlotScatterdoublePtrIntV(
Context.FontAtlas.RegisterString(p.label),
utils.SliceToPtr(p.values),
int32(len(p.values)),
Expand Down Expand Up @@ -648,7 +648,7 @@ func (p *ScatterXYPlot) Offset(offset int) *ScatterXYPlot {

// Plot implements Plot interface.
func (p *ScatterXYPlot) Plot() {
implot.PlotPlotScatterdoublePtrdoublePtrV(
implot.PlotScatterdoublePtrdoublePtrV(
Context.FontAtlas.RegisterString(p.label),
utils.SliceToPtr(p.xs),
utils.SliceToPtr(p.ys),
Expand Down
Loading

0 comments on commit 106165f

Please sign in to comment.