-
Notifications
You must be signed in to change notification settings - Fork 4
/
csfml.nim
1374 lines (1288 loc) · 63.9 KB
/
csfml.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
import
strutils, math
when defined(linux):
const
LibG = "libcsfml-graphics.so.2.(1|0)"
LibS = "libcsfml-system.so.2.(1|0)"
LibW = "libcsfml-window.so.2.(1|0)"
elif defined(windows):
const
LibG = "csfml-graphics-(2.|2.1.)dll"
LibS = "csfml-system-(2.|2.1.)dll"
LibW = "csfml-window-(2.|2.1.)dll"
else:
{.error: "Platform unsupported".}
{.deadCodeElim: on.}
{.pragma: pf, pure, final.}
type
PClock* = ptr TClock
TClock* {.pf.} = object
TTime* {.pf.} = object
microseconds*: int64
TVector2i* {.pf.} = object
x*, y*: cint
TVector2f* {.pf.} = object
x*, y*: cfloat
TVector3f* {.pf.} = object
x*, y*, z*: cfloat
PInputStream* = ptr TInputStream
TInputStream* {.pf.} = object
read*: TInputStreamReadFunc
seek*: TInputStreamSeekFunc
tell*: TInputStreamTellFunc
getSize*: TInputStreamGetSizeFunc
userData*: pointer
TInputStreamReadFunc* = proc (data: pointer, size: int64, userData: pointer): int64{.
cdecl.}
TInputStreamSeekFunc* = proc (position: int16, userData: pointer): int64{.
cdecl.}
TInputStreamTellFunc* = proc (userData: pointer): int64 {.cdecl.}
TInputStreamGetSizeFunc* = proc (userData: pointer): int64 {.cdecl.}
PWindow* = ptr TWindow
TWindow* {.pf.} = object
PContextSettings* = ptr TContextSettings
TContextSettings*{.pf.} = object
depthBits*: cint
stencilBits*: cint
antialiasingLevel*: cint
majorVersion*: cint
minorVersion*: cint
TVideoMode* {.pf.} = object
width*: cint
height*: cint
bitsPerPixel*: cint
TEventType*{.size: sizeof(cint).} = enum
EvtClosed, EvtResized, EvtLostFocus, EvtGainedFocus,
EvtTextEntered, EvtKeyPressed, EvtKeyReleased, EvtMouseWheelMoved,
EvtMouseButtonPressed, EvtMouseButtonReleased, EvtMouseMoved,
EvtMouseEntered, EvtMouseLeft, EvtJoystickButtonPressed,
EvtJoystickButtonReleased, EvtJoystickMoved, EvtJoystickConnected,
EvtJoystickDisconnected
TKeyEvent*{.pf.} = object
code*: TKeyCode
alt* : cint
control*: cint
shift* : cint
system* : cint
TJoystickConnectEvent*{.pf.} = object
joystickId*: cint
TJoystickButtonEvent*{.pf.} = object
joystickId*: cint
button*: cint
TJoystickMoveEvent*{.pf.} = object
joystickId*: cint
axis*: TJoystickAxis
position*: cfloat
TMouseWheelEvent*{.pf.} = object
delta*: cint
x*: cint
y*: cint
TMouseButtonEvent*{.pf.} = object
button*: TMouseButton
x*: cint
y*: cint
TMouseMoveEvent*{.pf.} = object
x*: cint
y*: cint
TTextEvent*{.pf.} = object
unicode*: cint
PEvent* = ptr TEvent
TEvent*{.pf.} = object
case kind*: TEventType
of EvtKeyPressed, EvtKeyReleased:
key*: TKeyEvent
of EvtMouseButtonPressed, EvtMouseButtonReleased:
mouseButton*: TMouseButtonEvent
of EvtTextEntered:
text*: TTextEvent
of EvtJoystickConnected, EvtJoystickDisconnected:
joystickConnect*: TJoystickConnectEvent
of EvtJoystickMoved:
joystickMove*: TJoystickMoveEvent
of EvtJoystickButtonPressed, EvtJoystickButtonReleased:
joystickButton*: TJoystickButtonEvent
of EvtResized:
size*: TSizeEvent
of EvtMouseMoved, EvtMouseEntered, EvtMouseLeft:
mouseMove*: TMouseMoveEvent
of EvtMouseWheelMoved:
mouseWheel*: TMouseWheelEvent
else: nil
TJoystickAxis*{.size: sizeof(cint).} = enum
JoystickX, JoystickY, JoystickZ, JoystickR,
JoystickU, JoystickV, JoystickPovX, JoystickPovY
TSizeEvent*{.pf.} = object
width*: cint
height*: cint
TMouseButton*{.size: sizeof(cint).} = enum
MouseLeft, MouseRight, MouseMiddle,
MouseXButton1, MouseXButton2, MouseButtonCount
TKeyCode*{.size: sizeof(cint).} = enum
KeyUnknown = - 1, KeyA, KeyB, KeyC, KeyD, KeyE,
KeyF, KeyG, KeyH, KeyI, KeyJ, KeyK, KeyL, KeyM, #/< The M key
KeyN, KeyO, KeyP, KeyQ, KeyR, KeyS, KeyT, KeyU, #/< The U key
KeyV, KeyW, KeyX, KeyY, KeyZ, KeyNum0, KeyNum1, #/< The 1 key
KeyNum2, KeyNum3, KeyNum4, KeyNum5, KeyNum6, #/< The 6 key
KeyNum7, KeyNum8, KeyNum9, KeyEscape, KeyLControl, #/< The left Control key
KeyLShift, KeyLAlt, KeyLSystem, KeyRControl, #/< The right Control key
KeyRShift, KeyRAlt, KeyRSystem, KeyMenu, #/< The Menu key
KeyLBracket, KeyRBracket, KeySemiColon, KeyComma, #/< The , key
KeyPeriod, KeyQuote, KeySlash, KeyBackSlash, #/< The \ key
KeyTilde, KeyEqual, KeyDash, KeySpace, KeyReturn, #/< The Return key
KeyBack, KeyTab, KeyPageUp, KeyPageDown, KeyEnd, #/< The End key
KeyHome, KeyInsert, KeyDelete, KeyAdd, KeySubtract, #/< -
KeyMultiply, KeyDivide, KeyLeft, KeyRight, KeyUp, #/< Up arrow
KeyDown, KeyNumpad0, KeyNumpad1, KeyNumpad2, #/< The numpad 2 key
KeyNumpad3, #/< The numpad 3 key
KeyNumpad4, #/< The numpad 4 key
KeyNumpad5, #/< The numpad 5 key
KeyNumpad6, #/< The numpad 6 key
KeyNumpad7, #/< The numpad 7 key
KeyNumpad8, #/< The numpad 8 key
KeyNumpad9, #/< The numpad 9 key
KeyF1, #/< The F1 key
KeyF2, #/< The F2 key
KeyF3, #/< The F3 key
KeyF4, #/< The F4 key
KeyF5, #/< The F5 key
KeyF6, #/< The F6 key
KeyF7, #/< The F7 key
KeyF8, #/< The F8 key
KeyF9, #/< The F8 key
KeyF10, #/< The F10 key
KeyF11, #/< The F11 key
KeyF12, #/< The F12 key
KeyF13, #/< The F13 key
KeyF14, #/< The F14 key
KeyF15, #/< The F15 key
KeyPause, #/< The Pause key
KeyCount #/< Keep last -- the total number of keyboard keys
when defined(linux): #or defined(bsd) ??
type TWindowHandle* = clong
elif defined(windows):
type TWindowHandle* = pointer ##HWND__ ? windows is crazy. ##struct HWND__; typedef struct HWND__* sfWindowHandle;
#elif defined(mac):
# type TWindowHandle* = pointer ##typedef void* sfWindowHandle; <- whatever the hell that is
const
sfNone* = 0
sfTitlebar* = 1 shl 0
sfResize* = 1 shl 1
sfClose* = 1 shl 2
sfFullscreen* = 1 shl 3
sfDefaultStyle* = sfTitlebar or sfResize or sfClose
type
PRenderWindow* = ptr TRenderWindow
TRenderWindow* {.pf.} = object
PFont* = ptr TFont
TFont* {.pf.} = object
PImage* = ptr TImage
TImage* {.pf.} = object
PShader* = ptr TShader
TShader* {.pf.} = object
PSprite* = ptr TSprite
TSprite* {.pf.} = object
PText* = ptr TText
TText* {.pf.} = object
PTexture* = ptr TTexture
TTexture* {.pf.} = object
PVertexArray* = ptr TVertexArray
TVertexArray* {.pf.} = object
PView* = ptr TView
TView* {.pf.} = object
PRenderTexture* = ptr TRenderTexture
TRenderTexture* {.pf.} = object
PShape* = ptr TShape
TShape* {.pf.} = object
PCircleShape* = ptr TCircleShape
TCircleShape* {.pf.} = object
PRectangleShape* = ptr TRectangleShape
TRectangleShape* {.pf.} = object
PConvexShape* = ptr TConvexShape
TConvexShape* {.pf.} = object
TTextStyle*{.size: sizeof(cint).} = enum
TextRegular = 0, TextBold = 1 shl 0, TextItalic = 1 shl 1,
TextUnderlined = 1 shl 2
TBlendMode*{.size: sizeof(cint).} = enum
BlendAlpha, BlendAdd, BlendMultiply, BlendNone
PRenderStates* = ptr TRenderStates
TRenderStates* {.pf.} = object
blendMode*: TBlendMode
transform*: TTransform
texture*: PTexture
shader*: PShader
PTransform* = ptr TTransform
TTransform* {.pf.} = object
matrix*: array[0..8, cfloat]
TColor* {.pf.} = object
r*: uint8
g*: uint8
b*: uint8
a*: uint8
PFloatRect* = ptr TFloatRect
TFloatRect*{.pf.} = object
left*: cfloat
top*: cfloat
width*: cfloat
height*: cfloat
PIntRect* = ptr TIntRect
TIntRect*{.pf.} = object
left*: cint
top*: cint
width*: cint
height*: cint
TGlyph* {.pf.} = object
advance*: cint
bounds*: TIntRect
textureRect*: TIntRect
PVertex* = ptr TVertex
TVertex* {.pf.} = object
position*: TVector2f
color*: TColor
texCoords*: TVector2f
TPrimitiveType*{.size: sizeof(cint).} = enum
Points, #/< List of individual points
Lines, #/< List of individual lines
LinesStrip, #/< List of connected lines, a point uses the previous point to form a line
Triangles, #/< List of individual triangles
TrianglesStrip, #/< List of connected triangles, a point uses the two previous points to form a triangle
TrianglesFan, #/< List of connected triangles, a point uses the common center and the previous point to form a triangle
Quads
{.push callconv: cdecl.}
proc newWindow*(mode: TVideoMode, title: cstring, style: uint32, settings: PContextSettings = nil): PWindow {.
importc: "sfWindow_create", dynlib: LibW.}
proc close*(window: PWindow) {.
cdecl, importc: "sfWindow_close", dynlib: LibW.}
proc isOpen*(window: PWindow): bool {.cdecl, importc: "sfWindow_isOpen", dynlib: LibW.}
proc pollEvent*(window: PWindow, event: PEvent): bool {.
cdecl, importc: "sfWindow_pollEvent", dynlib: LibW.}
proc waitEvent*(window: PWindow, event: PEvent): bool {.
cdecl, importc: "sfWindow_waitEvent", dynlib: LibW.}
proc getDesktopMode*(): TVideoMode {.
cdecl, importc: "sfVideoMode_getDesktopMode", dynlib: LibW.}
proc isKeyPressed*(key: TKeyCode): bool {.
cdecl, importc: "sfKeyboard_isKeyPressed", dynlib: LibW.}
{.push callconv:cdecl.}
{.push importc: "sf$1".}
{.push dynlib: LibW.}
proc Mouse_isButtonPressed*(button: TMouseButton): bool #{.cdecl, importc: "sfMouse_isButtonPressed", dynlib: LibW.}
proc Mouse_getPosition*(relativeTo: PWindow): TVector2i #{.cdecl, importc: "sfMouse_getPosition", dynlib: LibW.}
proc Mouse_setPosition*(position: TVector2i, relativeTo: PWindow) #{.cdecl, importc: "sfMouse_setPosition", dynlib: LibW.}
proc Joystick_isConnected*(joystick: cint): bool#{. cdecl, importc: "sfJoystick_isConnected", dynlib: LibW.}
proc Joystick_getButtonCount*(joystick: cint): cint #{. cdecl, importc: "sfJoystick_getButtonCount", dynlib: LibW.}
proc Joystick_hasAxis*(joystick: cint, axis: TJoystickAxis): bool #{. cdecl, importc: "sfJoystick_hasAxis", dynlib: LibW.}
proc Joystick_isButtonPressed*(joystick: cint, button: cint): bool #{. cdecl, importc: "sfJoystick_isButtonPressed", dynlib: LibW.}
proc Joystick_getAxisPosition*(joystick: cint, axis: TJoystickAxis): float #{. cdecl, importc: "sfJoystick_getAxisPosition", dynlib: LibW.}
proc Joystick_update*(): void #. cdecl, importc: "sfJoystick_update", dynlib: LibW.}
{.pop.}
{.pop.}
{.push dynlib: LibG.}
{.push importc: "sf$1".}
proc RenderWindow_createFromHandle* (handle: TWindowHandle; settings: PContextSettings=nil): PRenderWindow
proc RenderWindow_create*(mode: TVideoMode, title: cstring, style: int32, settings: PContextSettings = nil): PRenderWindow
{.pop.}
#{.push importc: "sfRenderWindow_$1".}
proc sf (s:string): string {.compiletime.} = "sf" & s & "_$1"
proc destroy*(window: PRenderWindow) {.importc: sf"RenderWindow".}
proc close*(window: PRenderWindow) {.importc: sf"RenderWindow".}
proc isOpen*(window: PRenderWindow): bool {.importc: sf"RenderWindow".}
#void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels);
#proc setIcon*(window: PRenderWindow, width, height: cint, pixels: seq[uint8]) {.
# cdecl, importc: "sfRenderWindow_setIcon", dynlib: LibG.}
proc getSettings*(window: PRenderWindow): TContextSettings {.
cdecl, importc: "sfRenderWindow_getSettings", dynlib: LibG.}
proc pollEvent*(window: PRenderWindow, event: PEvent): bool {.
cdecl, importc: "sfRenderWindow_pollEvent", dynlib: LibG.}
proc pollEvent*(window: PRenderWindow; event: var TEvent): bool {.
cdecl, importc: "sfRenderWindow_pollEvent", dynlib: LibG.}
proc waitEvent*(window: PRenderWindow, event: PEvent): bool {.
cdecl, importc: "sfRenderWindow_waitEvent", dynlib: LibG.}
proc waitEvent*(window: PRenderWindow, event: var TEvent): bool {.
cdecl, importc: "sfRenderWindow_waitEvent", dynlib: LibG.}
proc getPosition*(window: PRenderWindow): TVector2i {.
cdecl, importc: "sfRenderWindow_getPosition", dynlib: LibG.}
proc setPosition*(window: PRenderWindow, position: TVector2i) {.
cdecl, importc: "sfRenderWindow_setPosition", dynlib: LibG.}
proc getSize*(window: PRenderWindow): TVector2i {.
cdecl, importc: "sfRenderWindow_getSize", dynlib: LibG.}
proc setSize*(window: PRenderWindow, size: TVector2i): void {.
cdecl, importc: "sfRenderWindow_setSize", dynlib: LibG.}
proc setTitle*(window: PRenderWindow, title: cstring): void {.
cdecl, importc: "sfRenderWindow_setTitle", dynlib: LibG.}
proc setVisible*(window: PRenderWindow, visible: bool) {.
cdecl, importc: "sfRenderWindow_setVisible", dynlib: LibG.}
proc setMouseCursorVisible*(window: PRenderWindow, show: bool) {.
cdecl, importc: "sfRenderWindow_setMouseCursorVisible", dynlib: LibG.}
proc setVerticalSyncEnabled*(window: PRenderWindow, enabled: bool) {.
cdecl, importc: "sfRenderWindow_setVerticalSyncEnabled", dynlib: LibG.}
proc setKeyRepeatEnabled*(window: PRenderWindow, enabled: bool) {.
cdecl, importc: "sfRenderWindow_setKeyRepeatEnabled", dynlib: LibG.}
proc setActive*(window: PRenderWindow, active: bool): bool {.
cdecl, importc: "sfRenderWindow_setActive", dynlib: LibG.}
proc display*(window: PRenderWindow) {.
cdecl, importc: "sfRenderWindow_display", dynlib: LibG.}
proc setFramerateLimit*(window: PRenderWindow, limit: uint) {.
cdecl, importc: "sfRenderWindow_setFramerateLimit", dynlib: LibG.}
proc setJoystickThreshold*(window: PRenderWindow, threshold: float) {.
cdecl, importc: "sfRenderWindow_setJoystickThreshold", dynlib: LibG.}
proc getSystemHandle*(window: PRenderWindow): TWindowHandle {.
cdecl, importc: "sfRenderWindow_getSystemHandle", dynlib: LibG.}
proc clear*(window: PRenderWindow, color: TColor) {.
cdecl, importc: "sfRenderWindow_clear", dynlib: LibG.}
proc setView*(window: PRenderWindow, view: PView) {.
cdecl, importc: "sfRenderWindow_setView", dynlib: LibG.}
proc getView*(window: PRenderWindow): PView {.
cdecl, importc: "sfRenderWindow_getView", dynlib: LibG.}
proc getDefaultView*(window: PRenderWindow): PView {.
cdecl, importc: "sfRenderWindow_getDefaultView", dynlib: LibG.}
proc getViewport*(window: PRenderWindow, view: PView): TIntRect {.
cdecl, importc: "sfRenderWindow_getViewport", dynlib: LibG.}
when false: ## 2.0RC!
proc convertCoords*(window: PRenderWindow, point: TVector2i, targetView: PView): TVector2f {.
cdecl, importc: "sfRenderWindow_convertCoords", dynlib: LibG.}
else:
proc mapPixelToCoords*(window: PRenderWindow; point: TVector2i; view: PView): TVector2f {.cdecl, importc: "sfRenderWindow_mapPixelToCoords", dynlib: LibG.}
proc mapCoordsToPixel*(window: PRenderWindow; point: TVector2f; view: PView): TVector2i {.cdecl, importc: "sfRenderWindow_mapCoordsToPixel", dynlib: LibG.}
proc convertCoords*(window: PRenderWindow; point: TVector2i; view: PView): TVector2f {.inline.} = mapPixelToCoords(window, point, view)
proc draw*(window: PRenderWindow, sprite: PSprite, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawSprite", dynlib: LibG.}
proc draw*(window: PRenderWindow, text: PText, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawText", dynlib: LibG.}
proc draw*(window: PRenderWindow, shape: PShape, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawShape", dynlib: LibG.}
proc draw*(window: PRenderWindow, shape: PCircleShape, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawCircleShape", dynlib: LibG.}
proc draw*(window: PRenderWindow, shape: PRectangleShape, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawRectangleShape", dynlib: LibG.}
proc draw*(window: PRenderWindow, shape: PConvexShape, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawConvexShape", dynlib: LibG.}
proc draw*(window: PRenderWindow, shape: PVertexArray, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawVertexArray", dynlib: LibG.}
proc draw*(window: PRenderWindow, vertices: PVertex, vertexCount: cint,
vertexType: TPrimitiveType, states: PRenderStates = nil) {.
cdecl, importc: "sfRenderWindow_drawPrimitives", dynlib: LibG.}
proc pushGlStates*(window: PRenderWindow) {.
cdecl, importc: "sfRenderWindow_pushGLStates", dynlib: LibG.}
proc popGlStates*(window: PRenderWindow) {.
cdecl, importc: "sfRenderWindow_popGLStates", dynlib: LibG.}
proc resetGlStates*(window: PRenderWindow) {.
cdecl, importc: "sfRenderWindow_resetGLStates", dynlib: LibG.}
proc capture*(window: PRenderWindow): PImage {.
cdecl, importc: "sfRenderWindow_capture", dynlib: LibG.}
## 2.0 GIT FINALLY ADDED THESE (not in 2.0 RC)
{.push callConv:cdecl.}
proc getMousePosition*(window: PRenderWindow): TVector2i {.
importc: "sfMouse_getPositionRenderWindow", dynlib: LibG.}
proc setMousePosition*(pos: TVector2i, window: PRenderWindow) {.
importc: "sfMouse_setPositionRenderWindow", dynlib: LibG.}
{.pop.}
#Construct a new render texture
proc newRenderTexture*(width, height: cint; depthBuffer: bool): PRenderTexture {.
cdecl, importc: "sfRenderTexture_create", dynlib: LibG.}
#Destroy an existing render texture
proc destroy*(renderTexture: PRenderTexture){.
cdecl, importc: "sfRenderTexture_destroy", dynlib: LibG.}
#Get the size of the rendering region of a render texture
proc getSize*(renderTexture: PRenderTexture): TVector2i {.
cdecl, importc: "sfRenderTexture_getSize", dynlib: LibG.}
#Activate or deactivate a render texture as the current target for rendering
proc setActive*(renderTexture: PRenderTexture; active: bool): bool{.
cdecl, importc: "sfRenderTexture_setActive", dynlib: LibG.}
#Update the contents of the target texture
proc display*(renderTexture: PRenderTexture){.
cdecl, importc: "sfRenderTexture_display", dynlib: LibG.}
#Clear the rendertexture with the given color
proc clear*(renderTexture: PRenderTexture; color: TColor){.
cdecl, importc: "sfRenderTexture_clear", dynlib: LibG.}
#Change the current active view of a render texture
proc setView*(renderTexture: PRenderTexture; view: PView){.
cdecl, importc: "sfRenderTexture_setView", dynlib: LibG.}
#Get the current active view of a render texture
proc getView*(renderTexture: PRenderTexture): PView{.
cdecl, importc: "sfRenderTexture_getView", dynlib: LibG.}
#Get the default view of a render texture
proc getDefaultView*(renderTexture: PRenderTexture): PView{.
cdecl, importc: "sfRenderTexture_getDefaultView", dynlib: LibG.}
#Get the viewport of a view applied to this target
proc getViewport*(renderTexture: PRenderTexture; view: PView): TIntRect{.
cdecl, importc: "sfRenderTexture_getViewport", dynlib: LibG.}
#Convert a point in texture coordinates into view coordinates
proc convertCoords*(renderTexture: PRenderTexture; point: TVector2i; targetView: PView): TVector2f{.
cdecl, importc: "sfRenderTexture_convertCoords", dynlib: LibG.}
#Draw a drawable object to the render-target
proc draw*(renderTexture: PRenderTexture; sprite: PSprite; states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawSprite", dynlib: LibG.}
proc draw*(renderTexture: PRenderTexture; text: PText; states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawText", dynlib: LibG.}
proc draw*(renderTexture: PRenderTexture; shape: PShape; states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawShape", dynlib: LibG.}
proc draw*(renderTexture: PRenderTexture; shape: PCircleShape;
states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawCircleShape", dynlib: LibG.}
proc draw*(renderTexture: PRenderTexture; shape: PConvexShape;
states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawConvexShape", dynlib: LibG.}
proc draw*(renderTexture: PRenderTexture; shape: PRectangleShape;
states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawRectangleShape", dynlib: LibG.}
proc draw*(renderTexture: PRenderTexture; va: PVertexArray;
states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawVertexArray", dynlib: LibG.}
#Draw primitives defined by an array of vertices to a render texture
proc draw*(renderTexture: PRenderTexture; vertices: PVertex; vertexCount: cint;
primitiveType: TPrimitiveType; states: PRenderStates = nil){.
cdecl, importc: "sfRenderTexture_drawPrimitives", dynlib: LibG.}
#Save the current OpenGL render states and matrices
#/
#/ This function can be used when you mix SFML drawing
#/ and direct OpenGL rendering. Combined with popGLStates,
#/ it ensures that:
#/ * SFML's internal states are not messed up by your OpenGL code
#/ * your OpenGL states are not modified by a call to a SFML function
#/
#/ Note that this function is quite expensive: it saves all the
#/ possible OpenGL states and matrices, even the ones you
#/ don't care about. Therefore it should be used wisely.
#/ It is provided for convenience, but the best results will
#/ be achieved if you handle OpenGL states yourself (because
#/ you know which states have really changed, and need to be
#/ saved and restored). Take a look at the resetGLStates
#/ function if you do so.
proc pushGLStates*(renderTexture: PRenderTexture){.
cdecl, importc: "sfRenderTexture_pushGLStates", dynlib: LibG.}
#Restore the previously saved OpenGL render states and matrices
#/
#/ See the description of pushGLStates to get a detailed
#/ description of these functions.
proc popGLStates*(renderTexture: PRenderTexture){.
cdecl, importc: "sfRenderTexture_popGLStates", dynlib: LibG.}
#Reset the internal OpenGL states so that the target is ready for drawing
#/
#/ This function can be used when you mix SFML drawing
#/ and direct OpenGL rendering, if you choose not to use
#/ pushGLStates/popGLStates. It makes sure that all OpenGL
#/ states needed by SFML are set, so that subsequent sfRenderTexture_draw*()
#/ calls will work as expected.
proc resetGLStates*(renderTexture: PRenderTexture){.
cdecl, importc: "sfRenderTexture_resetGLStates", dynlib: LibG.}
#Get the target texture of a render texture
proc getTexture*(renderTexture: PRenderTexture): PTexture{.
cdecl, importc: "sfRenderTexture_getTexture", dynlib: LibG.}
#Enable or disable the smooth filter on a render texture
proc setSmooth*(renderTexture: PRenderTexture; smooth: bool){.
cdecl, importc: "sfRenderTexture_setSmooth", dynlib: LibG.}
#Tell whether the smooth filter is enabled or not for a render texture
proc isSmooth*(renderTexture: PRenderTexture): bool {.
cdecl, importc: "sfRenderTexture_isSmooth", dynlib: LibG.}
proc intRect*(left, top, width, height: cint): TIntRect =
result.left = left
result.top = top
result.width = width
result.height = height
proc floatRect*(left, top, width, height: cfloat): TFloatRect =
result.left = left
result.top = top
result.width = width
result.height = height
{.push cdecl.}
proc contains*(rect: PFloatRect, x, y: cfloat): bool {.
importc: "sfFloatRect_contains", dynlib: LibG.}
proc contains*(rect: var TFloatRect, x, y: cfloat): bool {.
importc: "sfFloatRect_contains", dynlib: LibG.}
proc contains*(rect: PIntRect, x: cint, y: cint): bool{.
importc: "sfIntRect_contains", dynlib: LibG.}
proc contains*(rect: var TIntRect, x: cint, y: cint): bool{.
importc: "sfIntRect_contains", dynlib: LibG.}
proc contains*(rect: var TFloatRect; x, y: cint): bool {.inline.} =
return contains(rect, x.cfloat, y.cfloat)
proc intersects*(rect1, rect2, intersection: PFloatRect): bool {.
importc: "sfFloatRect_intersects", dynlib: LibG.}
proc intersects*(rect1, rect2, intersection: PIntRect): bool {.
importc: "sfIntRect_intersects", dynlib: LibG.}
{.pop.}
proc newFont*(filename: cstring): PFont {.
cdecl, importc: "sfFont_createFromFile", dynlib: LibG.}
proc newFont*(data: pointer, sizeInBytes: cint): PFont {.
cdecl, importc: "sfFont_createFromMemory", dynlib: LibG.}
proc newFont*(stream: PInputStream): PFont {.
cdecl, importc: "sfFont_createFromStream", dynlib: LibG.}
proc copy*(font: PFont): PFont {.
cdecl, importc: "sfFont_copy", dynlib: LibG.}
proc destroy*(font: PFont) {.
cdecl, importc: "sfFont_destroy", dynlib: LibG.}
proc getGlyph*(font: PFont, codePoint: uint32, characterSize: cint, bold: bool): TGlyph{.
cdecl, importc: "sfFont_getGlyph", dynlib: LibG.}
proc getKerning*(font: PFont, first: uint32, second: uint32, characterSize: cint): cint {.
cdecl, importc: "sfFont_getKerning", dynlib: LibG.}
proc getLineSpacing*(font: PFont, characterSize: cint): cint {.
cdecl, importc: "sfFont_getLineSpacing", dynlib: LibG.}
proc getTexture*(font: PFont, characterSize: cint): PTexture {.
cdecl, importc: "sfFont_getTexture", dynlib: LibG.}
#getDefaultFont() has been removed from CSFML
proc getDefaultFont*(): PFont {.
error, cdecl, importc: "sfFont_getDefaultFont", dynlib: LibG.}
proc newCircleShape*(): PCircleShape {.
cdecl, importc: "sfCircleShape_create", dynlib: LibG.}
proc copy*(shape: PCircleShape): PCircleShape {.
cdecl, importc: "sfCircleShape_copy", dynlib: LibG.}
proc destroy*(shape: PCircleShape) {.
cdecl, importc: "sfCircleShape_destroy", dynlib: LibG.}
proc setPosition*(shape: PCircleShape, position: TVector2f) {.
cdecl, importc: "sfCircleShape_setPosition", dynlib: LibG.}
proc setRotation*(shape: PCircleShape, angle: cfloat) {.
cdecl, importc: "sfCircleShape_setRotation", dynlib: LibG.}
proc setScale*(shape: PCircleShape, scale: TVector2f) {.
cdecl, importc: "sfCircleShape_setScale", dynlib: LibG.}
proc setOrigin*(shape: PCircleShape, origin: TVector2f) {.
cdecl, importc: "sfCircleShape_setOrigin", dynlib: LibG.}
proc getPosition*(shape: PCircleShape): TVector2f {.
cdecl, importc: "sfCircleShape_getPosition", dynlib: LibG.}
proc getRotation*(shape: PCircleShape): cfloat {.
cdecl, importc: "sfCircleShape_getRotation", dynlib: LibG.}
proc getScale*(shape: PCircleShape): TVector2f {.
cdecl, importc: "sfCircleShape_getScale", dynlib: LibG.}
proc getOrigin*(shape: PCircleShape): TVector2f {.
cdecl, importc: "sfCircleShape_getOrigin", dynlib: LibG.}
proc move*(shape: PCircleShape, offset: TVector2f) {.
cdecl, importc: "sfCircleShape_move", dynlib: LibG.}
proc rotate*(shape: PCircleShape, angle: cfloat){.
cdecl, importc: "sfCircleShape_rotate", dynlib: LibG.}
proc scale*(shape: PCircleShape, factors: TVector2f) {.
cdecl, importc: "sfCircleShape_scale", dynlib: LibG.}
proc getTransform*(shape: PCircleShape): TTransform {.
cdecl, importc: "sfCircleShape_getTransform", dynlib: LibG.}
proc getInverseTransform*(shape: PCircleShape): TTransform {.
cdecl, importc: "sfCircleShape_getInverseTransform", dynlib: LibG.}
proc setTexture*(shape: PCircleShape, texture: PTexture, resetRect: bool) {.
cdecl, importc: "sfCircleShape_setTexture", dynlib: LibG.}
proc setTextureRect*(shape: PCircleShape, rect: TIntRect) {.
cdecl, importc: "sfCircleShape_setTextureRect", dynlib: LibG.}
proc setFillColor*(shape: PCircleShape, color: TColor) {.
cdecl, importc: "sfCircleShape_setFillColor", dynlib: LibG.}
proc setOutlineColor*(shape: PCircleShape, color: TColor) {.
cdecl, importc: "sfCircleShape_setOutlineColor", dynlib: LibG.}
proc setOutlineThickness*(shape: PCircleShape, thickness: cfloat) {.
cdecl, importc: "sfCircleShape_setOutlineThickness", dynlib: LibG.}
proc getTexture*(shape: PCircleShape): PTexture {.
cdecl, importc: "sfCircleShape_getTexture", dynlib: LibG.}
proc getTextureRect*(shape: PCircleShape): TIntRect {.
cdecl, importc: "sfCircleShape_getTextureRect", dynlib: LibG.}
proc getFillColor*(shape: PCircleShape): TColor {.
cdecl, importc: "sfCircleShape_getFillColor", dynlib: LibG.}
proc getOutlineColor*(shape: PCircleShape): TColor {.
cdecl, importc: "sfCircleShape_getOutlineColor", dynlib: LibG.}
proc getOutlineThickness*(shape: PCircleShape): cfloat {.
cdecl, importc: "sfCircleShape_getOutlineThickness", dynlib: LibG.}
proc getPointCount*(shape: PCircleShape): cint {.
cdecl, importc: "sfCircleShape_getPointCount", dynlib: LibG.}
proc getPoint*(shape: PCircleShape, index: cint): TVector2f {.
cdecl, importc: "sfCircleShape_getPoint", dynlib: LibG.}
proc setRadius*(shape: PCircleShape, radius: cfloat) {.
cdecl, importc: "sfCircleShape_setRadius", dynlib: LibG.}
proc getRadius*(shape: PCircleShape): cfloat {.
cdecl, importc: "sfCircleShape_getRadius", dynlib: LibG.}
proc setPointCount*(shape: PCircleShape, count: cint) {.
cdecl, importc: "sfCircleShape_setPointCount", dynlib: LibG.}
proc getLocalBounds*(shape: PCircleShape): TFloatRect {.
cdecl, importc: "sfCircleShape_getLocalBounds", dynlib: LibG.}
proc getGlobalBounds*(shape: PCircleShape): TFloatRect {.
cdecl, importc: "sfCircleShape_getGlobalBounds", dynlib: LibG.}
proc newRectangleShape*(): PRectangleShape {.
cdecl, importc: "sfRectangleShape_create", dynlib: LibG.}
proc copy*(shape: PRectangleShape): PRectangleShape {.
cdecl, importc: "sfRectangleShape_copy", dynlib: LibG.}
proc destroy*(shape: PRectangleShape){.
cdecl, importc: "sfRectangleShape_destroy", dynlib: LibG.}
proc setPosition*(shape: PRectangleShape, position: TVector2f) {.
cdecl, importc: "sfRectangleShape_setPosition", dynlib: LibG.}
proc setRotation*(shape: PRectangleShape, angle: cfloat) {.
cdecl, importc: "sfRectangleShape_setRotation", dynlib: LibG.}
proc setScale*(shape: PRectangleShape, scale: TVector2f) {.
cdecl, importc: "sfRectangleShape_setScale", dynlib: LibG.}
proc setOrigin*(shape: PRectangleShape, origin: TVector2f) {.
cdecl, importc: "sfRectangleShape_setOrigin", dynlib: LibG.}
proc getPosition*(shape: PRectangleShape): TVector2f {.
cdecl, importc: "sfRectangleShape_getPosition", dynlib: LibG.}
proc getRotation*(shape: PRectangleShape): cfloat {.
cdecl, importc: "sfRectangleShape_getRotation", dynlib: LibG.}
proc getScale*(shape: PRectangleShape): TVector2f {.
cdecl, importc: "sfRectangleShape_getScale", dynlib: LibG.}
proc getOrigin*(shape: PRectangleShape): TVector2f {.
cdecl, importc: "sfRectangleShape_getOrigin", dynlib: LibG.}
proc move*(shape: PRectangleShape, offset: TVector2f) {.
cdecl, importc: "sfRectangleShape_move", dynlib: LibG.}
proc rotate*(shape: PRectangleShape, angle: cfloat) {.
cdecl, importc: "sfRectangleShape_rotate", dynlib: LibG.}
proc scale*(shape: PRectangleShape, factors: TVector2f) {.
cdecl, importc: "sfRectangleShape_scale", dynlib: LibG.}
proc getTransform*(shape: PRectangleShape): TTransform {.
cdecl, importc: "sfRectangleShape_getTransform", dynlib: LibG.}
proc getInverseTransform*(shape: PRectangleShape): TTransform {.
cdecl, importc: "sfRectangleShape_getInverseTransform", dynlib: LibG.}
proc setTexture*(shape: PRectangleShape, texture: PTexture, resetRect: bool) {.
cdecl, importc: "sfRectangleShape_setTexture", dynlib: LibG.}
proc setTextureRect*(shape: PRectangleShape, rect: TIntRect) {.
cdecl, importc: "sfRectangleShape_setTextureRect", dynlib: LibG.}
proc setFillColor*(shape: PRectangleShape, color: TColor) {.
cdecl, importc: "sfRectangleShape_setFillColor", dynlib: LibG.}
proc setOutlineColor*(shape: PRectangleShape, color: TColor) {.
cdecl, importc: "sfRectangleShape_setOutlineColor", dynlib: LibG.}
proc setOutlineThickness*(shape: PRectangleShape, thickness: cfloat) {.
cdecl, importc: "sfRectangleShape_setOutlineThickness", dynlib: LibG.}
proc getTexture*(shape: PRectangleShape): PTexture {.
cdecl, importc: "sfRectangleShape_getTexture", dynlib: LibG.}
proc getTextureRect*(shape: PRectangleShape): TIntRect {.
cdecl, importc: "sfRectangleShape_getTextureRect", dynlib: LibG.}
proc getFillColor*(shape: PRectangleShape): TColor {.
cdecl, importc: "sfRectangleShape_getFillColor", dynlib: LibG.}
proc getOutlineColor*(shape: PRectangleShape): TColor {.
cdecl, importc: "sfRectangleShape_getOutlineColor", dynlib: LibG.}
proc getOutlineThickness*(shape: PRectangleShape): cfloat {.
cdecl, importc: "sfRectangleShape_getOutlineThickness", dynlib: LibG.}
proc getPointCount*(shape: PRectangleShape): cint {.
cdecl, importc: "sfRectangleShape_getPointCount", dynlib: LibG.}
proc getPoint*(shape: PRectangleShape, index: cint): TVector2f {.
cdecl, importc: "sfRectangleShape_getPoint", dynlib: LibG.}
proc setSize*(shape: PRectangleShape, size: TVector2f) {.
cdecl, importc: "sfRectangleShape_setSize", dynlib: LibG.}
proc getSize*(shape: PRectangleShape): TVector2f {.
cdecl, importc: "sfRectangleShape_getSize", dynlib: LibG.}
proc getLocalBounds*(shape: PRectangleShape): TFloatRect {.
cdecl, importc: "sfRectangleShape_getLocalBounds", dynlib: LibG.}
proc getGlobalBounds*(shape: PRectangleShape): TFloatRect {.
cdecl, importc: "sfRectangleShape_getGlobalBounds", dynlib: LibG.}
type
TGetPointCountCallback* = proc(userData: pointer): cint {.cdecl.}
TGetPointCallback* = proc(a: cint; userData: pointer): TVector2f {.cdecl.}
{.push cdecl.}
{.push importc: sf"Shape".}
proc newShape*(getPointCount: TGetPointCountCallback;
getPoint: TGetPointCallback; userdata: pointer = nil): PShape {.
importc: "sfShape_create", dynLib: LibG.}
proc destroy*(shape: PShape) {.importc: "sfShape_destroy", dynLib: LibG.}
proc setPosition*(shape: PShape; pos: TVector2f) {.
importc: "sfShape_setPosition", dynlib: LibG.}
proc getPosition*(shape: PShape): TVector2f {.
importc: "sfShape_getPosition", dynlib: LibG.}
proc setRotation*(shape: PShape; degrees: cfloat) {.
importc: "sfShape_setRotation", dynlib: LibG.}
proc getRotation*(shape: PShape): cfloat {.
importc: "sfShape_getRotation", dynlib: LibG.}
proc setScale*(shape: PShape; scale: TVector2f) {.
importc: "sfShape_setScale", dynlib: LibG.}
proc getScale*(shape: PShape): TVector2f {.
importc: "sfShape_getScale", dynlib: LibG.}
proc setOrigin*(shape: PShape; origin: TVector2f) {.
importc: "sfShape_setOrigin", dynlib: LibG.}
proc getOrigin*(shape: PShape): TVector2f {.
importc: "sfShape_getOrigin", dynlib: LibG.}
proc move*(shape: PShape; offset: TVector2f) {.
importc: "sfShape_move", dynlib: LibG.}
proc rotate*(shape: PShape; degrees: cfloat) {.
importc: "sfShape_rotate", dynlib: LibG.}
proc scale*(shape: PShape; factor: TVector2f) {.
importc: "sfShape_scale", dynlib: LibG.}
proc getTransform*(shape: PShape): TTransform {.
importc: "sfShape_getTransform", dynlib: LibG.}
proc getInverseTransform*(shape: PShape): TTransform {.
importc: "sfShape_getInverseTransform", dynlib: LibG.}
proc setTexture*(shape: PShape; texture: PTexture; resetRect = true) {.
importc: "sfShape_setTexture", dynlib: LibG.}
proc getTexture*(shape: PShape): PTexture {.
importc: "sfShape_getTexture", dynlib: LibG.}
proc setTextureRect*(shape: PShape; rect: TIntRect) {.
importc: "sfShape_setTextureRect", dynlib: LibG.}
proc getTextureRect*(shape: PShape): TIntRect {.
importc: "sfShape_getTextureRect", dynlib: LibG.}
proc setFillColor*(shape: PShape; color: TColor) {.
importc: "sfShape_setFillColor", dynlib: LibG.}
proc getFillColor*(shape: PShape): TColor {.
importc: "sfShape_getFillColor", dynlib: LibG.}
proc getOutlineColor*(shape: PShape; color: TColor) {.
importc: "sfShape_getOutlineColor", dynlib: LibG.}
proc setOutlineColor*(shape: PShape): TColor {.
importc: "sfShape_setOutlineColor", dynlib: LibG.}
proc setOutlineThickness*(shape: PShape; thickness: cfloat) {.
importc: "sfShape_setOutlineThickness", dynlib: LibG.}
proc getOutlineThickness*(shape: PShape): cfloat {.
importc: "sfShape_getOutlineThickness", dynlib: LibG.}
proc getPointCount*(shape: PShape): cuint {.
importc: "sfShape_getPointCount", dynlib: LibG.}
proc getPoint*(shape: PShape; index: cuint): TVector2f {.
importc: "sfShape_getPoint", dynlib: LibG.}
proc getLocalBounds*(shape: PShape): TFloatRect {.
importc: "sfShape_getLocalBounds", dynlib: LibG.}
proc getGlobalBounds*(shape: PShape): TFloatRect {.
importc: "sfShape_getGlobalBounds", dynlib: LibG.}
proc update*(shape: PShape) {.importc: "sfShape_update", dynlib: LibG.}
{.pop: cdecl.}
proc newView*(): PView {.
cdecl, importc: "sfView_create", dynlib: LibG.}
proc viewFromRect*(rectangle: TFloatRect): PView{.
cdecl, importc: "sfView_createFromRect", dynlib: LibG.}
proc copy*(view: PView): PView {.
cdecl, importc: "sfView_copy", dynlib: LibG.}
proc destroy*(view: PView) {.
cdecl, importc: "sfView_destroy", dynlib: LibG.}
proc setCenter*(view: PView, center: TVector2f) {.
cdecl, importc: "sfView_setCenter", dynlib: LibG.}
proc setSize*(view: PView, size: TVector2f) {.
cdecl, importc: "sfView_setSize", dynlib: LibG.}
proc setRotation*(view: PView, angle: cfloat) {.
cdecl, importc: "sfView_setRotation", dynlib: LibG.}
proc setViewport*(view: PView, viewport: TFloatRect) {.
cdecl, importc: "sfView_setViewport", dynlib: LibG.}
proc reset*(view: PView, rectangle: TFloatRect) {.
cdecl, importc: "sfView_reset", dynlib: LibG.}
proc getCenter*(view: PView): TVector2f {.
cdecl, importc: "sfView_getCenter", dynlib: LibG.}
proc getSize*(view: PView): TVector2f {.
cdecl, importc: "sfView_getSize", dynlib: LibG.}
proc getRotation*(view: PView): cfloat {.
cdecl, importc: "sfView_getRotation", dynlib: LibG.}
proc getViewport*(view: PView): TFloatRect {.
cdecl, importc: "sfView_getViewport", dynlib: LibG.}
proc move*(view: PView, offset: TVector2f) {.
cdecl, importc: "sfView_move", dynlib: LibG.}
proc rotate*(view: PView, angle: cfloat) {.
cdecl, importc: "sfView_rotate", dynlib: LibG.}
proc zoom*(view: PView, factor: cfloat) {.
cdecl, importc: "sfView_zoom", dynlib: LibG.}
proc newImage*(width, height: cint): PImage {.
cdecl, importc: "sfImage_create", dynlib: LibG.}
proc newImage*(width, height: cint, color: TColor): PImage {.
cdecl, importc: "sfImage_createFromColor", dynlib: LibG.}
proc newImage*(width, height: cint, pixels: pointer): PImage {. ##same deal as setIcon()
cdecl, importc: "sfImage_createFromPixels", dynlib: LibG.}
proc newImage*(filename: cstring): PImage {.
cdecl, importc: "sfImage_createFromFile", dynlib: LibG.}
proc newImage*(data: pointer, size: cint): PImage {.
cdecl, importc: "sfImage_createFromMemory", dynlib: LibG.}
proc newImage*(stream: PInputStream): PImage {.
cdecl, importc: "sfImage_createFromStream", dynlib: LibG.}
proc copy*(image: PImage): PImage {.
cdecl, importc: "sfImage_copy", dynlib: LibG.}
proc destroy*(image: PImage) {.
cdecl, importc: "sfImage_destroy", dynlib: LibG.}
proc save*(image: PImage, filename: cstring): bool {.
cdecl, importc: "sfImage_saveToFile", dynlib: LibG.}
proc getSize*(image: PImage): TVector2i {.
cdecl, importc: "sfImage_getSize", dynlib: LibG.}
proc createMask*(image: PImage, color: TColor, alpha: cchar) {.
cdecl, importc: "sfImage_createMaskFromColor", dynlib: LibG.}
proc copy*(destination, source: PImage, destX, destY: cint;
sourceRect: TIntRect, applyAlpha: bool) {.
cdecl, importc: "sfImage_copyImage", dynlib: LibG.}
proc setPixel*(image: PImage, x, y: cint, color: TColor) {.
cdecl, importc: "sfImage_setPixel", dynlib: LibG.}
proc getPixel*(image: PImage, x, y: cint): TColor {.
cdecl, importc: "sfImage_getPixel", dynlib: LibG.}
proc getPixels*(image: PImage): pointer {.
cdecl, importc: "sfImage_getPixelsPtr", dynlib: LibG.}
proc flipHorizontally*(image: PImage) {.
cdecl, importc: "sfImage_flipHorizontally", dynlib: LibG.}
proc flipVertically*(image: PImage) {.
cdecl, importc: "sfImage_flipVertically", dynlib: LibG.}
proc newSprite*(): PSprite {.
cdecl, importc: "sfSprite_create", dynlib: LibG.}
proc copy*(sprite: PSprite): PSprite {.
cdecl, importc: "sfSprite_copy", dynlib: LibG.}
proc destroy*(sprite: PSprite) {.
cdecl, importc: "sfSprite_destroy", dynlib: LibG.}
proc setPosition*(sprite: PSprite, position: TVector2f) {.
cdecl, importc: "sfSprite_setPosition", dynlib: LibG.}
proc setRotation*(sprite: PSprite, angle: cfloat) {.
cdecl, importc: "sfSprite_setRotation", dynlib: LibG.}
proc setScale*(sprite: PSprite, scale: TVector2f) {.
cdecl, importc: "sfSprite_setScale", dynlib: LibG.}
proc setOrigin*(sprite: PSprite, origin: TVector2f) {.
cdecl, importc: "sfSprite_setOrigin", dynlib: LibG.}
proc getPosition*(sprite: PSprite): TVector2f {.
cdecl, importc: "sfSprite_getPosition", dynlib: LibG.}
proc getRotation*(sprite: PSprite): cfloat {.
cdecl, importc: "sfSprite_getRotation", dynlib: LibG.}
proc getScale*(sprite: PSprite): TVector2f {.
cdecl, importc: "sfSprite_getScale", dynlib: LibG.}
proc getOrigin*(sprite: PSprite): TVector2f {.
cdecl, importc: "sfSprite_getOrigin", dynlib: LibG.}
proc move*(sprite: PSprite, offset: TVector2f) {.
cdecl, importc: "sfSprite_move", dynlib: LibG.}
proc rotate*(sprite: PSprite, angle: cfloat) {.
cdecl, importc: "sfSprite_rotate", dynlib: LibG.}
proc scale*(sprite: PSprite, factor: TVector2f) {.
cdecl, importc: "sfSprite_scale", dynlib: LibG.}
proc getTransform*(sprite: PSprite): TTransform {.
cdecl, importc: "sfSprite_getTransform", dynlib: LibG.}
proc getInverseTransform*(sprite: PSprite): TTransform {.
cdecl, importc: "sfSprite_getInverseTransform", dynlib: LibG.}
proc setTexture*(sprite: PSprite, texture: PTexture, resetRect: bool) {.
cdecl, importc: "sfSprite_setTexture", dynlib: LibG.}
proc setTextureRect*(sprite: PSprite, rectangle: TIntRect) {.
cdecl, importc: "sfSprite_setTextureRect", dynlib: LibG.}
proc setColor*(sprite: PSprite, color: TColor) {.
cdecl, importc: "sfSprite_setColor", dynlib: LibG.}
proc getTexture*(sprite: PSprite): PTexture {.
cdecl, importc: "sfSprite_getTexture", dynlib: LibG.}
proc getTextureRect*(sprite: PSprite): TIntRect {.
cdecl, importc: "sfSprite_getTextureRect", dynlib: LibG.}
proc getColor*(sprite: PSprite): TColor {.
cdecl, importc: "sfSprite_getColor", dynlib: LibG.}
proc getLocalBounds*(sprite: PSprite): TFloatRect {.
cdecl, importc: "sfSprite_getLocalBounds", dynlib: LibG.}
proc getGlobalBounds*(sprite: PSprite): TFloatRect {.
cdecl, importc: "sfSprite_getGlobalBounds", dynlib: LibG.}
proc newTexture*(width, height: cint): PTexture {.
cdecl, importc: "sfTexture_create", dynlib: LibG.}
proc newTexture*(filename: cstring, area: PIntRect): PTexture {.
cdecl, importc: "sfTexture_createFromFile", dynlib: LibG.}
proc newTexture*(data: pointer, size: cint, area: PIntRect): PTexture {.
cdecl, importc: "sfTexture_createFromMemory", dynlib: LibG.}
proc newTexture*(stream: PInputStream, area: PIntRect): PTexture {.
cdecl, importc: "sfTexture_createFromStream", dynlib: LibG.}
proc newTexture*(image: PImage, area: PIntRect = nil): PTexture {.
cdecl, importc: "sfTexture_createFromImage", dynlib: LibG.}
proc copy*(texture: PTexture): PTexture {.
cdecl, importc: "sfTexture_copy", dynlib: LibG.}
proc destroy*(texture: PTexture) {.
cdecl, importc: "sfTexture_destroy", dynlib: LibG.}
proc getSize*(texture: PTexture): TVector2i {.
cdecl, importc: "sfTexture_getSize", dynlib: LibG.}
proc copyToImage*(texture: PTexture): PImage {.
cdecl, importc: "sfTexture_copyToImage", dynlib: LibG.}
proc updateFromPixels*(texture: PTexture, pixels: pointer, width, height, x, y: cint) {.
cdecl, importc: "sfTexture_updateFromPixels", dynlib: LibG.}
proc updateFromImage*(texture: PTexture, image: PImage, x, y: cint) {.
cdecl, importc: "sfTexture_updateFromImage", dynlib: LibG.}
proc updateFromWindow*(texture: PTexture, window: PWindow, x, y: cint) {.
cdecl, importc: "sfTexture_updateFromWindow", dynlib: LibG.}
proc updateFromWindow*(texture: PTexture, window: PRenderWindow, x, y: cint) {.
cdecl, importc: "sfTexture_updateFromRenderWindow", dynlib: LibG.}
proc bindGL*(texture: PTexture) {.
cdecl, importc: "sfTexture_bind", dynlib: LibG.}
proc setSmooth*(texture: PTexture, smooth: bool) {.
cdecl, importc: "sfTexture_setSmooth", dynlib: LibG.}
proc isSmooth*(texture: PTexture): bool {.
cdecl, importc: "sfTexture_isSmooth", dynlib: LibG.}
proc setRepeated*(texture: PTexture, repeated: bool) {.
cdecl, importc: "sfTexture_setRepeated", dynlib: LibG.}
proc isRepeated*(texture: PTexture): bool {.
cdecl, importc: "sfTexture_isRepeated", dynlib: LibG.}
proc textureMaxSize*(): cint {.
cdecl, importc: "sfTexture_getMaximumSize", dynlib: LibG.}
proc newVertexArray*(): PVertexArray {.
cdecl, importc: "sfVertexArray_create", dynlib: LibG.}
proc copy*(vertexArray: PVertexArray): PVertexArray {.
cdecl, importc: "sfVertexArray_copy", dynlib: LibG.}
proc destroy*(va: PVertexArray) {.
cdecl, importc: "sfVertexArray_destroy", dynlib: LibG.}
proc getVertexCount*(va: PVertexArray): cint {.
cdecl, importc: "sfVertexArray_getVertexCount", dynlib: LibG.}
proc getVertex*(va: PVertexArray, index: cint): PVertex {.
cdecl, importc: "sfVertexArray_getVertex", dynlib: LibG.}
proc clear*(va: PVertexArray) {.
cdecl, importc: "sfVertexArray_clear", dynlib: LibG.}
proc resize*(va: PVertexArray, size: cint) {.
cdecl, importc: "sfVertexArray_resize", dynlib: LibG.}
proc append*(va: PVertexArray, vertex: TVertex) {.
cdecl, importc: "sfVertexArray_append", dynlib: LibG.}
proc setPrimitiveType*(va: PVertexArray, primitiveType: TPrimitiveType) {.
cdecl, importc: "sfVertexArray_setPrimitiveType", dynlib: LibG.}
proc getPrimitiveType*(va: PVertexArray): TPrimitiveType {.
cdecl, importc: "sfVertexArray_getPrimitiveType", dynlib: LibG.}
proc getBounds*(va: PVertexArray): TFloatRect {.
cdecl, importc: "sfVertexArray_getBounds", dynlib: LibG.}
proc newText*(): PText {.
cdecl, importc: "sfText_create", dynlib: LibG.}
proc copy*(text: PText): PText {.
cdecl, importc: "sfText_copy", dynlib: LibG.}
proc destroy*(text: PText) {.
cdecl, importc: "sfText_destroy", dynlib: LibG.}
proc setPosition*(text: PText, position: TVector2f) {.
cdecl, importc: "sfText_setPosition", dynlib: LibG.}
proc setRotation*(text: PText, angle: cfloat) {.
cdecl, importc: "sfText_setRotation", dynlib: LibG.}
proc setScale*(text: PText, scale: TVector2f) {.
cdecl, importc: "sfText_setScale", dynlib: LibG.}
proc setOrigin*(text: PText, origin: TVector2f) {.
cdecl, importc: "sfText_setOrigin", dynlib: LibG.}
proc getPosition*(text: PText): TVector2f {.
cdecl, importc: "sfText_getPosition", dynlib: LibG.}
proc getRotation*(text: PText): cfloat {.
cdecl, importc: "sfText_getRotation", dynlib: LibG.}
proc getScale*(text: PText): TVector2f {.
cdecl, importc: "sfText_getScale", dynlib: LibG.}
proc getOrigin*(text: PText): TVector2f {.
cdecl, importc: "sfText_getOrigin", dynlib: LibG.}
proc move*(text: PText, offset: TVector2f) {.
cdecl, importc: "sfText_move", dynlib: LibG.}
proc rotate*(text: PText, angle: cfloat) {.
cdecl, importc: "sfText_rotate", dynlib: LibG.}
proc scale*(text: PText, factors: TVector2f) {.
cdecl, importc: "sfText_scale", dynlib: LibG.}
proc getTransform*(text: PText): TTransform {.
cdecl, importc: "sfText_getTransform", dynlib: LibG.}
proc getInverseTransform*(text: PText): TTransform {.
cdecl, importc: "sfText_getInverseTransform", dynlib: LibG.}
proc setString*(text: PText, string: cstring) {.
cdecl, importc: "sfText_setString", dynlib: LibG.}
proc setUnicodeString*(text: PText, string: ptr uint32) {.
cdecl, importc: "sfText_setUnicodeString", dynlib: LibG.}
proc setFont*(text: PText, font: PFont) {.
cdecl, importc: "sfText_setFont", dynlib: LibG.}
proc setCharacterSize*(text: PText, size: cint) {.
cdecl, importc: "sfText_setCharacterSize", dynlib: LibG.}
proc setStyle*(text: PText, style: TTextStyle) {.
cdecl, importc: "sfText_setStyle", dynlib: LibG.}
proc setColor*(text: PText, color: TColor) {.
cdecl, importc: "sfText_setColor", dynlib: LibG.}
proc getString*(text: PText): cstring {.
cdecl, importc: "sfText_getString", dynlib: LibG.}
proc getUnicodeString*(text: PText): ptr uint32 {.cdecl,
importc: "sfText_getUnicodeString", dynlib: LibG.}
proc getFont*(text: PText): PFont {.
cdecl, importc: "sfText_getFont", dynlib: LibG.}
proc getCharacterSize*(text: PText): cint {.