Skip to content

Commit 4300fc4

Browse files
committed
Add bindings for cf_draw_circle_fill and cf_draw_circle_fill2 functions
1 parent 8ed9f1c commit 4300fc4

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docstub/circle.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,19 @@ def self.cf_draw_circle(circle, thickness)
7373
# @return [nil]
7474
def self.cf_draw_circle2(position, radius, thickness)
7575
end
76+
77+
# @method cf_draw_circle_fill
78+
# @brief Draws a filled circle
79+
# @param [Circle] circle The circle to draw
80+
# @return [nil]
81+
def self.cf_draw_circle_fill(circle)
82+
end
83+
84+
# @method cf_draw_circle_fill2
85+
# @brief Draws a filled circle with the specified position and radius
86+
# @param [V2] position The position vector for the center of the circle
87+
# @param [Float] radius The radius of the circle
88+
# @return [nil]
89+
def self.cf_draw_circle_fill2(position, radius)
90+
end
7691
end

src/draw.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,33 @@ static mrb_value mrb_cf_draw_circle2(mrb_state* mrb, mrb_value self)
156156
return mrb_nil_value();
157157
}
158158

159+
static mrb_value mrb_cf_draw_circle_fill(mrb_state* mrb, mrb_value self)
160+
{
161+
mrb_value circle_obj;
162+
163+
mrb_get_args(mrb, "o", &circle_obj);
164+
165+
CF_Circle* circle = mrb_cf_circle_unwrap(mrb, circle_obj);
166+
167+
cf_draw_circle_fill(*circle);
168+
169+
return mrb_nil_value();
170+
}
171+
172+
static mrb_value mrb_cf_draw_circle_fill2(mrb_state* mrb, mrb_value self)
173+
{
174+
mrb_value position_obj;
175+
mrb_float radius;
176+
177+
mrb_get_args(mrb, "of", &position_obj, &radius);
178+
179+
CF_V2* position = mrb_cf_v2_unwrap(mrb, position_obj);
180+
181+
cf_draw_circle_fill2(*position, (float)radius);
182+
183+
return mrb_nil_value();
184+
}
185+
159186
static mrb_value mrb_cf_draw_text(mrb_state* mrb, mrb_value self)
160187
{
161188
mrb_value position_obj;
@@ -268,6 +295,8 @@ void mrb_cute_draw_init(mrb_state* mrb, struct RClass* mCute)
268295
mrb_define_module_function(mrb, mCute, "cf_draw_quad2", mrb_cf_draw_quad2, MRB_ARGS_REQ(6));
269296
mrb_define_module_function(mrb, mCute, "cf_draw_circle", mrb_cf_draw_circle, MRB_ARGS_REQ(2));
270297
mrb_define_module_function(mrb, mCute, "cf_draw_circle2", mrb_cf_draw_circle2, MRB_ARGS_REQ(3));
298+
mrb_define_module_function(mrb, mCute, "cf_draw_circle_fill", mrb_cf_draw_circle_fill, MRB_ARGS_REQ(1));
299+
mrb_define_module_function(mrb, mCute, "cf_draw_circle_fill2", mrb_cf_draw_circle_fill2, MRB_ARGS_REQ(2));
271300
mrb_define_module_function(mrb, mCute, "cf_draw_text", mrb_cf_draw_text, MRB_ARGS_ARG(2, 1));
272301

273302
// Font functions

0 commit comments

Comments
 (0)