Skip to content

Commit bda35fa

Browse files
committed
add AddCircle() and AddCircleV()
1 parent 73a7134 commit bda35fa

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

DrawList.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,19 @@ func (list DrawList) AddCircleFilled(center Vec2, radius float32, col uint32) {
144144

145145
// AddCircleFilledV adds a filled circle to the draw list. min is the
146146
// upper-left corner of the rectangle, and max is the lower right corner.
147-
// rectangles with dimensions of 1 pixel are not rendererd properly.
148147
func (list DrawList) AddCircleFilledV(center Vec2, radius float32, col uint32, numSegments int) {
149148
centerArg, _ := center.wrapped()
150149
C.iggAddCircleFilled(list.handle(), centerArg, C.float(radius), C.ImU32(col), C.int(numSegments))
151150
}
151+
152+
// AddCircle calls addCircleV with a numSegments value of 12
153+
func (list DrawList) AddCircle(center Vec2, radius float32, col uint32) {
154+
list.AddCircleV(center, radius, col, 12, 1.0)
155+
}
156+
157+
// AddCircleV adds a unfilled circle to the draw list. min is the upper-left
158+
// corner of the rectangle, and max is the lower right corner.
159+
func (list DrawList) AddCircleV(center Vec2, radius float32, col uint32, numSegments int, thickness float32) {
160+
centerArg, _ := center.wrapped()
161+
C.iggAddCircle(list.handle(), centerArg, C.float(radius), C.ImU32(col), C.int(numSegments), C.float(thickness))
162+
}

DrawListWrapper.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ void iggAddRectFilled(IggDrawList handle, IggVec2 const *min, IggVec2 const *max
5959
list->AddRectFilled(*minArg, *maxArg, col, rounding, flags);
6060
}
6161

62+
void iggAddCircle(IggDrawList handle, IggVec2 const *center, float radius, ImU32 col, int numSegments, float thickness)
63+
{
64+
Vec2Wrapper centerArg(center);
65+
66+
ImDrawList *list = reinterpret_cast<ImDrawList *>(handle);
67+
list->AddCircle(*centerArg, radius, col, numSegments, thickness);
68+
}
69+
6270
void iggAddCircleFilled(IggDrawList handle, IggVec2 const *center, float radius, ImU32 col, int numSegments)
6371
{
6472
Vec2Wrapper centerArg(center);

DrawListWrapper.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern void iggGetVertexBufferLayout(size_t *entrySize, size_t *posOffset, size_
1717

1818
extern void iggAddRect(IggDrawList handle, IggVec2 const *min, IggVec2 const *max, ImU32 col, float rounding, int flags, float thickness);
1919
extern void iggAddRectFilled(IggDrawList handle, IggVec2 const *min, IggVec2 const *max, ImU32 col, float rounding, int flags);
20+
extern void iggAddCircle(IggDrawList handle, IggVec2 const *center, float radius, ImU32 col, int numSegments, float thickness);
2021
extern void iggAddCircleFilled(IggDrawList handle, IggVec2 const *center, float radius, ImU32 col, int numSegments);
2122

2223
extern IggDrawList iggGetWindowDrawList();

0 commit comments

Comments
 (0)