Page 1 of 1

Sigil Wrapper

Posted: Fri Apr 14, 2023 1:31 am
by LeftyGuitar
Hello all,

Here is a project I made with the demo version of PureBasic. It is a wrapper for the Sigil Library, it is a fairly small and simple project. Sigil is a simple multimedia library for programming things like games and such.

More about Sigil here: https://gitlab.com/geoff-nagy/sigil/-/tree/master/

PB file and needed DLLs
https://katfile.com/otpr772l0izu/PBSigil.zip.html

PB Code File

Code: Select all

;Sigil PureBasic Wrapper
;Written By Andy P.
;Icy Viking Games
;Copyright (c) 2023

;Global Var
#SIGIL_D = 0

;Flags/Constants
#SL_ALIGN_CENTER = 0
#SL_ALIGN_RIGHT = 1
#SL_ALIGN_LEFT = 2

#SL_KEY_ESCAPE = 256
#SL_KEY_ENTER = 257
#SL_KEY_TAB = 258
#SL_KEY_BACKSPACE = 259
#SL_KEY_INSERT = 260
#SL_KEY_DELETE = 261
#SL_KEY_RIGHT = 262
#SL_KEY_LEFT = 263
#SL_KEY_DOWN = 264
#SL_KEY_UP = 265
#SL_KEY_PAGE_UP = 266
#SL_KEY_PAGE_DOWN = 267
#SL_KEY_HOME = 268
#SL_KEY_END = 269
#SL_KEY_CAPS_LOCK = 280
#SL_KEY_SCROLL_LOCK = 281
#SL_KEY_NUM_LOCK = 282
#SL_KEY_PRINT_SCREEN = 283
#SL_KEY_PAUSE = 284
#SL_KEY_F1 = 290
#SL_KEY_F2 = 291
#SL_KEY_F3 = 292
#SL_KEY_F4 = 293
#SL_KEY_F5 = 294
#SL_KEY_F6 = 295
#SL_KEY_F7 = 296
#SL_KEY_F8 = 297
#SL_KEY_F9 = 298
#SL_KEY_F10 = 299
#SL_KEY_F11 = 300
#SL_KEY_F12 = 301
#SL_KEY_F13 = 302
#SL_KEY_F14 = 303
#SL_KEY_F15 = 304
#SL_KEY_F16 = 305
#SL_KEY_F17 = 306
#SL_KEY_F18 = 307
#SL_KEY_F19 = 308
#SL_KEY_F20 = 309
#SL_KEY_F21 = 310
#SL_KEY_F22 = 311
#SL_KEY_F23 = 312
#SL_KEY_F24 = 313
#SL_KEY_F25 = 314
#SL_KEY_KEYPAD_0 = 320
#SL_KEY_KEYPAD_1 = 321
#SL_KEY_KEYPAD_2 = 322
#SL_KEY_KEYPAD_3 = 323
#SL_KEY_KEYPAD_4 = 324
#SL_KEY_KEYPAD_5 = 325
#SL_KEY_KEYPAD_6 = 326
#SL_KEY_KEYPAD_7 = 327
#SL_KEY_KEYPAD_8 = 328
#SL_KEY_KEYPAD_9 = 329
#SL_KEY_KEYPAD_DECIMAL = 330
#SL_KEY_KEYPAD_DIVIDE = 331
#SL_KEY_KEYPAD_MULTIPLY = 332
#SL_KEY_KEYPAD_SUBTRACT = 333
#SL_KEY_KEYPAD_ADD = 334
#SL_KEY_KEYPAD_ENTER = 335
#SL_KEY_KEYPAD_EQUAL = 336
#SL_KEY_LEFT_SHIFT = 340
#SL_KEY_LEFT_CONTROL = 341
#SL_KEY_LEFT_ALT = 342
#SL_KEY_LEFT_SUPER = 343
#SL_KEY_RIGHT_SHIFT = 344
#SL_KEY_RIGHT_CONTROL = 345
#SL_KEY_RIGHT_ALT = 346
#SL_KEY_RIGHT_SUPER = 347

#SL_MOUSE_BUTTON_1 = 0
#SL_MOUSE_BUTTON_2 = 1
#SL_MOUSE_BUTTON_3 = 2
#SL_MOUSE_BUTTON_4 = 3
#SL_MOUSE_BUTTON_5 = 4
#SL_MOUSE_BUTTON_6 = 5
#SL_MOUSE_BUTTON_7 = 6
#SL_MOUSE_BUTTON_8 = 7
#SL_MOUSE_BUTTON_LEFT = #SL_MOUSE_BUTTON_1
#SL_MOUSE_BUTTON_RIGHT = #SL_MOUSE_BUTTON_2
#SL_MOUSE_BUTTON_MIDDLE = #SL_MOUSE_BUTTON_3

;Prototypes
Prototype ProtoslWindow(width.i,height.i,title.s,fullScreen.i)
Prototype ProtoslShowCursor(showCursor.i)
Prototype ProtoslClose()
Prototype.I ProtoslShouldClose()

Prototype.I ProtoslGetKey(key.i)

Prototype.I ProtoslGetMouseButton(button.i)
Prototype.I ProtoslGetMouseX()
Prototype.I ProtoslGetMouseY()

Prototype.D ProtoslGetDeltaTime()
Prototype.D ProtoslGetTime()

Prototype ProtoslRender()

Prototype ProtoslSetBackColor(red.d,green.d,blue.d)
Prototype ProtoslSetForeColor(red.d,green.d,blue.d,alpha.d)

Prototype ProtoslSetAdditiveBlend(ab.i)

Prototype ProtoslPush()
Prototype ProtoslPop()

Prototype ProtoslTranslate(x.d,y.d)
Prototype ProtoslRotate(degrees.d)
Prototype ProtoslScale(x.d,y.d)

Prototype.I ProtoslLoadTexture(filename.s)

Prototype.I ProtoslLoadWAV(filename.s)
Prototype.I ProtoslSoundPlay(sound.i)
Prototype.I ProtoslSoundLoop(sound.i)
Prototype ProtoslSoundPause(sound.i)
Prototype ProtoslSoundStop(sound.i)
Prototype ProtoslSoundPauseAll()
Prototype ProtoslSoundResumeAll()
Prototype ProtoslSoundStopAll()
Prototype.I ProtoslSoundPlaying(sound.i)
Prototype.I ProtoslSoundLooping(sound.i)

Prototype ProtoslTriangleFill(x.d,y.d,width.d,height.d)
Prototype ProtoslTriangleOutline(x.d,y.d,width.d,height.d)

Prototype ProtoslRectangleFill(x.d,y.d,width.d,height.d)
Prototype ProtoslRectangleOutline(x.d,y.d,width.d,height.d)

Prototype ProtoslCircleFill(x.d,y.d,radius.d,numVerts.i)
Prototype ProtoslCircleOutline(x.d,y.d,radius.d,numVerts.i)

Prototype ProtoslSemiCircleFill(x.d,y.d,radius.d,numVerts.i,degrees.d)
Prototype ProtoslSemiCircleOutline(x.d,y.d,radius.d,numVerts.i,degrees.d)

Prototype ProtoslPoint(x.d,y.d)

Prototype ProtoslLine(x1.d,y1.d,x2.d,y2.d)

Prototype ProtoslSetSpriteTiling(x.d,y.d)
Prototype ProtoslSetSpriteScroll(x.d,y.d)
Prototype ProtoslSprite(texture.i,x.d,y.d,width.d,height.d)

Prototype ProtoslSetTextAlign(fontAlign.i)
Prototype ProtoslGetTextWidth(text.s)
Prototype ProtoslGetTextHeight(text.s)
Prototype ProtoslLoadFont(fontFileName.s)
Prototype ProtoslSetFont(font.i,fonstSize.i)
Prototype ProtoslSetFontSize(fontsize.i)
Prototype ProtoslText(x.d,y.d,text.s)

;DLL Calls
If OpenLibrary(#SIGIL_D,"sigil.dll")
  
  slWindow.ProtoslWindow = GetFunction(#SIGIL_D,"slWindow")
  slShowCursor.ProtoslShowCursor = GetFunction(#SIGIL_D,"slShowCursor")
  slClose.ProtoslClose = GetFunction(#SIGIL_D,"slClose")
  slShouldClose.ProtoslShouldClose = GetFunction(#SIGIL_D,"slShouldClose")
  
  slGetKey.ProtoslGetKey = GetFunction(#SIGIL_D,"slGetKey")
  
  slGetMouseButton.ProtoslGetMouseButton = GetFunction(#SIGIL_D,"slGetMouseButton")
  slGetMouseX.ProtoslGetMouseX = GetFunction(#SIGIL_D,"slGetMouseX")
  slGetMouseY.ProtoslGetMouseY = GetFunction(#SIGIL_D,"slGetMouseY")
  
  slRender.ProtoslRender = GetFunction(#SIGIL_D,"slRender")
  
  slSetBackColor.ProtoslSetBackColor = GetFunction(#SIGIL_D,"slSetBackColor")
  slSetForeColor.ProtoslSetForeColor = GetFunction(#SIGIL_D,"slSetForeColor")
  
  slSetAdditiveBlend.ProtoslSetAdditiveBlend = GetFunction(#SIGIL_D,"slSetAdditiveBlend")
  
  slPush.ProtoslPush = GetFunction(#SIGIL_D,"slPush")
  slPop.ProtoslPop = GetFunction(#SIGIL_D,"slPop")
  
  slTranslate.ProtoslTranslate = GetFunction(#SIGIL_D,"slTranslate")
  slRotate.ProtoslRotate = GetFunction(#SIGIL_D,"slRotate")
  slScale.ProtoslScale = GetFunction(#SIGIL_D,"slScale")
  
  slLoadTexture.ProtoslLoadTexture = GetFunction(#SIGIL_D,"slLoadTexture")
  
  slLoadWAV.ProtoslLoadWAV = GetFunction(#SIGIL_D,"slLoadWAV")
  slSoundPlay.ProtoslSoundPlay = GetFunction(#SIGIL_D,"slSoundPlay")
  slSoundLoop.ProtoslSoundLoop = GetFunction(#SIGIL_D,"slSoundLoop")
  slSoundPause.ProtoslSoundPause = GetFunction(#SIGIL_D,"slSoundPause")
  slSoundStop.ProtoslSoundStop = GetFunction(#SIGIL_D,"slSoundStop")
  slSoundPauseAll.ProtoslSoundPauseAll = GetFunction(#SIGIL_D,"slSoundPauseAll")
  slSoundResumeAll.ProtoslSoundResumeAll = GetFunction(#SIGIL_D,"slSoundResumeAll")
  slSoundStopAll.ProtoslSoundStopAll = GetFunction(#SIGIL_D,"slSoundStopAll")
  slSoundPlaying.ProtoslSoundPlaying = GetFunction(#SIGIL_D,"slSoundPlaying")
  slSoundLooping.ProtoslSoundLooping = GetFunction(#SIGIL_D,"slSoundLooping")
  
  slTriangleFill.ProtoslTriangleFill = GetFunction(#SIGIL_D,"slTriangleFill")
  slTriangleOutline.ProtoslTriangleOutline = GetFunction(#SIGIL_D,"slTriangleOutline")
  
  slRectangleFill.ProtoslRectangleFill = GetFunction(#SIGIL_D,"slRectangleFill")
  slRectangleOutline.ProtoslRectangleOutline = GetFunction(#SIGIL_D,"slRectangleOutline")
  
  slCircleFill.ProtoslCircleFill = GetFunction(#SIGIL_D,"slCircleFill")
  slCircleOutline.ProtoslCircleOutline = GetFunction(#SIGIL_D,"slCircleOutline")
  
  slSemiCircleFill.ProtoslSemiCircleFill = GetFunction(#SIGIL_D,"slSemiCircleFill")
  slSemiCircleOutline.ProtoslSemiCircleOutline = GetFunction(#SIGIL_D,"slSemiCircleOutline")
  
  slPoint.ProtoslPoint = GetFunction(#SIGIL_D,"slPoint")
  
  slLine.ProtoslLine = GetFunction(#SIGIL_D,"slLine")
  
  slSetSpriteTiling.ProtoslSetSpriteTiling = GetFunction(#SIGIL_D,"slSetSpriteTiling")
  slSetSpriteScroll.ProtoslSetSpriteScroll = GetFunction(#SIGIL_D,"slSetSpriteScroll")
  slSprite.ProtoslSprite = GetFunction(#SIGIL_D,"slSprite")
  
  slSetTextAlign.ProtoslSetTextAlign = GetFunction(#SIGIL_D,"slSetTextAlign")
  slGetTextWidth.ProtoslGetTextWidth = GetFunction(#SIGIL_D,"slGetTextWidth")
  slGetTextHeight.ProtoslGetTextHeight = GetFunction(#SIGIL_D,"slGetTextHeight")
  slLoadFont.ProtoslLoadFont = GetFunction(#SIGIL_D,"slLoadFont")
  slSetFont.ProtoslSetFont = GetFunction(#SIGIL_D,"slSetFont")
  slSetFontSize.ProtoslSetFontSize = GetFunction(#SIGIL_D,"slSetFontSize")
  slText.ProtoslText = GetFunction(#SIGIL_D,"slText")
   
   ;Simple Example
   slWindow(800,600,"Hello",0)
  
   While Not slShouldClose()
     If slGetKey(#SL_KEY_ESCAPE) 
       slClose()
      EndIf
      slRender()
    Wend
    
    slClose()
  CloseLibrary(#SIGIL_D)
EndIf

Re: Sigil Wrapper

Posted: Fri Apr 14, 2023 10:58 am
by luis
Hi and welcome.

Never heard of the lib, I will look into its sources, thanks. Also what a cool name it has :)

Some suggestions looking at your code (I know this is just a test done with the demo, but anyway)

PB uses unicode for its strings, so when passing strings to a library expecting ascii or utf8, you should use pseudo types (see in the help file) like p-ascii, or convert the buffer to ascii using the function Ascii() (that's probably why the "Hello" is truncated to "H").

Maybe you could use a macro to validate the import of the functions so to check automatically if the pointer is not zero and guard against misspelling of the function names, of against a function removal in a newer version of the DLL etc.

Also keep in mind if importing from C usually the Prototype should be PrototypeC to match the calling convention, don't know here but I suspect it may be.

Ah, you can read my little PB review in my signature, since you were asking opinions about it.

Re: Sigil Wrapper

Posted: Fri Apr 14, 2023 9:07 pm
by LeftyGuitar
Thanks for the tips. Yeah I was trying to find how to convert C's "const char*" to a Purebasic string type.

Re: Sigil Wrapper

Posted: Sat Apr 15, 2023 6:27 pm
by infratec
Btw. you should use #PB_Any at OpenLibrary(), because what are you doing if someone else also use 0 to open an other library :?:

For such a special case I use a global variable. (Normally I avoid global variables)

Code: Select all

Global LibSigil.i

LibSigil = OpenLibrary(#PB_Any, ...)
If LibSigil
...
endif
And ...
use always EnableExplicit as first command.
It safes you a lot of time in larger programs if you don't have to find a typo. :wink:

Re: Sigil Wrapper

Posted: Sat Apr 15, 2023 7:18 pm
by Caronte3D
infratec wrote: Sat Apr 15, 2023 6:27 pm And ...
use always EnableExplicit as first command.
It should be the default mode :|

Re: Sigil Wrapper

Posted: Sat Apr 15, 2023 8:14 pm
by mk-soft
LeftyGuitar wrote: Fri Apr 14, 2023 9:07 pm Thanks for the tips. Yeah I was trying to find how to convert C's "const char*" to a Purebasic string type.
In purebasic, all strings are Unicode.

For a return of type const char*, this is most type AscII.

Code: Select all


; dummy function with const char*
Procedure foo() ; retval const char*
  Static *pChar
  
  If *pChar
    FreeMemory(*pChar)
  EndIf
  
  *pChar = Ascii("Hello World!")
  ProcedureReturn *pChar
EndProcedure

*r1 = foo()
If *r1
  s1.s = PeekS(*r1, -1, #PB_Ascii)
EndIf

Debug s1


Re: Sigil Wrapper

Posted: Sat Apr 15, 2023 9:32 pm
by LeftyGuitar
Thanks for all the tips. I'm new to PB, so I'm still learning.

Re: Sigil Wrapper

Posted: Sun Apr 16, 2023 12:42 pm
by Fred
Here is a version with an advanced macro to ease the mapping (and avoid typos). Only mapped 3 functions, but you get the idea. Also PrototypeC is needed if you import C functions which are not stdcall (only matter on x86):

Code: Select all

;Sigil PureBasic Wrapper
;Written By Andy P.
;Icy Viking Games
;Copyright (c) 2023

;Global Var
#SIGIL_D = 0

;Flags/Constants
#SL_ALIGN_CENTER = 0
#SL_ALIGN_RIGHT = 1
#SL_ALIGN_LEFT = 2

#SL_KEY_ESCAPE = 256
#SL_KEY_ENTER = 257
#SL_KEY_TAB = 258
#SL_KEY_BACKSPACE = 259
#SL_KEY_INSERT = 260
#SL_KEY_DELETE = 261
#SL_KEY_RIGHT = 262
#SL_KEY_LEFT = 263
#SL_KEY_DOWN = 264
#SL_KEY_UP = 265
#SL_KEY_PAGE_UP = 266
#SL_KEY_PAGE_DOWN = 267
#SL_KEY_HOME = 268
#SL_KEY_END = 269
#SL_KEY_CAPS_LOCK = 280
#SL_KEY_SCROLL_LOCK = 281
#SL_KEY_NUM_LOCK = 282
#SL_KEY_PRINT_SCREEN = 283
#SL_KEY_PAUSE = 284
#SL_KEY_F1 = 290
#SL_KEY_F2 = 291
#SL_KEY_F3 = 292
#SL_KEY_F4 = 293
#SL_KEY_F5 = 294
#SL_KEY_F6 = 295
#SL_KEY_F7 = 296
#SL_KEY_F8 = 297
#SL_KEY_F9 = 298
#SL_KEY_F10 = 299
#SL_KEY_F11 = 300
#SL_KEY_F12 = 301
#SL_KEY_F13 = 302
#SL_KEY_F14 = 303
#SL_KEY_F15 = 304
#SL_KEY_F16 = 305
#SL_KEY_F17 = 306
#SL_KEY_F18 = 307
#SL_KEY_F19 = 308
#SL_KEY_F20 = 309
#SL_KEY_F21 = 310
#SL_KEY_F22 = 311
#SL_KEY_F23 = 312
#SL_KEY_F24 = 313
#SL_KEY_F25 = 314
#SL_KEY_KEYPAD_0 = 320
#SL_KEY_KEYPAD_1 = 321
#SL_KEY_KEYPAD_2 = 322
#SL_KEY_KEYPAD_3 = 323
#SL_KEY_KEYPAD_4 = 324
#SL_KEY_KEYPAD_5 = 325
#SL_KEY_KEYPAD_6 = 326
#SL_KEY_KEYPAD_7 = 327
#SL_KEY_KEYPAD_8 = 328
#SL_KEY_KEYPAD_9 = 329
#SL_KEY_KEYPAD_DECIMAL = 330
#SL_KEY_KEYPAD_DIVIDE = 331
#SL_KEY_KEYPAD_MULTIPLY = 332
#SL_KEY_KEYPAD_SUBTRACT = 333
#SL_KEY_KEYPAD_ADD = 334
#SL_KEY_KEYPAD_ENTER = 335
#SL_KEY_KEYPAD_EQUAL = 336
#SL_KEY_LEFT_SHIFT = 340
#SL_KEY_LEFT_CONTROL = 341
#SL_KEY_LEFT_ALT = 342
#SL_KEY_LEFT_SUPER = 343
#SL_KEY_RIGHT_SHIFT = 344
#SL_KEY_RIGHT_CONTROL = 345
#SL_KEY_RIGHT_ALT = 346
#SL_KEY_RIGHT_SUPER = 347

#SL_MOUSE_BUTTON_1 = 0
#SL_MOUSE_BUTTON_2 = 1
#SL_MOUSE_BUTTON_3 = 2
#SL_MOUSE_BUTTON_4 = 3
#SL_MOUSE_BUTTON_5 = 4
#SL_MOUSE_BUTTON_6 = 5
#SL_MOUSE_BUTTON_7 = 6
#SL_MOUSE_BUTTON_8 = 7
#SL_MOUSE_BUTTON_LEFT = #SL_MOUSE_BUTTON_1
#SL_MOUSE_BUTTON_RIGHT = #SL_MOUSE_BUTTON_2
#SL_MOUSE_BUTTON_MIDDLE = #SL_MOUSE_BUTTON_3

;Prototypes
PrototypeC.I ProtoslShouldClose()

PrototypeC.I ProtoslGetKey(key.i)

PrototypeC.I ProtoslGetMouseButton(button.i)
PrototypeC.I ProtoslGetMouseX()
PrototypeC.I ProtoslGetMouseY()

PrototypeC.D ProtoslGetDeltaTime()
PrototypeC.D ProtoslGetTime()

PrototypeC ProtoslRender()

PrototypeC ProtoslSetBackColor(red.d,green.d,blue.d)
PrototypeC ProtoslSetForeColor(red.d,green.d,blue.d,alpha.d)

PrototypeC ProtoslSetAdditiveBlend(ab.i)

PrototypeC ProtoslPush()
PrototypeC ProtoslPop()

PrototypeC ProtoslTranslate(x.d,y.d)
PrototypeC ProtoslRotate(degrees.d)
PrototypeC ProtoslScale(x.d,y.d)

PrototypeC.I ProtoslLoadTexture(filename.s)

PrototypeC.I ProtoslLoadWAV(filename.s)
PrototypeC.I ProtoslSoundPlay(sound.i)
PrototypeC.I ProtoslSoundLoop(sound.i)
PrototypeC ProtoslSoundPause(sound.i)
PrototypeC ProtoslSoundStop(sound.i)
PrototypeC ProtoslSoundPauseAll()
PrototypeC ProtoslSoundResumeAll()
PrototypeC ProtoslSoundStopAll()
PrototypeC.I ProtoslSoundPlaying(sound.i)
PrototypeC.I ProtoslSoundLooping(sound.i)

PrototypeC ProtoslTriangleFill(x.d,y.d,width.d,height.d)
PrototypeC ProtoslTriangleOutline(x.d,y.d,width.d,height.d)

PrototypeC ProtoslRectangleFill(x.d,y.d,width.d,height.d)
PrototypeC ProtoslRectangleOutline(x.d,y.d,width.d,height.d)

PrototypeC ProtoslCircleFill(x.d,y.d,radius.d,numVerts.i)
PrototypeC ProtoslCircleOutline(x.d,y.d,radius.d,numVerts.i)

PrototypeC ProtoslSemiCircleFill(x.d,y.d,radius.d,numVerts.i,degrees.d)
PrototypeC ProtoslSemiCircleOutline(x.d,y.d,radius.d,numVerts.i,degrees.d)

PrototypeC ProtoslPoint(x.d,y.d)

PrototypeC ProtoslLine(x1.d,y1.d,x2.d,y2.d)

PrototypeC ProtoslSetSpriteTiling(x.d,y.d)
PrototypeC ProtoslSetSpriteScroll(x.d,y.d)
PrototypeC ProtoslSprite(texture.i,x.d,y.d,width.d,height.d)

PrototypeC ProtoslSetTextAlign(fontAlign.i)
PrototypeC ProtoslGetTextWidth(text.s)
PrototypeC ProtoslGetTextHeight(text.s)
PrototypeC ProtoslLoadFont(fontFileName.s)
PrototypeC ProtoslSetFont(font.i,fonstSize.i)
PrototypeC ProtoslSetFontSize(fontsize.i)
PrototypeC ProtoslText(x.d,y.d,text.s)

Macro DoubleQuote
  "
EndMacro

Macro MapSigilFunction(FunctionName, Parameters)
  PrototypeC Proto#FunctionName#Parameters
  Global FunctionName#.Proto#FunctionName = GetFunction(#SIGIL_D,DoubleQuote#FunctionName#DoubleQuote)
  If FunctionName = 0
    Debug "Function: "+DoubleQuote#FunctionName#DoubleQuote+"() not found in DLL"
  EndIf
EndMacro

;DLL Calls
If OpenLibrary(#SIGIL_D,"sigil.dll")
  
  MapSigilFunction(slWindow, (width.i,height.i,title.p-ascii,fullScreen.i))
  MapSigilFunction(slShowCursor, (showCursor.i))
  MapSigilFunction(slClose, ())
  
  slShouldClose.ProtoslShouldClose = GetFunction(#SIGIL_D,"slShouldClose")
  
  slGetKey.ProtoslGetKey = GetFunction(#SIGIL_D,"slGetKey")
  
  slGetMouseButton.ProtoslGetMouseButton = GetFunction(#SIGIL_D,"slGetMouseButton")
  slGetMouseX.ProtoslGetMouseX = GetFunction(#SIGIL_D,"slGetMouseX")
  slGetMouseY.ProtoslGetMouseY = GetFunction(#SIGIL_D,"slGetMouseY")
  
  slRender.ProtoslRender = GetFunction(#SIGIL_D,"slRender")
  
  slSetBackColor.ProtoslSetBackColor = GetFunction(#SIGIL_D,"slSetBackColor")
  slSetForeColor.ProtoslSetForeColor = GetFunction(#SIGIL_D,"slSetForeColor")
  
  slSetAdditiveBlend.ProtoslSetAdditiveBlend = GetFunction(#SIGIL_D,"slSetAdditiveBlend")
  
  slPush.ProtoslPush = GetFunction(#SIGIL_D,"slPush")
  slPop.ProtoslPop = GetFunction(#SIGIL_D,"slPop")
  
  slTranslate.ProtoslTranslate = GetFunction(#SIGIL_D,"slTranslate")
  slRotate.ProtoslRotate = GetFunction(#SIGIL_D,"slRotate")
  slScale.ProtoslScale = GetFunction(#SIGIL_D,"slScale")
  
  slLoadTexture.ProtoslLoadTexture = GetFunction(#SIGIL_D,"slLoadTexture")
  
  slLoadWAV.ProtoslLoadWAV = GetFunction(#SIGIL_D,"slLoadWAV")
  slSoundPlay.ProtoslSoundPlay = GetFunction(#SIGIL_D,"slSoundPlay")
  slSoundLoop.ProtoslSoundLoop = GetFunction(#SIGIL_D,"slSoundLoop")
  slSoundPause.ProtoslSoundPause = GetFunction(#SIGIL_D,"slSoundPause")
  slSoundStop.ProtoslSoundStop = GetFunction(#SIGIL_D,"slSoundStop")
  slSoundPauseAll.ProtoslSoundPauseAll = GetFunction(#SIGIL_D,"slSoundPauseAll")
  slSoundResumeAll.ProtoslSoundResumeAll = GetFunction(#SIGIL_D,"slSoundResumeAll")
  slSoundStopAll.ProtoslSoundStopAll = GetFunction(#SIGIL_D,"slSoundStopAll")
  slSoundPlaying.ProtoslSoundPlaying = GetFunction(#SIGIL_D,"slSoundPlaying")
  slSoundLooping.ProtoslSoundLooping = GetFunction(#SIGIL_D,"slSoundLooping")
  
  slTriangleFill.ProtoslTriangleFill = GetFunction(#SIGIL_D,"slTriangleFill")
  slTriangleOutline.ProtoslTriangleOutline = GetFunction(#SIGIL_D,"slTriangleOutline")
  
  slRectangleFill.ProtoslRectangleFill = GetFunction(#SIGIL_D,"slRectangleFill")
  slRectangleOutline.ProtoslRectangleOutline = GetFunction(#SIGIL_D,"slRectangleOutline")
  
  slCircleFill.ProtoslCircleFill = GetFunction(#SIGIL_D,"slCircleFill")
  slCircleOutline.ProtoslCircleOutline = GetFunction(#SIGIL_D,"slCircleOutline")
  
  slSemiCircleFill.ProtoslSemiCircleFill = GetFunction(#SIGIL_D,"slSemiCircleFill")
  slSemiCircleOutline.ProtoslSemiCircleOutline = GetFunction(#SIGIL_D,"slSemiCircleOutline")
  
  slPoint.ProtoslPoint = GetFunction(#SIGIL_D,"slPoint")
  
  slLine.ProtoslLine = GetFunction(#SIGIL_D,"slLine")
  
  slSetSpriteTiling.ProtoslSetSpriteTiling = GetFunction(#SIGIL_D,"slSetSpriteTiling")
  slSetSpriteScroll.ProtoslSetSpriteScroll = GetFunction(#SIGIL_D,"slSetSpriteScroll")
  slSprite.ProtoslSprite = GetFunction(#SIGIL_D,"slSprite")
  
  slSetTextAlign.ProtoslSetTextAlign = GetFunction(#SIGIL_D,"slSetTextAlign")
  slGetTextWidth.ProtoslGetTextWidth = GetFunction(#SIGIL_D,"slGetTextWidth")
  slGetTextHeight.ProtoslGetTextHeight = GetFunction(#SIGIL_D,"slGetTextHeight")
  slLoadFont.ProtoslLoadFont = GetFunction(#SIGIL_D,"slLoadFont")
  slSetFont.ProtoslSetFont = GetFunction(#SIGIL_D,"slSetFont")
  slSetFontSize.ProtoslSetFontSize = GetFunction(#SIGIL_D,"slSetFontSize")
  slText.ProtoslText = GetFunction(#SIGIL_D,"slText")
   
   ;Simple Example
   slWindow(800,600,"Hello",0)
  
   While Not slShouldClose()
     If slGetKey(#SL_KEY_ESCAPE) 
       slClose()
      EndIf
      slRender()
    Wend
    
    slClose()
  CloseLibrary(#SIGIL_D)
EndIf