126 } |
126 } |
127 |
127 |
128 AscSceneNode *asc_rectangle_create(struct asc_rectangle_create_args args) { |
128 AscSceneNode *asc_rectangle_create(struct asc_rectangle_create_args args) { |
129 AscRectangle *rectangle = cxZallocDefault(sizeof(AscRectangle)); |
129 AscRectangle *rectangle = cxZallocDefault(sizeof(AscRectangle)); |
130 |
130 |
131 float pos_x, pos_y; |
131 float pos_x = (float) args.x; |
132 if (args.bounds.size.width + args.bounds.size.height > 0) { |
132 float pos_y = (float) args.y; |
133 // TODO: this is probably bugged, because it does not respect the origin |
133 rectangle->size.width = (float) args.width; |
134 pos_x = (float) args.bounds.pos.x; |
134 rectangle->size.height = (float) args.height; |
135 pos_y = (float) args.bounds.pos.y; |
|
136 rectangle->size.width = (float) args.bounds.size.width; |
|
137 rectangle->size.height = (float) args.bounds.size.height; |
|
138 } else { |
|
139 pos_x = (float) args.x; |
|
140 pos_y = (float) args.y; |
|
141 rectangle->size.width = (float) args.width; |
|
142 rectangle->size.height = (float) args.height; |
|
143 } |
|
144 |
135 |
145 rectangle->radius = (float)args.radius; |
136 rectangle->radius = (float)args.radius; |
146 rectangle->filled = args.filled; |
137 rectangle->filled = args.filled; |
147 if (!args.filled && args.thickness == 0) { |
138 if (!args.filled && args.thickness == 0) { |
148 // when we do not fill the rectangle, we need a border |
139 // when we do not fill the rectangle, we need a border |