Browse Source

remove unnecessary files :eyes:

Ethosa 3 years ago
parent
commit
52bd27101f

+ 2 - 2
README.md

@@ -87,8 +87,8 @@ This section contains links to documentation for all nodes.
 For use debug mode you should compile with `-d:debug` or `--define:debug`, e.g. `nim c -r -d:debug main.nim`.
 
 ## Export
-Use the [`Nim compiler user guide`](https://nim-lang.org/docs/nimc.html#dynliboverride) for export to the other OS.  
-[Static linking SDL2](https://github.com/nim-lang/sdl2#static-linking-sdl2) (or compile with `-d:static_sdl2` -> tested on Windows)
+Use the [`Nim compiler user guide`](https://nim-lang.org/docs/nimc.html#dynliboverride) for export to the other OS.
+[Static linking SDL2](https://github.com/nim-lang/sdl2#static-linking-sdl2)
 
 -   CrossPlatform export for Windows (tested on Windows 7 x64 and Windows 10 x64)
     -   `nim c -d:mingw -d:release --opt:speed --noNimblePath file.nim`

+ 9 - 9
src/nodesnim/nodescontrol/subwindow.nim

@@ -2,7 +2,7 @@
 ## Extended version of SubWindow node.
 import
   ../thirdparty/opengl,
-  ../thirdparty/opengl/glut,
+  ../thirdparty/sdl2,
 
   ../core/vector2,
   ../core/rect2,
@@ -139,19 +139,19 @@ method handle*(self: SubWindowRef, event: InputEvent, mouse_on: var NodeRef) =
 
   when not defined(android) and not defined(ios):
     if left and top:
-      glutSetCursor(GLUT_CURSOR_TOP_LEFT_CORNER)
+      setCursor(createSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE))
     elif left and bottom:
-      glutSetCursor(GLUT_CURSOR_BOTTOM_LEFT_CORNER)
-    elif right and top:
-      glutSetCursor(GLUT_CURSOR_TOP_RIGHT_CORNER)
+      setCursor(createSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE))
     elif right and bottom:
-      glutSetCursor(GLUT_CURSOR_BOTTOM_RIGHT_CORNER)
+      setCursor(createSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW))
+    elif right and top:
+      setCursor(createSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW))
     elif left or right:
-      glutSetCursor(GLUT_CURSOR_LEFT_RIGHT)
+      setCursor(createSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE))
     elif bottom or top:
-      glutSetCursor(GLUT_CURSOR_UP_DOWN)
+      setCursor(createSystemCursor(SDL_SYSTEM_CURSOR_SIZENS))
     else:
-      glutSetCursor(GLUT_CURSOR_LEFT_ARROW)
+      setCursor(createSystemCursor(SDL_SYSTEM_CURSOR_ARROW))
 
   if event.kind == MOUSE and mouse_on == self:
     if event.pressed:

+ 0 - 380
src/nodesnim/thirdparty/opengl/glut.nim

@@ -1,380 +0,0 @@
-#
-#
-#  Adaption of the delphi3d.net OpenGL units to FreePascal
-#  Sebastian Guenther (sg@freepascal.org) in 2002
-#  These units are free to use
-#
-
-# Copyright (c) Mark J. Kilgard, 1994, 1995, 1996.
-# This program is freely distributable without licensing fees  and is
-#   provided without guarantee or warrantee expressed or  implied. This
-#   program is -not- in the public domain.
-#******************************************************************************
-# Converted to Delphi by Tom Nuydens (tom@delphi3d.net)
-#   Contributions by Igor Karpov (glygrik@hotbox.ru)
-#   For the latest updates, visit Delphi3D: http://www.delphi3d.net
-#******************************************************************************
-
-import ../opengl
-
-{.deadCodeElim: on.}
-
-when defined(windows):
-  const
-    dllname = "(freeglut.dll|glut32.dll)"
-elif defined(macosx):
-  const
-    dllname = "/System/Library/Frameworks/GLUT.framework/GLUT"
-else:
-  const
-    dllname = "libglut.so.3"
-type
-  TGlutVoidCallback* = proc (){.cdecl.}
-  TGlut1IntCallback* = proc (value: cint){.cdecl.}
-  TGlut2IntCallback* = proc (v1, v2: cint){.cdecl.}
-  TGlut3IntCallback* = proc (v1, v2, v3: cint){.cdecl.}
-  TGlut4IntCallback* = proc (v1, v2, v3, v4: cint){.cdecl.}
-  TGlut1Char2IntCallback* = proc (c: int8, v1, v2: cint){.cdecl.}
-  TGlut1UInt3IntCallback* = proc (u, v1, v2, v3: cint){.cdecl.}
-
-{.deprecated: [Pointer: pointer].}
-
-const
-  GLUT_API_VERSION* = 3
-  GLUT_XLIB_IMPLEMENTATION* = 12 # Display mode bit masks.
-  GLUT_RGB* = 0
-  GLUT_RGBA* = GLUT_RGB
-  GLUT_INDEX* = 1
-  GLUT_SINGLE* = 0
-  GLUT_DOUBLE* = 2
-  GLUT_ACCUM* = 4
-  GLUT_ALPHA* = 8
-  GLUT_DEPTH* = 16
-  GLUT_STENCIL* = 32
-  GLUT_MULTISAMPLE* = 128
-  GLUT_STEREO* = 256
-  GLUT_LUMINANCE* = 512       # Mouse buttons.
-  GLUT_LEFT_BUTTON* = 0
-  GLUT_MIDDLE_BUTTON* = 1
-  GLUT_RIGHT_BUTTON* = 2      # Mouse button state.
-  GLUT_DOWN* = 0
-  GLUT_UP* = 1                # function keys
-  GLUT_KEY_F1* = 1
-  GLUT_KEY_F2* = 2
-  GLUT_KEY_F3* = 3
-  GLUT_KEY_F4* = 4
-  GLUT_KEY_F5* = 5
-  GLUT_KEY_F6* = 6
-  GLUT_KEY_F7* = 7
-  GLUT_KEY_F8* = 8
-  GLUT_KEY_F9* = 9
-  GLUT_KEY_F10* = 10
-  GLUT_KEY_F11* = 11
-  GLUT_KEY_F12* = 12          # directional keys
-  GLUT_KEY_LEFT* = 100
-  GLUT_KEY_UP* = 101
-  GLUT_KEY_RIGHT* = 102
-  GLUT_KEY_DOWN* = 103
-  GLUT_KEY_PAGE_UP* = 104
-  GLUT_KEY_PAGE_DOWN* = 105
-  GLUT_KEY_HOME* = 106
-  GLUT_KEY_END* = 107
-  GLUT_KEY_INSERT* = 108      # Entry/exit  state.
-  GLUT_LEFT* = 0
-  GLUT_ENTERED* = 1           # Menu usage state.
-  GLUT_MENU_NOT_IN_USE* = 0
-  GLUT_MENU_IN_USE* = 1       # Visibility  state.
-  GLUT_NOT_VISIBLE* = 0
-  GLUT_VISIBLE* = 1           # Window status  state.
-  GLUT_HIDDEN* = 0
-  GLUT_FULLY_RETAINED* = 1
-  GLUT_PARTIALLY_RETAINED* = 2
-  GLUT_FULLY_COVERED* = 3     # Color index component selection values.
-  GLUT_RED* = 0
-  GLUT_GREEN* = 1
-  GLUT_BLUE* = 2              # Layers for use.
-  GLUT_NORMAL* = 0
-  GLUT_OVERLAY* = 1
-
-{.push dynlib: dllname, importc.}
-
-when defined(Windows):
-  const                       # Stroke font constants (use these in GLUT program).
-    GLUT_STROKE_ROMAN* = cast[pointer](0)
-    GLUT_STROKE_MONO_ROMAN* = cast[pointer](1) # Bitmap font constants (use these in GLUT program).
-    GLUT_BITMAP_9_BY_15* = cast[pointer](2)
-    GLUT_BITMAP_8_BY_13* = cast[pointer](3)
-    GLUT_BITMAP_TIMES_ROMAN_10* = cast[pointer](4)
-    GLUT_BITMAP_TIMES_ROMAN_24* = cast[pointer](5)
-    GLUT_BITMAP_HELVETICA_10* = cast[pointer](6)
-    GLUT_BITMAP_HELVETICA_12* = cast[pointer](7)
-    GLUT_BITMAP_HELVETICA_18* = cast[pointer](8)
-else:
-  var                         # Stroke font constants (use these in GLUT program).
-    glutStrokeRoman {.importc: "glutStrokeRoman".}: pointer
-    glutStrokeMonoRoman {.importc: "glutStrokeMonoRoman".}: pointer # Bitmap font constants (use these in GLUT program).
-    glutBitmap9By15 {.importc: "glutBitmap9By15".}: pointer
-    glutBitmap8By13 {.importc: "glutBitmap8By13".}: pointer
-    glutBitmapTimesRoman10 {.importc: "glutBitmapTimesRoman10".}: pointer
-    glutBitmapTimesRoman24 {.importc: "glutBitmapTimesRoman24".}: pointer
-    glutBitmapHelvetica10 {.importc: "glutBitmapHelvetica10".}: pointer
-    glutBitmapHelvetica12 {.importc: "glutBitmapHelvetica12".}: pointer
-    glutBitmapHelvetica18 {.importc: "glutBitmapHelvetica18".}: pointer
-
-  let
-    GLUT_STROKE_ROMAN*      = cast[pointer](addr glutStrokeRoman)
-    GLUT_STROKE_MONO_ROMAN* = cast[pointer](addr glutStrokeMonoRoman)
-    GLUT_BITMAP_9_BY_15* = cast[pointer](addr glutBitmap9By15)
-    GLUT_BITMAP_8_BY_13* = cast[pointer](addr glutBitmap8By13)
-    GLUT_BITMAP_TIMES_ROMAN_10* = cast[pointer](addr glutBitmapTimesRoman10)
-    GLUT_BITMAP_TIMES_ROMAN_24* = cast[pointer](addr glutBitmapTimesRoman24)
-    GLUT_BITMAP_HELVETICA_10* = cast[pointer](addr glutBitmapHelvetica10)
-    GLUT_BITMAP_HELVETICA_12* = cast[pointer](addr glutBitmapHelvetica12)
-    GLUT_BITMAP_HELVETICA_18* = cast[pointer](addr glutBitmapHelvetica18)
-
-const                         # glutGet parameters.
-  GLUT_WINDOW_X* = 100
-  GLUT_WINDOW_Y* = 101
-  GLUT_WINDOW_WIDTH* = 102
-  GLUT_WINDOW_HEIGHT* = 103
-  GLUT_WINDOW_BUFFER_SIZE* = 104
-  GLUT_WINDOW_STENCIL_SIZE* = 105
-  GLUT_WINDOW_DEPTH_SIZE* = 106
-  GLUT_WINDOW_RED_SIZE* = 107
-  GLUT_WINDOW_GREEN_SIZE* = 108
-  GLUT_WINDOW_BLUE_SIZE* = 109
-  GLUT_WINDOW_ALPHA_SIZE* = 110
-  GLUT_WINDOW_ACCUM_RED_SIZE* = 111
-  GLUT_WINDOW_ACCUM_GREEN_SIZE* = 112
-  GLUT_WINDOW_ACCUM_BLUE_SIZE* = 113
-  GLUT_WINDOW_ACCUM_ALPHA_SIZE* = 114
-  GLUT_WINDOW_DOUBLEBUFFER* = 115
-  GLUT_WINDOW_RGBA* = 116
-  GLUT_WINDOW_PARENT* = 117
-  GLUT_WINDOW_NUM_CHILDREN* = 118
-  GLUT_WINDOW_COLORMAP_SIZE* = 119
-  GLUT_WINDOW_NUM_SAMPLES* = 120
-  GLUT_WINDOW_STEREO* = 121
-  GLUT_WINDOW_CURSOR* = 122
-  GLUT_SCREEN_WIDTH* = 200
-  GLUT_SCREEN_HEIGHT* = 201
-  GLUT_SCREEN_WIDTH_MM* = 202
-  GLUT_SCREEN_HEIGHT_MM* = 203
-  GLUT_MENU_NUM_ITEMS* = 300
-  GLUT_DISPLAY_MODE_POSSIBLE* = 400
-  GLUT_INIT_WINDOW_X* = 500
-  GLUT_INIT_WINDOW_Y* = 501
-  GLUT_INIT_WINDOW_WIDTH* = 502
-  GLUT_INIT_WINDOW_HEIGHT* = 503
-  constGLUT_INIT_DISPLAY_MODE* = 504
-  GLUT_ELAPSED_TIME* = 700
-  GLUT_WINDOW_FORMAT_ID* = 123 # glutDeviceGet parameters.
-  GLUT_HAS_KEYBOARD* = 600
-  GLUT_HAS_MOUSE* = 601
-  GLUT_HAS_SPACEBALL* = 602
-  GLUT_HAS_DIAL_AND_BUTTON_BOX* = 603
-  GLUT_HAS_TABLET* = 604
-  GLUT_NUM_MOUSE_BUTTONS* = 605
-  GLUT_NUM_SPACEBALL_BUTTONS* = 606
-  GLUT_NUM_BUTTON_BOX_BUTTONS* = 607
-  GLUT_NUM_DIALS* = 608
-  GLUT_NUM_TABLET_BUTTONS* = 609
-  GLUT_DEVICE_IGNORE_KEY_REPEAT* = 610
-  GLUT_DEVICE_KEY_REPEAT* = 611
-  GLUT_HAS_JOYSTICK* = 612
-  GLUT_OWNS_JOYSTICK* = 613
-  GLUT_JOYSTICK_BUTTONS* = 614
-  GLUT_JOYSTICK_AXES* = 615
-  GLUT_JOYSTICK_POLL_RATE* = 616 # glutLayerGet parameters.
-  GLUT_OVERLAY_POSSIBLE* = 800
-  GLUT_LAYER_IN_USE* = 801
-  GLUT_HAS_OVERLAY* = 802
-  GLUT_TRANSPARENT_INDEX* = 803
-  GLUT_NORMAL_DAMAGED* = 804
-  GLUT_OVERLAY_DAMAGED* = 805 # glutVideoResizeGet parameters.
-  GLUT_VIDEO_RESIZE_POSSIBLE* = 900
-  GLUT_VIDEO_RESIZE_IN_USE* = 901
-  GLUT_VIDEO_RESIZE_X_DELTA* = 902
-  GLUT_VIDEO_RESIZE_Y_DELTA* = 903
-  GLUT_VIDEO_RESIZE_WIDTH_DELTA* = 904
-  GLUT_VIDEO_RESIZE_HEIGHT_DELTA* = 905
-  GLUT_VIDEO_RESIZE_X* = 906
-  GLUT_VIDEO_RESIZE_Y* = 907
-  GLUT_VIDEO_RESIZE_WIDTH* = 908
-  GLUT_VIDEO_RESIZE_HEIGHT* = 909 # glutGetModifiers return mask.
-  GLUT_ACTIVE_SHIFT* = 1
-  GLUT_ACTIVE_CTRL* = 2
-  GLUT_ACTIVE_ALT* = 4        # glutSetCursor parameters.
-                              # Basic arrows.
-  GLUT_CURSOR_RIGHT_ARROW* = 0
-  GLUT_CURSOR_LEFT_ARROW* = 1 # Symbolic cursor shapes.
-  GLUT_CURSOR_INFO* = 2
-  GLUT_CURSOR_DESTROY* = 3
-  GLUT_CURSOR_HELP* = 4
-  GLUT_CURSOR_CYCLE* = 5
-  GLUT_CURSOR_SPRAY* = 6
-  GLUT_CURSOR_WAIT* = 7
-  GLUT_CURSOR_TEXT* = 8
-  GLUT_CURSOR_CROSSHAIR* = 9  # Directional cursors.
-  GLUT_CURSOR_UP_DOWN* = 10
-  GLUT_CURSOR_LEFT_RIGHT* = 11 # Sizing cursors.
-  GLUT_CURSOR_TOP_SIDE* = 12
-  GLUT_CURSOR_BOTTOM_SIDE* = 13
-  GLUT_CURSOR_LEFT_SIDE* = 14
-  GLUT_CURSOR_RIGHT_SIDE* = 15
-  GLUT_CURSOR_TOP_LEFT_CORNER* = 16
-  GLUT_CURSOR_TOP_RIGHT_CORNER* = 17
-  GLUT_CURSOR_BOTTOM_RIGHT_CORNER* = 18
-  GLUT_CURSOR_BOTTOM_LEFT_CORNER* = 19 # Inherit from parent window.
-  GLUT_CURSOR_INHERIT* = 100  # Blank cursor.
-  GLUT_CURSOR_NONE* = 101     # Fullscreen crosshair (if available).
-  GLUT_CURSOR_FULL_CROSSHAIR* = 102 # GLUT device control sub-API.
-                                    # glutSetKeyRepeat modes.
-  GLUT_KEY_REPEAT_OFF* = 0
-  GLUT_KEY_REPEAT_ON* = 1
-  GLUT_KEY_REPEAT_DEFAULT* = 2 # Joystick button masks.
-  GLUT_JOYSTICK_BUTTON_A* = 1
-  GLUT_JOYSTICK_BUTTON_B* = 2
-  GLUT_JOYSTICK_BUTTON_C* = 4
-  GLUT_JOYSTICK_BUTTON_D* = 8 # GLUT game mode sub-API.
-                              # glutGameModeGet.
-  GLUT_GAME_MODE_ACTIVE* = 0
-  GLUT_GAME_MODE_POSSIBLE* = 1
-  GLUT_GAME_MODE_WIDTH* = 2
-  GLUT_GAME_MODE_HEIGHT* = 3
-  GLUT_GAME_MODE_PIXEL_DEPTH* = 4
-  GLUT_GAME_MODE_REFRESH_RATE* = 5
-  GLUT_GAME_MODE_DISPLAY_CHANGED* = 6 # GLUT initialization sub-API.
-
-proc glutInit*(argcp: ptr cint, argv: pointer)
-proc glutInitDisplayMode*(mode: int16)
-proc glutInitDisplayString*(str: cstring)
-proc glutInitWindowPosition*(x, y: int)
-proc glutInitWindowSize*(width, height: int)
-proc glutMainLoop*()
-  # GLUT window sub-API.
-proc glutCreateWindow*(title: cstring): int
-proc glutCreateSubWindow*(win, x, y, width, height: int): int
-proc glutDestroyWindow*(win: int)
-proc glutPostRedisplay*()
-proc glutPostWindowRedisplay*(win: int)
-proc glutSwapBuffers*()
-proc glutSetWindow*(win: int)
-proc glutSetWindowTitle*(title: cstring)
-proc glutSetIconTitle*(title: cstring)
-proc glutPositionWindow*(x, y: int)
-proc glutReshapeWindow*(width, height: int)
-proc glutPopWindow*()
-proc glutPushWindow*()
-proc glutIconifyWindow*()
-proc glutShowWindow*()
-proc glutHideWindow*()
-proc glutFullScreen*()
-proc glutSetCursor*(cursor: int)
-proc glutWarpPointer*(x, y: int)
-  # GLUT overlay sub-API.
-proc glutEstablishOverlay*()
-proc glutRemoveOverlay*()
-proc glutUseLayer*(layer: GLenum)
-proc glutPostOverlayRedisplay*()
-proc glutPostWindowOverlayRedisplay*(win: int)
-proc glutShowOverlay*()
-proc glutHideOverlay*()
-  # GLUT menu sub-API.
-proc glutCreateMenu*(callback: TGlut1IntCallback): int
-proc glutDestroyMenu*(menu: int)
-proc glutSetMenu*(menu: int)
-proc glutAddMenuEntry*(caption: cstring, value: int)
-proc glutAddSubMenu*(caption: cstring, submenu: int)
-proc glutChangeToMenuEntry*(item: int, caption: cstring, value: int)
-proc glutChangeToSubMenu*(item: int, caption: cstring, submenu: int)
-proc glutRemoveMenuItem*(item: int)
-proc glutAttachMenu*(button: int)
-proc glutDetachMenu*(button: int)
-  # GLUT window callback sub-API.
-proc glutDisplayFunc*(f: TGlutVoidCallback)
-proc glutReshapeFunc*(f: TGlut2IntCallback)
-proc glutKeyboardFunc*(f: TGlut1Char2IntCallback)
-proc glutMouseFunc*(f: TGlut4IntCallback)
-proc glutMouseWheelFunc*(f: TGlut4IntCallback)
-proc glutMotionFunc*(f: TGlut2IntCallback)
-proc glutPassiveMotionFunc*(f: TGlut2IntCallback)
-proc glutEntryFunc*(f: TGlut1IntCallback)
-proc glutVisibilityFunc*(f: TGlut1IntCallback)
-proc glutIdleFunc*(f: TGlutVoidCallback)
-proc glutTimerFunc*(millis: int16, f: TGlut1IntCallback, value: int)
-proc glutMenuStateFunc*(f: TGlut1IntCallback)
-proc glutSpecialFunc*(f: TGlut3IntCallback)
-proc glutSpaceballMotionFunc*(f: TGlut3IntCallback)
-proc glutSpaceballRotateFunc*(f: TGlut3IntCallback)
-proc glutSpaceballButtonFunc*(f: TGlut2IntCallback)
-proc glutButtonBoxFunc*(f: TGlut2IntCallback)
-proc glutDialsFunc*(f: TGlut2IntCallback)
-proc glutTabletMotionFunc*(f: TGlut2IntCallback)
-proc glutTabletButtonFunc*(f: TGlut4IntCallback)
-proc glutMenuStatusFunc*(f: TGlut3IntCallback)
-proc glutOverlayDisplayFunc*(f: TGlutVoidCallback)
-proc glutWindowStatusFunc*(f: TGlut1IntCallback)
-proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback)
-proc glutSpecialUpFunc*(f: TGlut3IntCallback)
-proc glutJoystickFunc*(f: TGlut1UInt3IntCallback, pollInterval: int)
-  # GLUT color index sub-API.
-proc glutSetColor*(cell: int, red, green, blue: GLfloat)
-proc glutGetColor*(ndx, component: int): GLfloat
-proc glutCopyColormap*(win: int)
-  # GLUT state retrieval sub-API.
-  # GLUT extension support sub-API
-proc glutExtensionSupported*(name: cstring): int
-  # GLUT font sub-API
-proc glutBitmapCharacter*(font: pointer, character: int)
-proc glutBitmapWidth*(font: pointer, character: int): int
-proc glutStrokeCharacter*(font: pointer, character: int)
-proc glutStrokeWidth*(font: pointer, character: int): int
-proc glutBitmapLength*(font: pointer, str: cstring): int
-proc glutStrokeLength*(font: pointer, str: cstring): int
-  # GLUT pre-built models sub-API
-proc glutWireSphere*(radius: GLdouble, slices, stacks: GLint)
-proc glutSolidSphere*(radius: GLdouble, slices, stacks: GLint)
-proc glutWireCone*(base, height: GLdouble, slices, stacks: GLint)
-proc glutSolidCone*(base, height: GLdouble, slices, stacks: GLint)
-proc glutWireCube*(size: GLdouble)
-proc glutSolidCube*(size: GLdouble)
-proc glutWireTorus*(innerRadius, outerRadius: GLdouble, sides, rings: GLint)
-proc glutSolidTorus*(innerRadius, outerRadius: GLdouble, sides, rings: GLint)
-proc glutWireDodecahedron*()
-proc glutSolidDodecahedron*()
-proc glutWireTeapot*(size: GLdouble)
-proc glutSolidTeapot*(size: GLdouble)
-proc glutWireOctahedron*()
-proc glutSolidOctahedron*()
-proc glutWireTetrahedron*()
-proc glutSolidTetrahedron*()
-proc glutWireIcosahedron*()
-proc glutSolidIcosahedron*()
-  # GLUT video resize sub-API.
-proc glutVideoResizeGet*(param: GLenum): int
-proc glutSetupVideoResizing*()
-proc glutStopVideoResizing*()
-proc glutVideoResize*(x, y, width, height: int)
-proc glutVideoPan*(x, y, width, height: int)
-  # GLUT debugging sub-API.
-proc glutReportErrors*()
-  # GLUT device control sub-API.
-proc glutIgnoreKeyRepeat*(ignore: int)
-proc glutSetKeyRepeat*(repeatMode: int)
-proc glutForceJoystickFunc*()
-  # GLUT game mode sub-API.
-  #example glutGameModeString('1280x1024:32@75');
-proc glutGameModeString*(AString: cstring)
-proc glutLeaveGameMode*()
-proc glutGameModeGet*(mode: GLenum): int
-# implementation
-{.pop.} # dynlib: dllname, importc
-
-# Convenience procs
-proc glutInit*() =
-  ## version that passes `argc` and `argc` implicitely.
-  var
-    cmdLine {.importc: "cmdLine".}: array[0..255, cstring]
-    cmdCount {.importc: "cmdCount".}: cint
-  glutInit(addr(cmdCount), addr(cmdLine))

+ 0 - 259
src/nodesnim/thirdparty/sdl2/gfx.nim

@@ -1,259 +0,0 @@
-#
-#
-#SDL2_gfxPrimitives.h: graphics primitives for SDL
-#
-#Copyright (C) 2012  Andreas Schiffler
-#
-#This software is provided 'as-is', without any express or implied
-#warranty. In no event will the authors be held liable for any damages
-#arising from the use of this software.
-#
-#Permission is granted to anyone to use this software for any purpose,
-#including commercial applications, and to alter it and redistribute it
-#freely, subject to the following restrictions:
-#
-#1. The origin of this software must not be misrepresented; you must not
-#claim that you wrote the original software. If you use this software
-#in a product, an acknowledgment in the product documentation would be
-#appreciated but is not required.
-#
-#2. Altered source versions must be plainly marked as such, and must not be
-#misrepresented as being the original software.
-#
-#3. This notice may not be removed or altered from any source
-#distribution.
-#
-#Andreas Schiffler -- aschiffler at ferzkopp dot net
-#
-#
-
-# Docs: http://www.ferzkopp.net/Software/SDL_gfx-2.0/Docs/html/_s_d_l__gfx_primitives_8c.html
-
-import ../sdl2
-
-when not defined(SDL_Static):
-  when defined(windows):
-    const LibName = "SDL2_gfx.dll"
-  elif defined(macosx):
-    const LibName = "libSDL2_gfx.dylib"
-  else:
-    const LibName = "libSDL2_gfx(|-2.0).so(|.0)"
-else:
-  static: echo "SDL_Static option is deprecated and will soon be removed. Instead please use --dynlibOverride:SDL2_gfx."
-
-const
-  FPS_UPPER_LIMIT* = 200
-  FPS_LOWER_LIMIT* = 1
-  FPS_DEFAULT* = 30
-
-type
-  FpsManager* {.pure, final.} = object
-    framecount*: cint
-    rateticks*: cfloat
-    baseticks*: cint
-    lastticks*: cint
-    rate*: cint
-
-{.pragma: i, importc, discardable.}
-
-when not defined(SDL_Static):
-  {.push callConv:cdecl, dynlib: LibName.}
-
-# ---- Function Prototypes
-# Note: all ___Color routines expect the color to be in format 0xAABBGGRR
-# Pixel
-proc pixelColor*(renderer: RendererPtr; x, y: int16; color: uint32): SDL_Return {.importc, discardable.}
-proc pixelRGBA*(renderer: RendererPtr; x: int16; y: int16; r: uint8;
-                g: uint8; b: uint8; a: uint8): SDL_Return  {.importc, discardable.}
-# Horizontal line
-proc hlineColor*(renderer: RendererPtr; x1: int16; x2: int16;
-                 y: int16; color: uint32): SDL_Return {.importc, discardable.}
-proc hlineRGBA*(renderer: RendererPtr; x1: int16; x2: int16; y: int16;
-                r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# Vertical line
-proc vlineColor*(renderer: RendererPtr; x,y1,y2: int16;
-                  color: uint32): SDL_Return {.importc, discardable.}
-proc vlineRGBA*(renderer: RendererPtr; x,y1,y2: int16;
-                r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# Rectangle
-proc rectangleColor*(renderer: RendererPtr; x1,y1,x2,y2: int16;
-      color: uint32): SDL_Return {.importc, discardable.}
-proc rectangleRGBA*(renderer: RendererPtr; x1,y1,x2,y2: int16; r,g,b,a: uint8): SDL_Return {.
-      importc, discardable.}
-# Rounded-Corner Rectangle
-proc roundedRectangleColor*(renderer: RendererPtr; x1,y1,x2,y2,rad: int16;
-                            color: uint32): SDL_Return {.importc, discardable.}
-proc roundedRectangleRGBA*(renderer: RendererPtr; x1,y1,x2,y2,rad: int16;
-              r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# Filled rectangle (Box)
-proc boxColor*(renderer: RendererPtr; x1, y1, x2, y2: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc boxRGBA*(renderer: RendererPtr; x1, y1, x2, y2: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Rounded-Corner Filled rectangle (Box)
-proc roundedBoxColor*(renderer: RendererPtr; x1,y1,x2,y2,rad: int16;
-                       color: uint32): SDL_Return {.importc, discardable.}
-proc roundedBoxRGBA*(renderer: RendererPtr; x1,y1,x2,y2,rad: int16;
-                  r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# Line
-proc lineColor*(renderer: RendererPtr; x1,y1,x2,y2: int16;
-    color: uint32): SDL_Return {.importc, discardable.}
-proc lineRGBA*(renderer: RendererPtr; x1,y1,x2,y2: int16; r,g,b,a: uint8): SDL_Return {.
-  importc, discardable.}
-# AA Line
-proc aalineColor*(renderer: RendererPtr; x1: int16; y1: int16;
-                  x2: int16; y2: int16; color: uint32): SDL_Return {.importc, discardable.}
-proc aalineRGBA*(renderer: RendererPtr; x1: int16; y1: int16;
-                 x2: int16; y2: int16; r: uint8; g: uint8; b: uint8;
-                 a: uint8): SDL_Return {.importc, discardable.}
-# Thick Line
-proc thickLineColor*(renderer: RendererPtr; x1, y1, x2, y2: int16;
-  width: uint8; color: uint32): SDL_Return {.importc, discardable.}
-proc thickLineRGBA*(renderer: RendererPtr; x1, y1, x2, y2: int16;
-  width, r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Circle
-proc circleColor*(renderer: RendererPtr; x, y, rad: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc circleRGBA*(renderer: RendererPtr; x, y, rad: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Arc
-proc arcColor*(renderer: RendererPtr; x, y, rad, start, finish: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc arcRGBA*(renderer: RendererPtr; x, y, rad, start, finish: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# AA Circle
-proc aacircleColor*(renderer: RendererPtr; x, y, rad: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc aacircleRGBA*(renderer: RendererPtr; x, y, rad: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Filled Circle
-proc filledCircleColor*(renderer: RendererPtr; x, y, r: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc filledCircleRGBA*(renderer: RendererPtr; x, y, rad: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Ellipse
-proc ellipseColor*(renderer: RendererPtr; x: int16; y: int16;
-                   rx: int16; ry: int16; color: uint32): SDL_Return {.importc, discardable.}
-proc ellipseRGBA*(renderer: RendererPtr; x: int16; y: int16;
-                  rx: int16; ry: int16; r: uint8; g: uint8; b: uint8;
-                  a: uint8): SDL_Return {.importc, discardable.}
-# AA Ellipse
-proc aaellipseColor*(renderer: RendererPtr; x, y, rx, ry: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc aaellipseRGBA*(renderer: RendererPtr; x, y, rx, ry: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Filled Ellipse
-proc filledEllipseColor*(renderer: RendererPtr; x, y, rx, ry: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc filledEllipseRGBA*(renderer: RendererPtr; x, y, rx, ry: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Pie
-proc pieColor*(renderer: RendererPtr; x, y, rad, start, finish: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc pieRGBA*(renderer: RendererPtr; x, y, rad, start, finish: int16;
-  r, g, b, a: uint8): SDL_Return  {.importc, discardable.}
-# Filled Pie
-proc filledPieColor*(renderer: RendererPtr; x, y, rad, start, finish: int16;
-  color: uint32): SDL_Return {.importc, discardable.}
-proc filledPieRGBA*(renderer: RendererPtr; x, y, rad, start, finish: int16;
-  r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Trigon
-proc trigonColor*(renderer: RendererPtr; x1,y1,x2,y2,x3,y3: int16,
-                   color: uint32): SDL_Return {.importc, discardable.}
-proc trigonRGBA*(renderer: RendererPtr; x1, y1, x2, y2, x3, y3: int16;
-                  r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# AA-Trigon
-proc aaTrigonColor*(renderer: RendererPtr; x1, y1, x2, y2, x3, y3: int16;
-                    color: uint32): SDL_Return {.importc: "aatrigonColor",
-                    discardable.}
-proc aaTrigonRGBA*(renderer: RendererPtr; x1, y1, x2, y2, x3, y3: int16;
-                    r,g,b,a: uint8): SDL_Return {.importc: "aatrigonRGBA",
-                    discardable.}
-# Filled Trigon
-proc filledTrigonColor*(renderer: RendererPtr; x1: int16; y1: int16;
-                        x2: int16; y2: int16; x3: int16; y3: int16;
-                        color: uint32): SDL_Return {.importc, discardable.}
-proc filledTrigonRGBA*(renderer: RendererPtr; x1: int16; y1: int16;
-                       x2: int16; y2: int16; x3: int16; y3: int16;
-                       r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# Polygon
-proc polygonColor*(renderer: RendererPtr; vx: ptr int16; vy: ptr int16;
-                   n: cint; color: uint32): SDL_Return {.importc, discardable.}
-proc polygonRGBA*(renderer: RendererPtr; vx: ptr int16; vy: ptr int16;
-                  n: cint; r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# AA-Polygon
-proc aaPolygonColor*(renderer: RendererPtr; vx: ptr int16; vy: ptr int16;
-                     n: cint; color: uint32): SDL_Return {.importc: "aapolygonColor",
-                     discardable.}
-proc aaPolygonRGBA*(renderer: RendererPtr; vx: ptr int16; vy: ptr int16;
-                    n: cint; r,g,b,a: uint8): SDL_Return {.importc: "aapolygonRGBA",
-                    discardable.}
-# Filled Polygon
-proc filledPolygonColor*(renderer: RendererPtr; vx: ptr int16;
-                         vy: ptr int16; n: cint; color: uint32): SDL_Return {.importc, discardable.}
-proc filledPolygonRGBA*(renderer: RendererPtr; vx: ptr int16;
-                        vy: ptr int16; n: cint; r: uint8; g: uint8; b: uint8;
-                        a: uint8): SDL_Return {.importc, discardable.}
-# Textured Polygon
-proc texturedPolygon*(renderer: RendererPtr; vx: ptr int16;
-                      vy: ptr int16; n: cint; texture: SurfacePtr;
-                      texture_dx: cint; texture_dy: cint): SDL_Return {.importc, discardable.}
-# Bezier
-proc bezierColor*(renderer: RendererPtr; vx,vy: ptr int16;
-                  n: cint; s: cint; color: uint32): SDL_Return {.importc, discardable.}
-proc bezierRGBA*(renderer: RendererPtr; vx, vy: ptr int16;
-                 n: cint; s: cint; r, g, b, a: uint8): SDL_Return {.importc, discardable.}
-# Characters/Strings
-proc gfxPrimitivesSetFont*(fontdata: pointer; cw: uint32; ch: uint32) {.importc.}
-proc gfxPrimitivesSetFontRotation*(rotation: uint32) {.importc.}
-proc characterColor*(renderer: RendererPtr; x: int16; y: int16;
-                     c: char; color: uint32): SDL_Return {.importc.}
-proc characterRGBA*(renderer: RendererPtr; x: int16; y: int16; c: char;
-                    r,g,b,a: uint8): SDL_Return {.importc.}
-proc stringColor*(renderer: RendererPtr; x: int16; y: int16;
-                  s: cstring; color: uint32): SDL_Return {.importc.}
-proc stringRGBA*(renderer: RendererPtr; x: int16; y: int16; s: cstring;
-                 r,g,b,a: uint8): SDL_Return {.importc, discardable.}
-# Ends C function definitions when using C++
-
-proc rotozoomSurface*(src: SurfacePtr; angle, zoom: cdouble;
-  smooth: cint): SurfacePtr {.importc.}
-proc rotozoomSurfaceXY*(src: SurfacePtr; angle, zoomX, zoomY: cdouble;
-  smooth: cint): SurfacePtr {.importc.}
-proc rotozoomSurfaceSize*(width, height: cint; angle, zoom: cdouble;
-  dstwidth, dstheight: var cint) {.importc.}
-proc rotozoomSurfaceSizeXY*(width, height: cint; angle, zoomX, zoomY: cdouble;
-                            dstwidth, dstheight: var cint) {.importc.}
-proc zoomSurface*(src: SurfacePtr; zoomX, zoomY: cdouble;
-  smooth: cint): SurfacePtr {.importc.}
-proc zoomSurfaceSize*(width, height: cint; zoomX, zoomY: cdouble;
-  dstWidth, dstHeight: var cint) {.importc.}
-
-proc shrinkSurface*(src: SurfacePtr; factorx, factorY: cint): SurfacePtr {.importc.}
-proc rotateSurface90Degrees*(src: SurfacePtr;
-  numClockwiseTurns: cint): SurfacePtr {.importc.}
-
-proc init*(manager: var FpsManager) {.importc: "SDL_initFramerate".}
-proc setFramerate*(manager: var FpsManager; rate: cint): SDL_Return {.
-  importc: "SDL_setFramerate", discardable.}
-proc getFramerate*(manager: var FpsManager): cint {.importc: "SDL_getFramerate".}
-proc getFramecount*(manager: var FpsManager): cint {.importc: "SDL_getFramecount".}
-proc delay*(manager: var FpsManager): cint {.importc: "SDL_framerateDelay", discardable.}
-
-when not defined(SDL_Static):
-  {.pop.}
-
-from strutils import splitLines
-proc mlStringRGBA*(renderer: RendererPtr; x,y: int16, S: string, R,G,B,A: uint8, lineSpacing = 2'i16) =
-  ## Draw a multi-line string
-  var ln = 0
-  for L in splitLines(S):
-    renderer.stringRGBA(x,(y + int16(ln * 8) + int16(ln * lineSpacing)),L, R,G,B,A)
-    inc ln
-proc mlStringRGBA*(renderer: RendererPtr; x,y: int16; S: seq[string]; R,G,B,A: uint8; lineSpacing = 2'i16) =
-  var ln = 0
-  while ln < S.len:
-    renderer.stringRGBA(x, y + int16(ln * 8 + ln * lineSpacing), S[ln], R,G,B,A)
-    inc ln
-
-{.deprecated: [TFPSmanager: FpsManager].}

+ 0 - 301
src/nodesnim/thirdparty/sdl2/net.nim

@@ -1,301 +0,0 @@
-#
-#  SDL_net:  An example cross-platform network library for use with SDL
-#  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
-#  Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
-#
-#  This software is provided 'as-is', without any express or implied
-#  warranty.  In no event will the authors be held liable for any damages
-#  arising from the use of this software.
-#
-#  Permission is granted to anyone to use this software for any purpose,
-#  including commercial applications, and to alter it and redistribute it
-#  freely, subject to the following restrictions:
-#
-#  1. The origin of this software must not be misrepresented; you must not
-#     claim that you wrote the original software. If you use this software
-#     in a product, an acknowledgment in the product documentation would be
-#     appreciated but is not required.
-#  2. Altered source versions must be plainly marked as such, and must not be
-#     misrepresented as being the original software.
-#  3. This notice may not be removed or altered from any source distribution.
-#
-# $Id$
-import ../sdl2
-
-when not defined(SDL_Static):
-  when defined(windows):
-    const LibName* = "SDL2_net.dll"
-  elif defined(macosx):
-    const LibName* = "libSDL2_net.dylib"
-  else:
-    const LibName* = "libSDL2_net(|-2.0).so(|.0)"
-else:
-  static: echo "SDL_Static option is deprecated and will soon be removed. Instead please use --dynlibOverride:SDL2."
-
-type
-  IpAddress* = object
-    host*: uint32           # 32-bit IPv4 host address
-    port*: uint16           # 16-bit protocol port
-
-  TcpSocket* = pointer
-
-const
-  INADDR_ANY* = 0x00000000
-  INADDR_NONE* = 0xFFFFFFFF
-  INADDR_LOOPBACK* = 0x7F000001
-  INADDR_BROADCAST* = 0xFFFFFFFF
-# The maximum channels on a a UDP socket
-const
-  SDLNET_MAX_UDPCHANNELS* = 32
-# The maximum addresses bound to a single UDP socket channel
-const
-  SDLNET_MAX_UDPADDRESSES* = 4
-type
-  UDPsocket* = ptr object
-  UDPpacket* = object
-    channel*: cint          # The src/dst channel of the packet
-    data*: ptr uint8        # The packet data
-    len*: cint              # The length of the packet data
-    maxlen*: cint           # The size of the data buffer
-    status*: cint           # packet status after sending
-    address*: IpAddress     # The source/dest address of an incoming/outgoing packet
-
-#*********************************************************************
-# Hooks for checking sockets for available data
-#*********************************************************************
-type
-  SocketSet* = pointer
-# Any network socket can be safely cast to this socket type
-type
-  GenericSocketObj* = object
-    ready*: cint
-  GenericSocket* = ptr GenericSocketObj
-
-when not defined(SDL_Static):
-  {.push dynlib: LibName, callconv: cdecl.}
-# This function gets the version of the dynamically linked SDL_net library.
-#   it should NOT be used to fill a version structure, instead you should
-#   use the SDL_NET_VERSION() macro.
-#
-
-proc linkedVersion*(): ptr SDL_Version {.importc: "SDLNet_Linked_Version".}
-# Initialize/Cleanup the network API
-#   SDL must be initialized before calls to functions in this library,
-#   because this library uses utility functions from the SDL library.
-#
-proc init*(): cint {.importc: "SDLNet_Init".}
-proc quit*() {.importc: "SDLNet_Quit".}
-#*********************************************************************
-# IPv4 hostname resolution API
-#*********************************************************************
-
-# Resolve a host name and port to an IP address in network form.
-#   If the function succeeds, it will return 0.
-#   If the host couldn't be resolved, the host portion of the returned
-#   address will be INADDR_NONE, and the function will return -1.
-#   If 'host' is NULL, the resolved host will be set to INADDR_ANY.
-#
-proc resolveHost*(address: ptr IpAddress; host: cstring; port: uint16): cint {.importc: "SDLNet_ResolveHost".}
-# Resolve an ip address to a host name in canonical form.
-#   If the ip couldn't be resolved, this function returns NULL,
-#   otherwise a pointer to a static buffer containing the hostname
-#   is returned.  Note that this function is not thread-safe.
-#
-proc resolveIP*(ip: ptr IpAddress): cstring {.importc: "SDLNet_ResolveIP".}
-# Get the addresses of network interfaces on this system.
-#   This returns the number of addresses saved in 'addresses'
-#
-proc getLocalAddresses*(addresses: ptr IpAddress; maxcount: cint): cint {.importc: "SDLNet_GetLocalAddresses".}
-#*********************************************************************
-# TCP network API
-#*********************************************************************
-
-# Open a TCP network socket
-#   If ip.host is INADDR_NONE or INADDR_ANY, this creates a local server
-#   socket on the given port, otherwise a TCP connection to the remote
-#   host and port is attempted. The address passed in should already be
-#   swapped to network byte order (addresses returned from
-#   SDLNet_ResolveHost() are already in the correct form).
-#   The newly created socket is returned, or NULL if there was an error.
-#
-proc tcpOpen*(ip: ptr IpAddress): TcpSocket {.importc: "SDLNet_TCP_Open".}
-# Accept an incoming connection on the given server socket.
-#   The newly created socket is returned, or NULL if there was an error.
-#
-proc tcpAccept*(server: TcpSocket): TcpSocket {.importc: "SDLNet_TCP_Accept".}
-# Get the IP address of the remote system associated with the socket.
-#   If the socket is a server socket, this function returns NULL.
-#
-proc tcpGetPeerAddress*(sock: TcpSocket): ptr IpAddress {.importc: "SDLNet_TCP_GetPeerAddress".}
-# Send 'len' bytes of 'data' over the non-server socket 'sock'
-#   This function returns the actual amount of data sent.  If the return value
-#   is less than the amount of data sent, then either the remote connection was
-#   closed, or an unknown socket error occurred.
-#
-proc tcpSend*(sock: TcpSocket; data: pointer; len: cint): cint {.importc: "SDLNet_TCP_Send".}
-# Receive up to 'maxlen' bytes of data over the non-server socket 'sock',
-#   and store them in the buffer pointed to by 'data'.
-#   This function returns the actual amount of data received.  If the return
-#   value is less than or equal to zero, then either the remote connection was
-#   closed, or an unknown socket error occurred.
-#
-proc tcpRecv*(sock: TcpSocket; data: pointer; maxlen: cint): cint {.importc: "SDLNet_TCP_Recv".}
-# Close a TCP network socket
-proc tcpClose*(sock: TcpSocket) {.importc: "SDLNet_TCP_Close".}
-#*********************************************************************
-# UDP network API
-#*********************************************************************
-
-# Allocate/resize/free a single UDP packet 'size' bytes long.
-#   The new packet is returned, or NULL if the function ran out of memory.
-#
-proc allocPacket*(size: cint): ptr UDPpacket {.importc: "SDLNet_AllocPacket".}
-proc resizePacket*(packet: ptr UDPpacket; newsize: cint): cint {.importc: "SDLNet_ResizePacket".}
-proc freePacket*(packet: ptr UDPpacket) {.importc: "SDLNet_FreePacket".}
-# Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets,
-#   each 'size' bytes long.
-#   A pointer to the first packet in the array is returned, or NULL if the
-#   function ran out of memory.
-#
-proc allocPacketV*(howmany: cint; size: cint): ptr ptr UDPpacket {.importc: "SDLNet_AllocPacketV".}
-proc freePacketV*(packetV: ptr ptr UDPpacket) {.importc: "SDLNet_FreePacketV".}
-# Open a UDP network socket
-#   If 'port' is non-zero, the UDP socket is bound to a local port.
-#   The 'port' should be given in native byte order, but is used
-#   internally in network (big endian) byte order, in addresses, etc.
-#   This allows other systems to send to this socket via a known port.
-#
-proc udpOpen*(port: uint16): UDPsocket {.importc: "SDLNet_UDP_Open".}
-# Set the percentage of simulated packet loss for packets sent on the socket.
-#
-proc udpSetPacketLoss*(sock: UDPsocket; percent: cint) {.importc: "SDLNet_UDP_SetPacketLoss".}
-# Bind the address 'address' to the requested channel on the UDP socket.
-#   If the channel is -1, then the first unbound channel that has not yet
-#   been bound to the maximum number of addresses will be bound with
-#   the given address as it's primary address.
-#   If the channel is already bound, this new address will be added to the
-#   list of valid source addresses for packets arriving on the channel.
-#   If the channel is not already bound, then the address becomes the primary
-#   address, to which all outbound packets on the channel are sent.
-#   This function returns the channel which was bound, or -1 on error.
-#
-proc udpBind*(sock: UDPsocket; channel: cint; address: ptr IpAddress): cint {.importc: "SDLNet_UDP_Bind".}
-# Unbind all addresses from the given channel
-proc udpUnbind*(sock: UDPsocket; channel: cint) {.importc: "SDLNet_UDP_Unbind".}
-# Get the primary IP address of the remote system associated with the
-#   socket and channel.  If the channel is -1, then the primary IP port
-#   of the UDP socket is returned -- this is only meaningful for sockets
-#   opened with a specific port.
-#   If the channel is not bound and not -1, this function returns NULL.
-#
-proc udpGetPeerAddress*(sock: UDPsocket; channel: cint): ptr IpAddress {.importc: "SDLNet_UDP_GetPeerAddress".}
-# Send a vector of packets to the the channels specified within the packet.
-#   If the channel specified in the packet is -1, the packet will be sent to
-#   the address in the 'src' member of the packet.
-#   Each packet will be updated with the status of the packet after it has
-#   been sent, -1 if the packet send failed.
-#   This function returns the number of packets sent.
-#
-proc udpSendV*(sock: UDPsocket; packets: ptr ptr UDPpacket;
-               npackets: cint): cint {.importc: "SDLNet_UDP_SendV".}
-# Send a single packet to the specified channel.
-#   If the channel specified in the packet is -1, the packet will be sent to
-#   the address in the 'src' member of the packet.
-#   The packet will be updated with the status of the packet after it has
-#   been sent.
-#   This function returns 1 if the packet was sent, or 0 on error.
-#
-#   NOTE:
-#   The maximum size of the packet is limited by the MTU (Maximum Transfer Unit)
-#   of the transport medium.  It can be as low as 250 bytes for some PPP links,
-#   and as high as 1500 bytes for ethernet.
-#
-proc udpSend*(sock: UDPsocket; channel: cint; packet: ptr UDPpacket): cint {.importc: "SDLNet_UDP_Send".}
-# Receive a vector of pending packets from the UDP socket.
-#   The returned packets contain the source address and the channel they arrived
-#   on.  If they did not arrive on a bound channel, the the channel will be set
-#   to -1.
-#   The channels are checked in highest to lowest order, so if an address is
-#   bound to multiple channels, the highest channel with the source address
-#   bound will be returned.
-#   This function returns the number of packets read from the network, or -1
-#   on error.  This function does not block, so can return 0 packets pending.
-#
-proc udpRecvV*(sock: UDPsocket; packets: ptr ptr UDPpacket): cint {.importc: "SDLNet_UDP_RecvV".}
-# Receive a single packet from the UDP socket.
-#   The returned packet contains the source address and the channel it arrived
-#   on.  If it did not arrive on a bound channel, the the channel will be set
-#   to -1.
-#   The channels are checked in highest to lowest order, so if an address is
-#   bound to multiple channels, the highest channel with the source address
-#   bound will be returned.
-#   This function returns the number of packets read from the network, or -1
-#   on error.  This function does not block, so can return 0 packets pending.
-#
-proc udpRecv*(sock: UDPsocket; packet: ptr UDPpacket): cint {.importc: "SDLNet_UDP_Recv".}
-# Close a UDP network socket
-proc udpClose*(sock: UDPsocket) {.importc: "SDLNet_UDP_Close".}
-
-# Allocate a socket set for use with SDLNet_CheckSockets()
-#   This returns a socket set for up to 'maxsockets' sockets, or NULL if
-#   the function ran out of memory.
-#
-proc allocSocketSet*(maxsockets: cint): SocketSet {.importc: "SDLNet_AllocSocketSet".}
-# Add a socket to a set of sockets to be checked for available data
-proc addSocket*(set: SocketSet; sock: GenericSocket): cint {.importc: "SDLNet_AddSocket".}
-
-# Remove a socket from a set of sockets to be checked for available data
-proc delSocket*(set: SocketSet; sock: GenericSocket): cint {.importc: "SDLNet_DelSocket".}
-
-# This function checks to see if data is available for reading on the
-#   given set of sockets.  If 'timeout' is 0, it performs a quick poll,
-#   otherwise the function returns when either data is available for
-#   reading, or the timeout in milliseconds has elapsed, which ever occurs
-#   first.  This function returns the number of sockets ready for reading,
-#   or -1 if there was an error with the select() system call.
-#
-proc checkSockets*(set: SocketSet; timeout: uint32): cint {.importc: "SDLNet_CheckSockets".}
-# After calling CheckSockets(), you can use this function on a
-#   socket that was in the socket set, to find out if data is available
-#   for reading.
-#
-
-# Free a set of sockets allocated by SDL_NetAllocSocketSet()
-proc freeSocketSet*(set: SocketSet) {.importc: "SDLNet_FreeSocketSet".}
-#*********************************************************************
-# Error reporting functions
-#*********************************************************************
-proc setError*(fmt: cstring) {.varargs, importc: "SDLNet_SetError".}
-proc getError*(): cstring {.importc: "SDLNet_GetError".}
-#*********************************************************************
-# Inline functions to read/write network data
-#*********************************************************************
-# Warning, some systems have data access alignment restrictions
-
-proc write16* (value: uint16, dest: pointer) {.importc: "SDLNet_Write16".}
-proc write32* (value: uint32, dest: pointer) {.importc: "SDLNet_Write32".}
-proc read16* (src: pointer): uint16 {.importc: "SDLNet_Read16".}
-proc read32* (src: pointer): uint32 {.importc: "SDLNet_Read32".}
-
-when not defined(SDL_Static):
-  {.pop.}
-
-proc tcpAddSocket*(set: SocketSet; sock: TcpSocket): cint =
-  addSocket(set, cast[GenericSocket](sock))
-
-proc udpAddSocket*(set: SocketSet; sock: UDPsocket): cint =
-  addSocket(set, cast[GenericSocket](sock))
-
-
-proc tcpDelSocket*(set: SocketSet; sock: TcpSocket): cint {.inline.} =
-  delSocket(set, cast[GenericSocket](sock))
-
-proc udpDelSocket*(set: SocketSet; sock: UDPsocket): cint {.inline.} =
-  delSocket(set, cast[GenericSocket](sock))
-
-
-##define SDLNet_SocketReady(sock) _SDLNet_SocketReady((SDLNet_GenericSocket)(sock))
-#proc _SDLNet_SocketReady*(sock: SDLNet_GenericSocket): cint =
-#  #return (sock != NULL) && (sock->ready);
-proc socketReady* (sock: GenericSocket): bool =
-  not(sock.isNil) and sock.ready > 0