Results 1 to 2 of 2

Thread: Sigil Wrapper

  1. #1
    Junior Member
    Join Date
    Feb 2022
    Posts
    3
    Rep Power
    0

    Sigil Wrapper

    Hello all,

    I have made a wrapper for the Sigil library. The official website for it is down, but it is a multimeda library that is small and easy to use. I wasn't exactly sure how to put it into a module. But the example and wrapper code below works!

    'Thinbasic Sigil Wrapper
    'Written by Icy_Viking
    'Icy Viking Games
    'Copyright (c) 2022
    
    Uses "Console"
    
    'Sigil Flags
    const SL_ALIGN_CENTER = 0
    const SL_ALIGN_RIGHT = 1
    const SL_ALIGN_LEFT = 2
    
    const SL_KEY_ESCAPE = 256
    const SL_KEY_ENTER = 257
    const SL_KEY_TAB = 258
    const SL_KEY_BACKSPACE = 259
    const SL_KEY_INSERT = 260
    const SL_KEY_DELETE = 261
    const SL_KEY_RIGHT = 262
    const SL_KEY_LEFT = 263
    const SL_KEY_DOWN = 264
    const SL_KEY_UP = 265
    const SL_KEY_PAGE_UP = 266
    const SL_KEY_PAGE_DOWN = 267
    const SL_KEY_HOME = 268
    const SL_KEY_END = 269
    const SL_KEY_CAPS_LOCK = 280
    const SL_KEY_SCROLL_LOCK = 281
    const SL_KEY_NUM_LOCK = 282
    const SL_KEY_PRINT_SCREEN = 283
    const SL_KEY_PAUSE = 284
    const SL_KEY_F1 = 290
    const SL_KEY_F2 = 291
    const SL_KEY_F3 = 292
    const SL_KEY_F4 = 293
    const SL_KEY_F5 = 294
    const SL_KEY_F6 = 295
    const SL_KEY_F7 = 296
    const SL_KEY_F8 = 297
    const SL_KEY_F9 = 298
    const SL_KEY_F10 = 299
    const SL_KEY_F11 = 300
    const SL_KEY_F12 = 301
    const SL_KEY_F13 = 302
    const SL_KEY_F14 = 303
    const SL_KEY_F15 = 304
    const SL_KEY_F16 = 305
    const SL_KEY_F17 = 306
    const SL_KEY_F18 = 307
    const SL_KEY_F19 = 308
    const SL_KEY_F20 = 309
    const SL_KEY_F21 = 310
    const SL_KEY_F22 = 311
    const SL_KEY_F23 = 312
    const SL_KEY_F24 = 313
    const SL_KEY_F25 = 314
    const SL_KEY_KEYPAD_0 = 320
    const SL_KEY_KEYPAD_1 = 321
    const SL_KEY_KEYPAD_2 = 322
    const SL_KEY_KEYPAD_3 = 323
    const SL_KEY_KEYPAD_4 = 324
    const SL_KEY_KEYPAD_5 = 325
    const SL_KEY_KEYPAD_6 = 326
    const SL_KEY_KEYPAD_7 = 327
    const SL_KEY_KEYPAD_8 = 328
    const SL_KEY_KEYPAD_9 = 329
    const SL_KEY_KEYPAD_DECIMAL = 330
    const SL_KEY_KEYPAD_DIVIDE = 331
    const SL_KEY_KEYPAD_MULTIPLY = 332
    const SL_KEY_KEYPAD_SUBTRACT = 333
    const SL_KEY_KEYPAD_ADD = 334
    const SL_KEY_KEYPAD_ENTER = 335
    const SL_KEY_KEYPAD_EQUAL = 336
    const SL_KEY_LEFT_SHIFT = 340
    const SL_KEY_LEFT_CONTROL = 341
    const SL_KEY_LEFT_ALT = 342
    const SL_KEY_LEFT_SUPER = 343
    const SL_KEY_RIGHT_SHIFT = 344
    const SL_KEY_RIGHT_CONTROL = 345
    const SL_KEY_RIGHT_ALT = 346
    const SL_KEY_RIGHT_SUPER = 347
    
    const SL_MOUSE_BUTTON_1 = 0
    const SL_MOUSE_BUTTON_2 = 1
    const SL_MOUSE_BUTTON_3 = 2
    const SL_MOUSE_BUTTON_4 = 3
    const SL_MOUSE_BUTTON_5 = 4
    const SL_MOUSE_BUTTON_6 = 5
    const SL_MOUSE_BUTTON_7 = 6
    const SL_MOUSE_BUTTON_8 = 7
    const SL_MOUSE_BUTTON_LEFT = SL_MOUSE_BUTTON_1
    const SL_MOUSE_BUTTON_RIGHT = SL_MOUSE_BUTTON_2
    const SL_MOUSE_BUTTON_MIDDLE = SL_MOUSE_BUTTON_3
    
    'Sigil Functions
    declare sub slWindow lib "sigil.dll" alias "slWindow" (byval w as integer,byval h as integer,byval title as string,byval fScreen as integer)
    declare sub slShowCursor lib "sigil.dll" alias "slShowCursor" (byval showC as integer)
    declare sub slClose lib "sigil.dll" alias "slClose" ()
    declare function slShouldClose lib "sigil.dll" alias "slShouldClose" () as integer
    
    declare function slGetKey lib "sigil.dll" alias "slGetKey" (byval k as integer) as integer
    
    declare function slGetMouseButton lib "sigil.dll" alias "slGetMouseButton" (byval b as integer) as integer
    declare function slGetMouseX lib "sigil.dll" alias "slGetMouseX" () as integer
    declare function slGetMouseY lib "sigil.dll" alias "slGetMouseY" () as integer
    
    declare function slGetDeltaTime lib "sigil.dll" alias "slGetDeltaTime" () as double
    declare function slGetTime lib "sigil.dll" alias "slGetTime" () as double
    
    declare sub slSetBackColor lib "sigil.dll" alias "slSetBackColor" (byval r as double,byval g as double,byval b as double)
    declare sub slSetForeColor lib "sigil.dll" alias "slSetForeColor" (byval r as double,byval g as double,byval b as double,byval a as double)
    
    declare sub slSetAdditiveBlend lib "sigil.dll" alias "slSetAdditiveBlend" (byval ab as integer)
    
    declare sub slPush lib "sigil.dll" alias "slPush" ()
    declare sub slPop lib "sigil.dll" alias "slPop" ()
    
    declare sub slTranslate lib "sigil.dll" alias "slTranslate" (byval x as double,byval y as double)
    declare sub slRotate lib "sigil.dll" alias "slRotate" (byval deg as double)
    declare sub slScale lib "sigil.dll" alias "slScale" (byval x as double,byval y as double)
    
    declare function slLoadTexture lib "sigil.dll" alias "slLoadTexture" (byval fname as string) as integer
    
    declare function slLoadWAV lib "sigil.dll" alias "slLoadWAV" (byval fname as string) as integer
    declare function slSoundPlay lib "sigil.dll" alias "slSoundPlay" (byval s as integer) as integer
    declare function slSoundLoop lib "sigil.dll" alias "slSoundLoop" (byval s as integer) as integer
    declare sub slSoundPause lib "sigil.dll" alias "slSoundPause" (byval s as integer)
    declare sub slSoundStop lib "sigil.dll" alias "slSoundStop" (byval s as integer)
    declare sub slSoundPauseAll lib "sigil.dll" alias "slSoundPauseAll" ()
    declare sub slSoundResumeAll lib "sigil.dll" alias "slSoundResumeAll" ()
    declare sub slSoundStopAll lib "sigil.dll" alias "slSoundStopAll" ()
    declare function slSoundPlaying lib "sigil.dll" alias "slSoundPlaying" (byval s as integer) as integer
    declare function slSoundLooping lib "sigil.dll" alias "slSoundLooping" (byval s as integer) as integer
    
    declare sub slTriangleFill lib "sigil.dll" alias "slTriangleFill" (byval x as double,byval y as double,byval w as double,byval h as double)
    declare sub slTriangleOutline lib "sigil.dll" alias "slTriangleOutline" (byval x as double,byval y as double,byval w as double,byval h as double)
    
    declare sub slRectangleFill lib "sigil.dll" alias "slRectangleFill" (byval x as double,byval y as double,byval w as double,byval h as double)
    declare sub slRectangleOutline lib "sigil.dll" alias "slRectangleOutline" (byval x as double,byval y as double,byval w as double,byval h as double)
    
    declare sub slCircleFill lib "sigil.dll" alias "slCircleFill" (byval x as double,byval y as double,byval rad as double,byval num as integer)
    declare sub slCircleOutline lib "sigil.dll" alias "slCircleOutline" (byval x as double,byval y as double,byval rad as double,byval num as integer,byval deg as double)
    
    declare sub slSemiCircleFill lib "sigil.dll" alias "slSemiCircleFill" (byval x as double,byval y as double,byval rad as double,byval num as integer,byval deg as double)
    declare sub slSemiCircleOutline lib "sigil.dll" alias "slSemiCircleOutline" (byval x as double,byval y as double,byval rad as double,byval num as integer,byval deg as double)
    
    declare sub slPoint lib "sigil.dll" alias "slPoint" (byval x as double,byval y as double)
    
    declare sub slLine lib "sigil.dll" alias "slLine" (byval x as double,byval y as double,byval x2 as double,byval y2 as double)
    
    declare sub slSetSpriteTiling lib "sigil.dll" alias "slSetSpriteTiling" (byval x as double,byval y as double)
    declare sub slSetSpriteScroll lib "sigil.dll" alias "slSetSpriteScroll" (byval x as double,byval y as double)
    declare sub slSprite lib "sigil.dll" alias "slSprite" (byval tex as integer,byval x as double,byval y as double,byval w as double,byval h as double)
    
    declare sub slRender lib "sigil.dll" alias "slRender" ()
    
    declare sub slTextAlign lib "sigil.dll" alias "slTextAlign" (byval fa as integer)
    declare function slGetTextWidth lib "sigil.dll" alias "slGetTextWidth" (byval t as string) as double
    declare function slGetTextHeight lib "sigil.dll" alias "slGetTextHeight" (byval t as string) as double
    declare function slLoadFont lib "sigil.dll" alias "slLoadFont" (byval fname as string) as integer
    declare sub slSetFont lib "sigil.dll" alias "slSetFont" (byval f as integer,byval s as integer)
    declare sub slSetFontSize lib "sigil.dll" alias "slSetFontSize" (byval fs as integer)
    declare sub slText lib "sigil.dll" alias "slText" (byval x as double,byval y as double,byval t as string)
    
    Function TBMain()
    
    slWindow(800,600,"Hello",0)
    
    while not slShouldClose()
    
    if slGetKey(SL_KEY_ESCAPE) = 1 then
      slClose()
    endif
    
    slRender()
    wend
    
    slClose()
    WaitKey
    End Function
    

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Thank you for sharing your work with the community!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. MCI Video Wrapper
    By Petr Schreiber in forum Experimental modules or library interface
    Replies: 20
    Last Post: 17-07-2020, 20:55
  2. OpenB3D Engine Wrapper for ThinBasic (open testing)
    By Artemka in forum TBGL Scripts and Projects
    Replies: 4
    Last Post: 12-03-2013, 23:38
  3. Another open source wrapper for FreeBASIC
    By maxim in forum Irrlicht
    Replies: 3
    Last Post: 24-06-2011, 08:03

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •