-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgraphics_gen.nim
5310 lines (4760 loc) · 183 KB
/
graphics_gen.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#--- SFML/Graphics ---#
#--- SFML/Graphics/BlendMode ---#
type BlendFactor* {.pure, size: sizeof(cint).} = enum ## Enumeration of the blending factors
Zero, One, SrcColor, OneMinusSrcColor, DstColor, OneMinusDstColor, SrcAlpha,
OneMinusSrcAlpha, DstAlpha, OneMinusDstAlpha
type BlendEquation* {.pure, size: sizeof(cint).} = enum ## Enumeration of the blending equations
Add, Subtract, ReverseSubtract
type BlendMode* {.bycopy.} = object
## Blending mode for drawing
colorSrcFactor*: BlendFactor
colorDstFactor*: BlendFactor
colorEquation*: BlendEquation
alphaSrcFactor*: BlendFactor
alphaDstFactor*: BlendFactor
alphaEquation*: BlendEquation
#--- SFML/Graphics/CircleShape ---#
#--- SFML/Graphics/Color ---#
type Color* {.bycopy.} = object
## Utility class for manpulating RGBA colors
r*: uint8
g*: uint8
b*: uint8
a*: uint8
proc color*(red: uint8, green: uint8, blue: uint8): Color {.
cdecl, importc: "sfColor_fromRGB".}
## Construct a color from its 3 RGB components
##
## *Arguments*:
## - ``red``: Red component (0 .. 255)
## - ``green``: Green component (0 .. 255)
## - ``blue``: Blue component (0 .. 255)
##
## *Returns:* Color constructed from the components
proc color*(red: uint8, green: uint8, blue: uint8, alpha: uint8): Color {.
cdecl, importc: "sfColor_fromRGBA".}
## Construct a color from its 4 RGBA components
##
## *Arguments*:
## - ``red``: Red component (0 .. 255)
## - ``green``: Green component (0 .. 255)
## - ``blue``: Blue component (0 .. 255)
## - ``alpha``: Alpha component (0 .. 255)
##
## *Returns:* Color constructed from the components
proc color*(color: uint32): Color {.
cdecl, importc: "sfColor_fromInteger".}
## Construct the color from 32-bit unsigned integer
##
## *Arguments*:
## - ``color``: Number containing the RGBA components (in that order)
##
## *Returns:* Color constructed from the 32-bit unsigned integer
proc toInteger*(color: Color): uint32 {.
cdecl, importc: "sfColor_toInteger".}
## Convert a color to a 32-bit unsigned integer
##
## *Returns:* Color represented as a 32-bit unsigned integer
proc add*(color1: Color, color2: Color): Color {.
cdecl, importc: "sfColor_add".}
## Add two colors
##
## *Arguments*:
## - ``color1``: First color
## - ``color2``: Second color
##
## *Returns:* Component-wise saturated addition of the two colors
proc subtract*(color1: Color, color2: Color): Color {.
cdecl, importc: "sfColor_subtract".}
## Subtract two colors
##
## *Arguments*:
## - ``color1``: First color
## - ``color2``: Second color
##
## *Returns:* Component-wise saturated subtraction of the two colors
proc modulate*(color1: Color, color2: Color): Color {.
cdecl, importc: "sfColor_modulate".}
## Modulate two colors
##
## *Arguments*:
## - ``color1``: First color
## - ``color2``: Second color
##
## *Returns:* Component-wise multiplication of the two colors
#--- SFML/Graphics/Rect ---#
type FloatRect* {.bycopy.} = object
left*: cfloat
top*: cfloat
width*: cfloat
height*: cfloat
type IntRect* {.bycopy.} = object
left*: cint
top*: cint
width*: cint
height*: cint
proc contains*(rect: (var FloatRect){lvalue}, x: cfloat, y: cfloat): BoolInt {.
cdecl, importc: "sfFloatRect_contains".}
proc contains*(rect: FloatRect, x: cfloat, y: cfloat): BoolInt =
## Check if a point is inside a rectangle's area
##
## *Arguments*:
## - ``rect``: Rectangle to test
## - ``x``: X coordinate of the point to test
## - ``y``: Y coordinate of the point to test
##
## *Returns:* True if the point is inside
(var Crect = rect)
contains(Crect, x, y)
proc contains*(rect: (var IntRect){lvalue}, x: cint, y: cint): BoolInt {.
cdecl, importc: "sfIntRect_contains".}
proc contains*(rect: IntRect, x: cint, y: cint): BoolInt =
(var Crect = rect)
contains(Crect, x, y)
proc intersects*(rect1: (var FloatRect){lvalue}, rect2: (var FloatRect){lvalue}, intersection: var FloatRect): BoolInt {.
cdecl, importc: "sfFloatRect_intersects".}
proc intersects*(rect1: (var FloatRect){lvalue}, rect2: FloatRect, intersection: var FloatRect): BoolInt =
(var Crect2 = rect2)
intersects(rect1, Crect2, intersection)
proc intersects*(rect1: FloatRect, rect2: (var FloatRect){lvalue}, intersection: var FloatRect): BoolInt =
(var Crect1 = rect1)
intersects(Crect1, rect2, intersection)
proc intersects*(rect1: FloatRect, rect2: FloatRect, intersection: var FloatRect): BoolInt =
## Check intersection between two rectangles
##
## *Arguments*:
## - ``rect1``: First rectangle to test
## - ``rect2``: Second rectangle to test
## - ``intersection``: Rectangle to be filled with overlapping rect (can be NULL)
##
## *Returns:* True if rectangles overlap
(var Crect1 = rect1; var Crect2 = rect2)
intersects(Crect1, Crect2, intersection)
proc intersects*(rect1: (var IntRect){lvalue}, rect2: (var IntRect){lvalue}, intersection: var IntRect): BoolInt {.
cdecl, importc: "sfIntRect_intersects".}
proc intersects*(rect1: (var IntRect){lvalue}, rect2: IntRect, intersection: var IntRect): BoolInt =
(var Crect2 = rect2)
intersects(rect1, Crect2, intersection)
proc intersects*(rect1: IntRect, rect2: (var IntRect){lvalue}, intersection: var IntRect): BoolInt =
(var Crect1 = rect1)
intersects(Crect1, rect2, intersection)
proc intersects*(rect1: IntRect, rect2: IntRect, intersection: var IntRect): BoolInt =
(var Crect1 = rect1; var Crect2 = rect2)
intersects(Crect1, Crect2, intersection)
#--- SFML/Graphics/Transform ---#
#--- SFML/Graphics/Types ---#
type CircleShape* = ptr object
type ConvexShape* = ptr object
type Font* = ptr object
type Image* = ptr object
type Shader* = ptr object
type RectangleShape* = ptr object
type RenderTexture* = ptr object
type RenderWindow* = ptr object
type Shape* = ptr object
type Sprite* = ptr object
type Text* = ptr object
type Texture* = ptr object
type Transformable* = ptr object
type VertexArray* = ptr object
type VertexBuffer* = ptr object
type View* = ptr object
type Transform* {.bycopy.} = object
## Encapsulate a 3x3 transform matrix
matrix*: array[9, cfloat]
proc transform*(a00: cfloat, a01: cfloat, a02: cfloat, a10: cfloat, a11: cfloat, a12: cfloat, a20: cfloat, a21: cfloat, a22: cfloat): Transform {.
cdecl, importc: "sfTransform_fromMatrix".}
## Create a new transform from a matrix
##
## *Arguments*:
## - ``a00``: Element (0, 0) of the matrix
## - ``a01``: Element (0, 1) of the matrix
## - ``a02``: Element (0, 2) of the matrix
## - ``a10``: Element (1, 0) of the matrix
## - ``a11``: Element (1, 1) of the matrix
## - ``a12``: Element (1, 2) of the matrix
## - ``a20``: Element (2, 0) of the matrix
## - ``a21``: Element (2, 1) of the matrix
## - ``a22``: Element (2, 2) of the matrix
##
## *Returns:* A new Transform object
proc getMatrix*(transform: (var Transform){lvalue}, matrix: ptr cfloat) {.
cdecl, importc: "sfTransform_getMatrix".}
proc getMatrix*(transform: Transform, matrix: ptr cfloat) =
## Return the 4x4 matrix of a transform
##
## This function fills an array of 16 floats with the transform
## converted as a 4x4 matrix, which is directly compatible with
## OpenGL functions.
##
##
## *Arguments*:
## - ``transform``: Transform object
## - ``matrix``: Pointer to the 16-element array to fill with the matrix
(var Ctransform = transform)
getMatrix(Ctransform, matrix)
proc inverse*(transform: (var Transform){lvalue}): Transform {.
cdecl, importc: "sfTransform_getInverse".}
proc inverse*(transform: Transform): Transform =
## Return the inverse of a transform
##
## If the inverse cannot be computed, a new identity transform
## is returned.
##
## *Arguments*:
## - ``transform``: Transform object
## *Returns:* The inverse matrix
(var Ctransform = transform)
inverse(Ctransform)
proc transformPoint*(transform: (var Transform){lvalue}, point: Vector2f): Vector2f {.
cdecl, importc: "sfTransform_transformPoint".}
proc transformPoint*(transform: Transform, point: Vector2f): Vector2f =
## Apply a transform to a 2D point
##
## *Arguments*:
## - ``transform``: Transform object
## - ``point``: Point to transform
##
## *Returns:* Transformed point
(var Ctransform = transform)
transformPoint(Ctransform, point)
proc transformRect*(transform: (var Transform){lvalue}, rectangle: FloatRect): FloatRect {.
cdecl, importc: "sfTransform_transformRect".}
proc transformRect*(transform: Transform, rectangle: FloatRect): FloatRect =
## Apply a transform to a rectangle
##
## Since SFML doesn't provide support for oriented rectangles,
## the result of this function is always an axis-aligned
## rectangle. Which means that if the transform contains a
## rotation, the bounding rectangle of the transformed rectangle
## is returned.
##
## *Arguments*:
## - ``transform``: Transform object
## - ``rectangle``: Rectangle to transform
##
## *Returns:* Transformed rectangle
(var Ctransform = transform)
transformRect(Ctransform, rectangle)
proc combine*(transform: var Transform, other: (var Transform){lvalue}) {.
cdecl, importc: "sfTransform_combine".}
proc combine*(transform: var Transform, other: Transform) =
## Combine two transforms
##
## The result is a transform that is equivalent to applying
## ``transform`` followed by ``other``. Mathematically, it is
## equivalent to a matrix multiplication.
##
## *Arguments*:
## - ``transform``: Transform object
## - ``other``: Transform to combine to ``transform``
(var Cother = other)
combine(transform, Cother)
proc translate*(transform: var Transform, x: cfloat, y: cfloat) {.
cdecl, importc: "sfTransform_translate".}
## Combine a transform with a translation
##
## *Arguments*:
## - ``transform``: Transform object
## - ``x``: Offset to apply on X axis
## - ``y``: Offset to apply on Y axis
proc rotate*(transform: var Transform, angle: cfloat) {.
cdecl, importc: "sfTransform_rotate".}
## Combine the current transform with a rotation
##
## *Arguments*:
## - ``transform``: Transform object
## - ``angle``: Rotation angle, in degrees
proc rotate*(transform: var Transform, angle: cfloat, centerX: cfloat, centerY: cfloat) {.
cdecl, importc: "sfTransform_rotateWithCenter".}
## Combine the current transform with a rotation
##
## The center of rotation is provided for convenience as a second
## argument, so that you can build rotations around arbitrary points
## more easily (and efficiently) than the usual
## [translate(-center), rotate(angle), translate(center)].
##
## *Arguments*:
## - ``transform``: Transform object
## - ``angle``: Rotation angle, in degrees
## - ``centerX``: X coordinate of the center of rotation
## - ``centerY``: Y coordinate of the center of rotation
proc scale*(transform: var Transform, scaleX: cfloat, scaleY: cfloat) {.
cdecl, importc: "sfTransform_scale".}
## Combine the current transform with a scaling
##
## *Arguments*:
## - ``transform``: Transform object
## - ``scaleX``: Scaling factor on the X axis
## - ``scaleY``: Scaling factor on the Y axis
proc scale*(transform: var Transform, scaleX: cfloat, scaleY: cfloat, centerX: cfloat, centerY: cfloat) {.
cdecl, importc: "sfTransform_scaleWithCenter".}
## Combine the current transform with a scaling
##
## The center of scaling is provided for convenience as a second
## argument, so that you can build scaling around arbitrary points
## more easily (and efficiently) than the usual
## [translate(-center), scale(factors), translate(center)]
##
## *Arguments*:
## - ``transform``: Transform object
## - ``scaleX``: Scaling factor on X axis
## - ``scaleY``: Scaling factor on Y axis
## - ``centerX``: X coordinate of the center of scaling
## - ``centerY``: Y coordinate of the center of scaling
proc equal*(left: var Transform, right: var Transform): BoolInt {.
cdecl, importc: "sfTransform_equal".}
## Compare two transforms for equality
##
## Performs an element-wise comparison of the elements of the
## left transform with the elements of the right transform.
##
## *Arguments*:
## - ``left``: Left operand (the first transform)
## - ``right``: Right operand (the second transform)
##
## *Returns:* true if the transforms are equal, false otherwise
proc newCircleShape*(): CircleShape {.
cdecl, importc: "sfCircleShape_create".}
## Create a new circle shape
##
## *Returns:* A new CircleShape object, or NULL if it failed
proc copy*(shape: CircleShape): CircleShape {.
cdecl, importc: "sfCircleShape_copy".}
## Copy an existing circle shape
##
## *Arguments*:
## - ``shape``: Shape to copy
##
## *Returns:* Copied object
proc destroy*(shape: CircleShape) {.
cdecl, importc: "sfCircleShape_destroy".}
## Destroy an existing circle Shape
##
## *Arguments*:
## - ``shape``: Shape to delete
proc `position=`*(shape: CircleShape, position: Vector2f) {.
cdecl, importc: "sfCircleShape_setPosition".}
## Set the position of a circle shape
##
## This function completely overwrites the previous position.
## See CircleShape_move to apply an offset based on the previous position instead.
## The default position of a circle Shape object is (0, 0).
##
## *Arguments*:
## - ``shape``: Shape object
## - ``position``: New position
proc `rotation=`*(shape: CircleShape, angle: cfloat) {.
cdecl, importc: "sfCircleShape_setRotation".}
## Set the orientation of a circle shape
##
## This function completely overwrites the previous rotation.
## See CircleShape_rotate to add an angle based on the previous rotation instead.
## The default rotation of a circle Shape object is 0.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``angle``: New rotation, in degrees
proc `scale=`*(shape: CircleShape, scale: Vector2f) {.
cdecl, importc: "sfCircleShape_setScale".}
## Set the scale factors of a circle shape
##
## This function completely overwrites the previous scale.
## See CircleShape_scale to add a factor based on the previous scale instead.
## The default scale of a circle Shape object is (1, 1).
##
## *Arguments*:
## - ``shape``: Shape object
## - ``scale``: New scale factors
proc `origin=`*(shape: CircleShape, origin: Vector2f) {.
cdecl, importc: "sfCircleShape_setOrigin".}
## Set the local origin of a circle shape
##
## The origin of an object defines the center point for
## all transformations (position, scale, rotation).
## The coordinates of this point must be relative to the
## top-left corner of the object, and ignore all
## transformations (position, scale, rotation).
## The default origin of a circle Shape object is (0, 0).
##
## *Arguments*:
## - ``shape``: Shape object
## - ``origin``: New origin
proc position*(shape: CircleShape): Vector2f {.
cdecl, importc: "sfCircleShape_getPosition".}
## Get the position of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current position
proc rotation*(shape: CircleShape): cfloat {.
cdecl, importc: "sfCircleShape_getRotation".}
## Get the orientation of a circle shape
##
## The rotation is always in the range [0, 360].
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current rotation, in degrees
proc scale*(shape: CircleShape): Vector2f {.
cdecl, importc: "sfCircleShape_getScale".}
## Get the current scale of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current scale factors
proc origin*(shape: CircleShape): Vector2f {.
cdecl, importc: "sfCircleShape_getOrigin".}
## Get the local origin of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current origin
proc move*(shape: CircleShape, offset: Vector2f) {.
cdecl, importc: "sfCircleShape_move".}
## Move a circle shape by a given offset
##
## This function adds to the current position of the object,
## unlike CircleShape_setPosition which overwrites it.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``offset``: Offset
proc rotate*(shape: CircleShape, angle: cfloat) {.
cdecl, importc: "sfCircleShape_rotate".}
## Rotate a circle shape
##
## This function adds to the current rotation of the object,
## unlike CircleShape_setRotation which overwrites it.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``angle``: Angle of rotation, in degrees
proc scale*(shape: CircleShape, factors: Vector2f) {.
cdecl, importc: "sfCircleShape_scale".}
## Scale a circle shape
##
## This function multiplies the current scale of the object,
## unlike CircleShape_setScale which overwrites it.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``factors``: Scale factors
proc transform*(shape: CircleShape): Transform {.
cdecl, importc: "sfCircleShape_getTransform".}
## Get the combined transform of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Transform combining the position/rotation/scale/origin of the object
proc inverseTransform*(shape: CircleShape): Transform {.
cdecl, importc: "sfCircleShape_getInverseTransform".}
## Get the inverse of the combined transform of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Inverse of the combined transformations applied to the object
proc setTexture*(shape: CircleShape, texture: Texture, resetRect: BoolInt) {.
cdecl, importc: "sfCircleShape_setTexture".}
## Change the source texture of a circle shape
##
## The ``texture`` argument refers to a texture that must
## exist as long as the shape uses it. Indeed, the shape
## doesn't store its own copy of the texture, but rather keeps
## a pointer to the one that you passed to this function.
## If the source texture is destroyed and the shape tries to
## use it, the behaviour is undefined.
## ``texture`` can be NULL to disable texturing.
## If ``resetRect`` is true, the TextureRect property of
## the shape is automatically adjusted to the size of the new
## texture. If it is false, the texture rect is left unchanged.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``texture``: New texture
## - ``resetRect``: Should the texture rect be reset to the size of the new texture?
proc `textureRect=`*(shape: CircleShape, rect: IntRect) {.
cdecl, importc: "sfCircleShape_setTextureRect".}
## Set the sub-rectangle of the texture that a circle shape will display
##
## The texture rect is useful when you don't want to display
## the whole texture, but rather a part of it.
## By default, the texture rect covers the entire texture.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``rect``: Rectangle defining the region of the texture to display
proc `fillColor=`*(shape: CircleShape, color: Color) {.
cdecl, importc: "sfCircleShape_setFillColor".}
## Set the fill color of a circle shape
##
## This color is modulated (multiplied) with the shape's
## texture if any. It can be used to colorize the shape,
## or change its global opacity.
## You can use Transparent to make the inside of
## the shape transparent, and have the outline alone.
## By default, the shape's fill color is opaque white.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``color``: New color of the shape
proc `outlineColor=`*(shape: CircleShape, color: Color) {.
cdecl, importc: "sfCircleShape_setOutlineColor".}
## Set the outline color of a circle shape
##
## You can use Transparent to disable the outline.
## By default, the shape's outline color is opaque white.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``color``: New outline color of the shape
proc `outlineThickness=`*(shape: CircleShape, thickness: cfloat) {.
cdecl, importc: "sfCircleShape_setOutlineThickness".}
## Set the thickness of a circle shape's outline
##
## This number cannot be negative. Using zero disables
## the outline.
## By default, the outline thickness is 0.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``thickness``: New outline thickness
proc texture*(shape: CircleShape): Texture {.
cdecl, importc: "sfCircleShape_getTexture".}
## Get the source texture of a circle shape
##
## If the shape has no source texture, a NULL pointer is returned.
## The returned pointer is const, which means that you can't
## modify the texture when you retrieve it with this function.
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Pointer to the shape's texture
proc textureRect*(shape: CircleShape): IntRect {.
cdecl, importc: "sfCircleShape_getTextureRect".}
## Get the sub-rectangle of the texture displayed by a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Texture rectangle of the shape
proc fillColor*(shape: CircleShape): Color {.
cdecl, importc: "sfCircleShape_getFillColor".}
## Get the fill color of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Fill color of the shape
proc outlineColor*(shape: CircleShape): Color {.
cdecl, importc: "sfCircleShape_getOutlineColor".}
## Get the outline color of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Outline color of the shape
proc outlineThickness*(shape: CircleShape): cfloat {.
cdecl, importc: "sfCircleShape_getOutlineThickness".}
## Get the outline thickness of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Outline thickness of the shape
proc pointCount*(shape: CircleShape): int {.
cdecl, importc: "sfCircleShape_getPointCount".}
## Get the total number of points of a circle shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Number of points of the shape
proc getPoint*(shape: CircleShape, index: int): Vector2f {.
cdecl, importc: "sfCircleShape_getPoint".}
## Get a point of a circle shape
##
## The result is undefined if ``index`` is out of the valid range.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``index``: Index of the point to get, in range [0 .. getPointCount() - 1]
##
## *Returns:* Index-th point of the shape
proc `radius=`*(shape: CircleShape, radius: cfloat) {.
cdecl, importc: "sfCircleShape_setRadius".}
## Set the radius of a circle
##
## *Arguments*:
## - ``shape``: Shape object
## - ``radius``: New radius of the circle
proc radius*(shape: CircleShape): cfloat {.
cdecl, importc: "sfCircleShape_getRadius".}
## Get the radius of a circle
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Radius of the circle
proc `pointCount=`*(shape: CircleShape, count: int) {.
cdecl, importc: "sfCircleShape_setPointCount".}
## Set the number of points of a circle
##
## *Arguments*:
## - ``shape``: Shape object
## - ``count``: New number of points of the circle
proc localBounds*(shape: CircleShape): FloatRect {.
cdecl, importc: "sfCircleShape_getLocalBounds".}
## Get the local bounding rectangle of a circle shape
##
## The returned rectangle is in local coordinates, which means
## that it ignores the transformations (translation, rotation,
## scale, ...) that are applied to the entity.
## In other words, this function returns the bounds of the
## entity in the entity's coordinate system.
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Local bounding rectangle of the entity
proc globalBounds*(shape: CircleShape): FloatRect {.
cdecl, importc: "sfCircleShape_getGlobalBounds".}
## Get the global bounding rectangle of a circle shape
##
## The returned rectangle is in global coordinates, which means
## that it takes in account the transformations (translation,
## rotation, scale, ...) that are applied to the entity.
## In other words, this function returns the bounds of the
## sprite in the global 2D world's coordinate system.
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Global bounding rectangle of the entity
#--- SFML/Graphics/ConvexShape ---#
proc newConvexShape*(): ConvexShape {.
cdecl, importc: "sfConvexShape_create".}
## Create a new convex shape
##
## *Returns:* A new ConvexShape object, or NULL if it failed
proc copy*(shape: ConvexShape): ConvexShape {.
cdecl, importc: "sfConvexShape_copy".}
## Copy an existing convex shape
##
## *Arguments*:
## - ``shape``: Shape to copy
##
## *Returns:* Copied object
proc destroy*(shape: ConvexShape) {.
cdecl, importc: "sfConvexShape_destroy".}
## Destroy an existing convex Shape
##
## *Arguments*:
## - ``shape``: Shape to delete
proc `position=`*(shape: ConvexShape, position: Vector2f) {.
cdecl, importc: "sfConvexShape_setPosition".}
## Set the position of a convex shape
##
## This function completely overwrites the previous position.
## See ConvexShape_move to apply an offset based on the previous position instead.
## The default position of a circle Shape object is (0, 0).
##
## *Arguments*:
## - ``shape``: Shape object
## - ``position``: New position
proc `rotation=`*(shape: ConvexShape, angle: cfloat) {.
cdecl, importc: "sfConvexShape_setRotation".}
## Set the orientation of a convex shape
##
## This function completely overwrites the previous rotation.
## See ConvexShape_rotate to add an angle based on the previous rotation instead.
## The default rotation of a circle Shape object is 0.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``angle``: New rotation, in degrees
proc `scale=`*(shape: ConvexShape, scale: Vector2f) {.
cdecl, importc: "sfConvexShape_setScale".}
## Set the scale factors of a convex shape
##
## This function completely overwrites the previous scale.
## See ConvexShape_scale to add a factor based on the previous scale instead.
## The default scale of a circle Shape object is (1, 1).
##
## *Arguments*:
## - ``shape``: Shape object
## - ``scale``: New scale factors
proc `origin=`*(shape: ConvexShape, origin: Vector2f) {.
cdecl, importc: "sfConvexShape_setOrigin".}
## Set the local origin of a convex shape
##
## The origin of an object defines the center point for
## all transformations (position, scale, rotation).
## The coordinates of this point must be relative to the
## top-left corner of the object, and ignore all
## transformations (position, scale, rotation).
## The default origin of a circle Shape object is (0, 0).
##
## *Arguments*:
## - ``shape``: Shape object
## - ``origin``: New origin
proc position*(shape: ConvexShape): Vector2f {.
cdecl, importc: "sfConvexShape_getPosition".}
## Get the position of a convex shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current position
proc rotation*(shape: ConvexShape): cfloat {.
cdecl, importc: "sfConvexShape_getRotation".}
## Get the orientation of a convex shape
##
## The rotation is always in the range [0, 360].
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current rotation, in degrees
proc scale*(shape: ConvexShape): Vector2f {.
cdecl, importc: "sfConvexShape_getScale".}
## Get the current scale of a convex shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current scale factors
proc origin*(shape: ConvexShape): Vector2f {.
cdecl, importc: "sfConvexShape_getOrigin".}
## Get the local origin of a convex shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Current origin
proc move*(shape: ConvexShape, offset: Vector2f) {.
cdecl, importc: "sfConvexShape_move".}
## Move a convex shape by a given offset
##
## This function adds to the current position of the object,
## unlike ConvexShape_setPosition which overwrites it.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``offset``: Offset
proc rotate*(shape: ConvexShape, angle: cfloat) {.
cdecl, importc: "sfConvexShape_rotate".}
## Rotate a convex shape
##
## This function adds to the current rotation of the object,
## unlike ConvexShape_setRotation which overwrites it.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``angle``: Angle of rotation, in degrees
proc scale*(shape: ConvexShape, factors: Vector2f) {.
cdecl, importc: "sfConvexShape_scale".}
## Scale a convex shape
##
## This function multiplies the current scale of the object,
## unlike ConvexShape_setScale which overwrites it.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``factors``: Scale factors
proc transform*(shape: ConvexShape): Transform {.
cdecl, importc: "sfConvexShape_getTransform".}
## Get the combined transform of a convex shape
##
## *Arguments*:
## - ``shape``: shape object
##
## *Returns:* Transform combining the position/rotation/scale/origin of the object
proc inverseTransform*(shape: ConvexShape): Transform {.
cdecl, importc: "sfConvexShape_getInverseTransform".}
## Get the inverse of the combined transform of a convex shape
##
## *Arguments*:
## - ``shape``: shape object
##
## *Returns:* Inverse of the combined transformations applied to the object
proc setTexture*(shape: ConvexShape, texture: Texture, resetRect: BoolInt) {.
cdecl, importc: "sfConvexShape_setTexture".}
## Change the source texture of a convex shape
##
## The ``texture`` argument refers to a texture that must
## exist as long as the shape uses it. Indeed, the shape
## doesn't store its own copy of the texture, but rather keeps
## a pointer to the one that you passed to this function.
## If the source texture is destroyed and the shape tries to
## use it, the behaviour is undefined.
## ``texture`` can be NULL to disable texturing.
## If ``resetRect`` is true, the TextureRect property of
## the shape is automatically adjusted to the size of the new
## texture. If it is false, the texture rect is left unchanged.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``texture``: New texture
## - ``resetRect``: Should the texture rect be reset to the size of the new texture?
proc `textureRect=`*(shape: ConvexShape, rect: IntRect) {.
cdecl, importc: "sfConvexShape_setTextureRect".}
## Set the sub-rectangle of the texture that a convex shape will display
##
## The texture rect is useful when you don't want to display
## the whole texture, but rather a part of it.
## By default, the texture rect covers the entire texture.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``rect``: Rectangle defining the region of the texture to display
proc `fillColor=`*(shape: ConvexShape, color: Color) {.
cdecl, importc: "sfConvexShape_setFillColor".}
## Set the fill color of a convex shape
##
## This color is modulated (multiplied) with the shape's
## texture if any. It can be used to colorize the shape,
## or change its global opacity.
## You can use Transparent to make the inside of
## the shape transparent, and have the outline alone.
## By default, the shape's fill color is opaque white.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``color``: New color of the shape
proc `outlineColor=`*(shape: ConvexShape, color: Color) {.
cdecl, importc: "sfConvexShape_setOutlineColor".}
## Set the outline color of a convex shape
##
## You can use Transparent to disable the outline.
## By default, the shape's outline color is opaque white.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``color``: New outline color of the shape
proc `outlineThickness=`*(shape: ConvexShape, thickness: cfloat) {.
cdecl, importc: "sfConvexShape_setOutlineThickness".}
## Set the thickness of a convex shape's outline
##
## This number cannot be negative. Using zero disables
## the outline.
## By default, the outline thickness is 0.
##
## *Arguments*:
## - ``shape``: Shape object
## - ``thickness``: New outline thickness
proc texture*(shape: ConvexShape): Texture {.
cdecl, importc: "sfConvexShape_getTexture".}
## Get the source texture of a convex shape
##
## If the shape has no source texture, a NULL pointer is returned.
## The returned pointer is const, which means that you can't
## modify the texture when you retrieve it with this function.
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Pointer to the shape's texture
proc textureRect*(shape: ConvexShape): IntRect {.
cdecl, importc: "sfConvexShape_getTextureRect".}
## Get the sub-rectangle of the texture displayed by a convex shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Texture rectangle of the shape
proc fillColor*(shape: ConvexShape): Color {.
cdecl, importc: "sfConvexShape_getFillColor".}
## Get the fill color of a convex shape
##
## *Arguments*:
## - ``shape``: Shape object
##
## *Returns:* Fill color of the shape
proc outlineColor*(shape: ConvexShape): Color {.